003 File Manager
Current Path:
/usr/sbin
usr
/
sbin
/
📁
..
📄
ac
(10.36 KB)
📄
accton
(5.66 KB)
📄
acpiconf
(9.14 KB)
📄
acpidb
(496.75 KB)
📄
acpidump
(39.86 KB)
📄
adduser
(23.38 KB)
📄
ancontrol
(34.19 KB)
📄
apm
(13.1 KB)
📄
arp
(17.88 KB)
📄
ath3kfw
(14.51 KB)
📄
audit
(5.98 KB)
📄
auditd
(21.79 KB)
📄
auditdistd
(127.49 KB)
📄
auditreduce
(15.34 KB)
📄
authpf
(20.57 KB)
📄
authpf-noip
(20.57 KB)
📄
automount
(50.65 KB)
📄
automountd
(50.65 KB)
📄
autounmountd
(50.65 KB)
📄
bcmfw
(8.68 KB)
📄
bhyve
(374.03 KB)
📄
bhyvectl
(41.55 KB)
📄
bhyveload
(16.41 KB)
📄
binmiscctl
(14.12 KB)
📄
blacklistctl
(33.88 KB)
📄
blacklistd
(41.85 KB)
📄
bluetooth-config
(9.71 KB)
📄
boot0cfg
(15.09 KB)
📄
bootparamd
(15.81 KB)
📄
bootpef
(38.09 KB)
📄
bootptest
(17.37 KB)
📄
bsdconfig
(11.98 KB)
📄
bsdinstall
(3.44 KB)
📄
bsnmpd
(136.55 KB)
📄
bthidcontrol
(36.06 KB)
📄
bthidd
(55.51 KB)
📄
btpand
(32.42 KB)
📄
btxld
(13.49 KB)
📄
callbootd
(9.26 KB)
📄
camdd
(37.59 KB)
📄
cdcontrol
(22.45 KB)
📄
certctl
(7.74 KB)
📄
chkgrp
(9.04 KB)
📄
chkprintcap
(18.22 KB)
📄
chown
(10.23 KB)
📄
chroot
(8.31 KB)
📄
ckdist
(16.18 KB)
📄
clear_locks
(6.23 KB)
📄
config
(56.23 KB)
📄
cpucontrol
(20.03 KB)
📄
crashinfo
(8.21 KB)
📄
cron
(44.9 KB)
📄
ctladm
(66.98 KB)
📄
ctld
(123.97 KB)
📄
cxgbetool
(2.86 MB)
📄
daemon
(15.76 KB)
📄
dconschat
(22.84 KB)
📄
devctl
(11.83 KB)
📄
devinfo
(8.68 KB)
📄
diskinfo
(19.2 KB)
📄
dtrace
(35.91 KB)
📄
dumpcis
(26.69 KB)
📄
dwatch
(36.59 KB)
📄
editmap
(84.02 KB)
📄
edquota
(22.9 KB)
📄
efibootmgr
(22.04 KB)
📄
efidp
(9.79 KB)
📄
efivar
(14.77 KB)
📄
etcupdate
(43.94 KB)
📄
extattrctl
(16.63 KB)
📄
fdcontrol
(14.94 KB)
📄
fdformat
(18.52 KB)
📄
fdread
(17.14 KB)
📄
fdwrite
(10.19 KB)
📄
fifolog_create
(9.03 KB)
📄
fifolog_reader
(31.19 KB)
📄
fifolog_writer
(15.57 KB)
📄
flowctl
(12.19 KB)
📄
fmtree
(36.11 KB)
📄
freebsd-update
(91.6 KB)
📄
fstyp
(19.38 KB)
📄
ftp-proxy
(28.19 KB)
📄
fwcontrol
(32.87 KB)
📄
gensnmptree
(29.26 KB)
📄
getextattr
(11.24 KB)
📄
getfmac
(6.78 KB)
📄
getpmac
(6.9 KB)
📄
gpioctl
(11.71 KB)
📄
gssd
(34.37 KB)
📄
gstat
(23.22 KB)
📄
hccontrol
(174.81 KB)
📄
hcsecd
(30.18 KB)
📄
hcseriald
(10.12 KB)
📄
hostapd
(876.65 KB)
📄
hostapd_cli
(79.18 KB)
📄
hoststat
(8.41 KB)
📄
hv_kvp_daemon
(21.99 KB)
📄
hv_vss_daemon
(9.45 KB)
📄
i2c
(14.99 KB)
📄
iasl
(1.34 MB)
📄
idprio
(7.61 KB)
📄
ifmcstat
(12.74 KB)
📄
inetd
(47.88 KB)
📄
iostat
(19.66 KB)
📄
iovctl
(19.91 KB)
📄
ip6addrctl
(12.2 KB)
📄
ipfwpcap
(10.79 KB)
📄
iprop-log
(24.89 KB)
📄
iscsid
(37.38 KB)
📄
iwmbtfw
(19.09 KB)
📄
jail
(68.96 KB)
📄
jexec
(8.85 KB)
📄
jls
(15.11 KB)
📄
kbdcontrol
(39.62 KB)
📄
kbdmap
(16.16 KB)
📄
keyserv
(24.67 KB)
📄
kgmon
(13.02 KB)
📄
kldxref
(29.59 KB)
📄
kstash
(9.68 KB)
📄
ktutil
(38.81 KB)
📄
l2control
(12.84 KB)
📄
l2ping
(10.6 KB)
📄
lastlogin
(8.5 KB)
📄
local-unbound
(148.45 KB)
📄
local-unbound-anchor
(38.63 KB)
📄
local-unbound-checkconf
(29.43 KB)
📄
local-unbound-control
(33.32 KB)
📄
local-unbound-setup
(11.7 KB)
📄
lockstat
(49.98 KB)
📄
lpc
(55.95 KB)
📄
lpd
(82.2 KB)
📄
lptcontrol
(6.48 KB)
📄
lptest
(6.03 KB)
📄
lsextattr
(11.24 KB)
📄
mailstats
(73.28 KB)
📄
mailwrapper
(8.41 KB)
📄
makefs
(183.64 KB)
📄
makemap
(89.47 KB)
📄
manctl
(7.75 KB)
📄
memcontrol
(11.88 KB)
📄
mergemaster
(43.59 KB)
📄
mfiutil
(75.3 KB)
📄
mixer
(12.14 KB)
📄
mld6query
(10.53 KB)
📄
mlx5tool
(11.54 KB)
📄
mlxcontrol
(19.72 KB)
📄
mount_smbfs
(15.29 KB)
📄
mountd
(54.05 KB)
📄
moused
(40.59 KB)
📄
mprutil
(33.95 KB)
📄
mpsutil
(33.95 KB)
📄
mptable
(15.74 KB)
📄
mptutil
(46.35 KB)
📄
mtest
(17.24 KB)
📄
mtree
(60.94 KB)
📄
ndis_events
(9.19 KB)
📄
ndiscvt
(39.78 KB)
📄
ndisgen
(15.83 KB)
📄
ndp
(24.03 KB)
📄
newsyslog
(46.39 KB)
📄
nfscbd
(10.15 KB)
📄
nfsd
(22.62 KB)
📄
nfsdumpstate
(8.02 KB)
📄
nfsrevoke
(6.08 KB)
📄
nfsuserd
(16.87 KB)
📄
ngctl
(29.15 KB)
📄
nghook
(10.09 KB)
📄
nmtree
(60.94 KB)
📄
nologin
(625.77 KB)
📄
nscd
(87.91 KB)
📄
ntp-keygen
(205.75 KB)
📄
ntpd
(842.26 KB)
📄
ntpdate
(126.85 KB)
📄
ntpdc
(268.29 KB)
📄
ntptime
(83.42 KB)
📄
pac
(28.74 KB)
📄
pciconf
(37.38 KB)
📄
periodic
(4.19 KB)
📄
pkg
(32.22 KB)
📄
plockstat
(22.91 KB)
📄
pmc
(167.45 KB)
📄
pmcannotate
(15.8 KB)
📄
pmccontrol
(11.81 KB)
📄
pmcstat
(77.77 KB)
📄
pnfsdscopymr
(9.09 KB)
📄
pnfsdsfile
(10.01 KB)
📄
pnfsdskill
(6.26 KB)
📄
portsnap
(29.86 KB)
📄
powerd
(15.97 KB)
📄
ppp
(427.13 KB)
📄
pppctl
(15.77 KB)
📄
praliases
(86.38 KB)
📄
praudit
(9.13 KB)
📄
prometheus_sysctl_exporter
(13.91 KB)
📄
pstat
(14.47 KB)
📄
purgestat
(8.41 KB)
📄
pw
(74.28 KB)
📄
pwd_mkdb
(16.71 KB)
📄
pwm
(10.45 KB)
📄
quot
(14.92 KB)
📄
quotaoff
(8.29 KB)
📄
quotaon
(8.29 KB)
📄
rarpd
(16.11 KB)
📄
repquota
(11.14 KB)
📄
rfcomm_pppd
(13.8 KB)
📄
rip6query
(7.69 KB)
📄
rmextattr
(11.24 KB)
📄
rmt
(9.48 KB)
📄
rmuser
(8.96 KB)
📄
route6d
(46.17 KB)
📄
rpc.lockd
(64.46 KB)
📄
rpc.statd
(22.27 KB)
📄
rpc.umntall
(12.3 KB)
📄
rpc.yppasswdd
(41.08 KB)
📄
rpc.ypupdated
(18.19 KB)
📄
rpc.ypxfrd
(16.12 KB)
📄
rpcbind
(43.91 KB)
📄
rrenumd
(34.28 KB)
📄
rtadvctl
(31.52 KB)
📄
rtadvd
(70.95 KB)
📄
rtprio
(7.61 KB)
📄
rtsold
(40.09 KB)
📄
rwhod
(17.15 KB)
📄
sa
(23.57 KB)
📄
sade
(48.1 KB)
📄
sdpcontrol
(15.98 KB)
📄
sdpd
(38.07 KB)
📄
sendmail
(8.41 KB)
📄
service
(4.84 KB)
📄
services_mkdb
(14.02 KB)
📄
sesutil
(20.83 KB)
📄
setextattr
(11.24 KB)
📄
setfib
(7.2 KB)
📄
setfmac
(14.27 KB)
📄
setfsmac
(14.27 KB)
📄
setpmac
(6.11 KB)
📄
smbmsg
(10.09 KB)
📄
snapinfo
(7.46 KB)
📄
sntp
(324.31 KB)
📄
spi
(15.59 KB)
📄
spkrtest
(3.62 KB)
📄
spray
(7.8 KB)
📄
sshd
(302.45 KB)
📄
swapinfo
(14.47 KB)
📄
syslogd
(53.15 KB)
📄
sysrc
(22.64 KB)
📄
tcpdchk
(19.85 KB)
📄
tcpdmatch
(16.88 KB)
📄
tcpdrop
(10.25 KB)
📄
tcpdump
(936.43 KB)
📄
traceroute
(33.23 KB)
📄
traceroute6
(30.32 KB)
📄
trim
(9.41 KB)
📄
trpt
(11.45 KB)
📄
tzsetup
(20.19 KB)
📄
uathload
(9.28 KB)
📄
uefisign
(20.87 KB)
📄
ugidfw
(8.57 KB)
📄
uhsoctl
(26.11 KB)
📄
usbconfig
(26.59 KB)
📄
usbdump
(16.42 KB)
📄
utx
(7.81 KB)
📄
valectl
(12.23 KB)
📄
vidcontrol
(27.79 KB)
📄
vidfont
(16.16 KB)
📄
vigr
(2.42 KB)
📄
vipw
(7.2 KB)
📄
wake
(7.33 KB)
📄
watch
(12.79 KB)
📄
watchdog
(15.37 KB)
📄
watchdogd
(15.37 KB)
📄
wlandebug
(16.26 KB)
📄
wpa_cli
(529.82 KB)
📄
wpa_passphrase
(37.72 KB)
📄
wpa_supplicant
(926.5 KB)
📄
yp_mkdb
(11.82 KB)
📄
ypbind
(20.45 KB)
📄
ypinit
(8.8 KB)
📄
ypldap
(93.28 KB)
📄
yppoll
(7.91 KB)
📄
yppush
(23.81 KB)
📄
ypserv
(43.55 KB)
📄
ypset
(7.36 KB)
📄
zdb
(164.94 KB)
📄
zdump
(13.48 KB)
📄
zfsd
(102.01 KB)
📄
zhack
(16.02 KB)
📄
zic
(42.48 KB)
📄
zonectl
(13.94 KB)
📄
zzz
(1.23 KB)
Editing: sysrc
#!/bin/sh #- # Copyright (c) 2010-2018 Devin Teske # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $FreeBSD$ # ############################################################ INCLUDES # Prevent `-d' from being interpreted as a debug flag by common.subr DEBUG_SELF_INITIALIZE= BSDCFG_SHARE="/usr/share/bsdconfig" [ "$_COMMON_SUBR" ] || . $BSDCFG_SHARE/common.subr || exit 1 [ "$_SYSRC_SUBR" ] || f_include $BSDCFG_SHARE/sysrc.subr ############################################################ GLOBALS # # Version information # SYSRC_VERSION="7.2 Jun-16,2018" # # Options # CHECK_ONLY= DEFAULT= DELETE= DESCRIBE= EXISTING_ONLY= IGNORE_UNKNOWNS= JAIL= LIST_SERVICE_CONFS= LIST_CONFS= QUIET= ROOTDIR= SERVICE= SHOW_ALL= SHOW_EQUALS= SHOW_FILE= SHOW_NAME=1 SHOW_VALUE=1 VERBOSE= ############################################################ FUNCTIONS # die [$fmt [$opts ...]] # # Optionally print a message to stderr before exiting with failure status. # die() { local fmt="$1" [ $# -gt 0 ] && shift 1 [ "$fmt" ] && f_err "$fmt\n" "$@" exit $FAILURE } # usage # # Prints a short syntax statement and exits. # usage() { f_err "Usage: %s [OPTIONS] %s\n" "$pgm" \ "{name[[+|-]=value] ... | -a | -A | -l | -L [name ...]}" f_err "Try \`%s --help' for more information.\n" "$pgm" die } # help # # Prints a full syntax statement and exits. # help() { local optfmt="\t%-11s%s\n" local envfmt="\t%-17s%s\n" f_err "Usage: %s [OPTIONS] name[[+|-]=value] ...\n" "$pgm" f_err "Usage: %s [OPTIONS] -a | -A\n" "$pgm" f_err "Usage: %s [OPTIONS] -l | -L [name ...]\n" "$pgm" f_err "OPTIONS:\n" f_err "$optfmt" "-a" \ "Dump a list of all non-default configuration variables." f_err "$optfmt" "-A" \ "Dump a list of all configuration variables (incl. defaults)." f_err "$optfmt" "-c" \ "Check. Return success if set or no changes, else error." f_err "$optfmt" "-d" \ "Print a description of the given variable." f_err "$optfmt" "-D" \ "Show default value(s) only (this is the same as setting" f_err "$optfmt" "" \ "RC_CONFS to NULL or passing \`-f' with a NULL file-argument)." f_err "$optfmt" "-e" \ "Print query results as \`var=value' (useful for producing" f_err "$optfmt" "" \ "output to be fed back in). Ignored if \`-n' is specified." f_err "$optfmt" "-E" \ "Existing files only with \`-[lL]' or when changing a setting." f_err "$optfmt" "-f file" \ "Operate on the specified file(s) instead of rc_conf_files." f_err "$optfmt" "" \ "Can be specified multiple times for additional files." f_err "$optfmt" "-F" \ "Show only the last rc.conf(5) file each directive is in." f_err "$optfmt" "-h" \ "Print a short usage statement to stderr and exit." f_err "$optfmt" "--help" \ "Print this message to stderr and exit." f_err "$optfmt" "-i" \ "Ignore unknown variables." f_err "$optfmt" "-j jail" \ "The jid or name of the jail to operate within (overrides" f_err "$optfmt" "" \ "\`-R dir'; requires jexec(8))." f_err "$optfmt" "-l" \ "List configuration files used at startup on stdout and exit." f_err "$optfmt" "-L" \ "List all configuration files including rc.conf.d entries." f_err "$optfmt" "-n" \ "Show only variable values, not their names." f_err "$optfmt" "-N" \ "Show only variable names, not their values." f_err "$optfmt" "-q" \ "Quiet. Disable verbose and hide certain errors." f_err "$optfmt" "-s name" \ "Process additional \`rc.conf.d' entries for service name." f_err "$optfmt" "" \ "Ignored if \`-f file' is given." f_err "$optfmt" "-R dir" \ "Operate within the root directory \`dir' rather than \`/'." f_err "$optfmt" "-v" \ "Verbose. Print the pathname of the specific rc.conf(5)" f_err "$optfmt" "" \ "file where the directive was found." f_err "$optfmt" "--version" \ "Print version information to stdout and exit." f_err "$optfmt" "-x" \ "Remove variable(s) from specified file(s)." f_err "\n" f_err "ENVIRONMENT:\n" f_err "$envfmt" "RC_CONFS" \ "Override default rc_conf_files (even if set to NULL)." f_err "$envfmt" "RC_DEFAULTS" \ "Location of \`/etc/defaults/rc.conf' file." die } # jail_depend # # Dump dependencies such as language-file variables and include files to stdout # to be piped-into sh(1) running via jexec(8)/chroot(8). As a security measure, # this prevents existing language files and library files from being loaded in # the jail. This also relaxes the requirement to have these files in every jail # before sysrc can be used on said jail. # jail_depend() { # # Indicate that we are jailed # echo export _SYSRC_JAILED=1 # # Print i18n language variables (their current values are sanitized # and re-printed for interpretation so that the i18n language files # do not need to exist within the jail). # local var val for var in \ msg_cannot_create_permission_denied \ msg_permission_denied \ msg_previous_syntax_errors \ ; do val=$( eval echo \"\$$var\" | awk '{ gsub(/'\''/, "'\''\\'\'\''"); print }' ) echo $var="'$val'" done # # Print include dependencies # echo DEBUG_SELF_INITIALIZE= cat $BSDCFG_SHARE/common.subr cat $BSDCFG_SHARE/sysrc.subr } # escape $string [$var_to_set] # # Escape $string contents so that the contents can be properly encapsulated in # single-quotes (making for safe evaluation). # # NB: See `bsdconfig includes -dF escape' for relevant information/discussion. # NB: Abridged version of `f_shell_escape()' from bsdconfig(8) `strings.subr'. # escape() { local __start="$1" __var_to_set="$2" __string= while [ "$__start" ]; do case "$__start" in *\'*) __string="$__string${__start%%\'*}'\\''" __start="${__start#*\'}" continue esac break done __string="$__string$__start" if [ "$__var_to_set" ]; then setvar "$__var_to_set" "$__string" else echo "$__string" fi } ############################################################ MAIN SOURCE # # Perform sanity checks # [ $# -gt 0 ] || usage # NOTREACHED # # Check for `--help' and `--version' command-line option # for arg in "$@"; do case "$arg" in --) break ;; --help) help ;; # NOTREACHED --version) # see GLOBALS echo "$SYSRC_VERSION" exit $FAILURE ;; esac done unset arg # # Process command-line flags # while getopts aAcdDeEf:Fhij:lLnNqR:s:vxX flag; do case "$flag" in a) SHOW_ALL=${SHOW_ALL:-1} ;; A) SHOW_ALL=2 ;; c) CHECK_ONLY=1 ;; d) DESCRIBE=1 ;; D) DEFAULT=1 RC_CONFS= ;; e) SHOW_EQUALS=1 ;; E) EXISTING_ONLY=1 ;; f) DEFAULT= RC_CONFS="$RC_CONFS${RC_CONFS:+ }$OPTARG" ;; F) SHOW_FILE=1 ;; h) usage ;; # NOTREACHED i) IGNORE_UNKNOWNS=1 ;; j) [ "$OPTARG" ] || die "%s: Missing or null argument to \`-j' flag" "$pgm" JAIL="$OPTARG" ;; l) LIST_CONFS=1 ;; L) LIST_SERVICE_CONFS=1 ;; n) SHOW_NAME= ;; N) SHOW_VALUE= ;; q) QUIET=1 VERBOSE= ;; R) [ "$OPTARG" ] || die "%s: Missing or null argument to \`-R' flag" "$pgm" ROOTDIR="$OPTARG" ;; s) [ "$OPTARG" ] || die "%s: Missing or null argument to \`-s' flag" "$pgm" SERVICE="$OPTARG" ;; v) VERBOSE=1 QUIET= ;; x) DELETE=${DELETE:-1} ;; X) DELETE=2 ;; \?) usage ;; # NOTREACHED esac done shift $(( $OPTIND - 1 )) # # Process `-L' flag # if [ "$LIST_SERVICE_CONFS" ]; then list= # # List rc_conf_files if no service names given # files= [ $# -eq 0 ] && files=$( f_sysrc_get rc_conf_files ) for file in $files; do if [ "$EXISTING_ONLY" ]; then [ -e "$file" -a ! -d "$file" ] || continue fi case "$list" in "$file"|*" $file"|"$file "*|*" $file "*) continue ;; esac list="$list $file" done list="${list# }" if [ $# -eq 0 ]; then if [ "$VERBOSE" ]; then echo rc_conf_files: $list elif [ "$SHOW_EQUALS" ]; then echo "rc_conf_files=\"$list\"" fi fi # # List rc.conf.d entries # retval=$SUCCESS for service in ${*:-$( service -l )}; do slist= f_sysrc_service_configs $service files || retval=$? continue for file in $files; do if [ "$EXISTING_ONLY" ]; then [ -e "$file" -a ! -d "$file" ] || continue fi if [ ! "$VERBOSE" -a ! "$SHOW_EQUALS" ]; then case "$list" in "$file"|*" $file"|"$file "*|*" $file "*) continue ;; esac fi slist="$slist $file" done slist="${slist# }" if [ $# -gt 0 ]; then [ "$slist" ] || retval=$? fi if [ "$VERBOSE" ]; then [ "$slist" ] && echo "$service: $slist" continue elif [ "$SHOW_EQUALS" ]; then [ "$slist" ] && echo "$service=\"$slist\"" continue fi list="$list${slist:+ }$slist" done if [ ! "$VERBOSE" -a ! "$SHOW_EQUALS" ]; then if [ $# -eq 0 -o ! "$QUIET" ]; then list="${list# }" [ "$list" ] && echo $list fi fi exit $retval fi # # Validate arguments # for name in "$@"; do # NB: shell expansion syntax removed first name="${name%%:[+=-]*}" name="${name%%[%#+=-]*}" [ "$name" = "${name#*[!$VALID_VARNAME_CHARS]}" ] || die \ "%s: %s: name contains characters not allowed in shell" \ "$pgm" "$name" done # # Process `-s name' argument # if [ "$SERVICE" -a ! "${RC_CONFS+set}" ]; then if f_sysrc_service_configs "$SERVICE" RC_CONFS; then rc_conf_files=$( f_sysrc_get rc_conf_files ) RC_CONFS="$rc_conf_files${RC_CONFS:+ }$RC_CONFS" unset rc_conf_files else unset RC_CONFS fi fi # # Process `-E' option flag # if [ "$EXISTING_ONLY" ]; then # # To get f_sysrc_*() to ignore missing rc_conf_files, we have to use # RC_CONFS to override the unpreened value. If RC_CONFS already has a # value (`-D', `-f file', `-s name', or inherited from parent), use it. # Otherwise, include filtered contents of rc_conf_files. # RC_CONFS=$( if [ "${RC_CONFS+set}" ]; then set -- $RC_CONFS else set -- $( f_sysrc_get rc_conf_files ) fi while [ $# -gt 0 ]; do [ -f "$1" ] && echo -n " $1" shift done ) RC_CONFS="${RC_CONFS# }" fi # # Process `-l' option flag # if [ "$LIST_CONFS" ]; then [ $# -eq 0 ] || usage if [ "$DEFAULT" ]; then echo "$RC_DEFAULTS" elif [ "${RC_CONFS+set}" ]; then echo "$RC_CONFS" else f_sysrc_get rc_conf_files fi exit $SUCCESS fi # # [More] Sanity checks (e.g., "sysrc --") # [ $# -eq 0 -a ! "$SHOW_ALL" ] && usage # NOTREACHED # # Taint-check all rc.conf(5) files # errmsg="$pgm: Exiting due to previous syntax errors" if [ "${RC_CONFS+set}" ]; then ( for i in $RC_CONFS; do [ -e "$i" ] || continue /bin/sh -n "$i" || exit $FAILURE done exit $SUCCESS ) || die "$errmsg" else /bin/sh -n "$RC_DEFAULTS" || die "$errmsg" ( . "$RC_DEFAULTS" for i in $rc_conf_files; do [ -e "$i" ] || continue /bin/sh -n "$i" || exit $FAILURE done exit $SUCCESS ) || die "$errmsg" fi # # Process `-x' (and secret `-X') command-line options # errmsg="$pgm: \`-x' option incompatible with \`-a'/\`-A' options" errmsg="$errmsg (use \`-X' to override)" if [ "$DELETE" -a "$SHOW_ALL" ]; then [ "$DELETE" = "2" ] || die "$errmsg" fi # # Pre-flight for `-c' command-line option # [ "$CHECK_ONLY" -a "$SHOW_ALL" ] && die "$pgm: \`-c' option incompatible with \`-a'/\`-A' options" # # Process `-e', `-n', and `-N' command-line options # SEP=': ' [ "$SHOW_FILE" ] && SHOW_EQUALS= [ "$SHOW_NAME" ] || SHOW_EQUALS= [ "$VERBOSE" = "0" ] && VERBOSE= if [ ! "$SHOW_VALUE" ]; then SHOW_NAME=1 SHOW_EQUALS= fi [ "$SHOW_EQUALS" ] && SEP='="' # # Process `-j jail' and `-R dir' command-line options # if [ "$JAIL" -o "$ROOTDIR" ]; then # # Reconstruct the arguments that we want to carry-over # args=" ${VERBOSE:+-v} ${QUIET:+-q} $( [ "$DELETE" = "1" ] && echo \ -x ) $( [ "$DELETE" = "2" ] && echo \ -X ) $( [ "$SHOW_ALL" = "1" ] && echo \ -a ) $( [ "$SHOW_ALL" = "2" ] && echo \ -A ) ${CHECK_ONLY:+-c} ${DEFAULT:+-D} ${EXISTING_ONLY:+-E} ${LIST_CONFS:+-l} ${LIST_SERVICE_CONFS:+-L} ${DESCRIBE:+-d} ${SHOW_EQUALS:+-e} ${IGNORE_UNKNOWNS:+-i} $( [ "$SHOW_NAME" ] || echo \ -n ) $( [ "$SHOW_VALUE" ] || echo \ -N ) $( [ "$SHOW_FILE" ] && echo \ -F ) " if [ "$SERVICE" ]; then escape "$SERVICE" _SERVICE args="$args -s '$_SERVICE'" unset _SERVICE fi if [ "${RC_CONFS+set}" ]; then escape "$RC_CONFS" _RC_CONFS args="$args -f '$_RC_CONFS'" unset _RC_CONFS fi for arg in "$@"; do escape "$arg" arg args="$args '$arg'" done # # If both are supplied, `-j jail' supercedes `-R dir' # if [ "$JAIL" ]; then # # Re-execute ourselves with sh(1) via jexec(8) # ( echo set -- $args jail_depend cat $0 ) | env - RC_DEFAULTS="$RC_DEFAULTS" \ /usr/sbin/jexec "$JAIL" /bin/sh exit $? elif [ "$ROOTDIR" ]; then # # Make sure that the root directory specified is not to any # running jails. # # NOTE: To maintain backward compatibility with older jails on # older systems, we will not perform this check if either the # jls(1) or jexec(8) utilities are missing. # if f_have jexec && f_have jls; then jid=$( jls jid path | while read JID JROOT; do [ "$JROOT" = "$ROOTDIR" ] || continue echo $JID done ) # # If multiple running jails match the specified root # directory, exit with error. # if [ "$jid" -a "${jid%[$IFS]*}" != "$jid" ]; then die "%s: %s: %s" "$pgm" "$ROOTDIR" \ "$( echo "Multiple jails claim this" \ "directory as their root." \ "(use \`-j jail' instead)" )" fi # # If only a single running jail matches the specified # root directory, implicitly use `-j jail'. # if [ "$jid" ]; then # # Re-execute outselves with sh(1) via jexec(8) # ( echo set -- $args jail_depend cat $0 ) | env - RC_DEFAULTS="$RC_DEFAULTS" \ /usr/sbin/jexec "$jid" /bin/sh exit $? fi # Otherwise, fall through and allow chroot(8) fi # # Re-execute ourselves with sh(1) via chroot(8) # ( echo set -- $args jail_depend cat $0 ) | env - RC_DEFAULTS="$RC_DEFAULTS" \ /usr/sbin/chroot "$ROOTDIR" /bin/sh exit $? fi fi # # Process `-a' or `-A' command-line options # if [ "$SHOW_ALL" ]; then # # Get a list of variables that are currently set in the rc.conf(5) # files (including `/etc/defaults/rc.conf') by performing a call to # source_rc_confs() in a clean environment. # ( # Operate in a sub-shell to protect the parent environment # # Set which variables we want to preserve in the environment. # Append the pipe-character (|) to the list of internal field # separation (IFS) characters, allowing us to use the below # list both as an extended grep (-E) pattern and argument list # (required to first get f_clean_env() to preserve these in the # environment and then later to prune them from the list of # variables produced by set(1)). # IFS="$IFS|" EXCEPT="IFS|EXCEPT|PATH|RC_DEFAULTS|OPTIND|DESCRIBE|SEP" EXCEPT="$EXCEPT|DELETE|SHOW_ALL|SHOW_EQUALS|SHOW_NAME|DEFAULT" EXCEPT="$EXCEPT|SHOW_VALUE|SHOW_FILE|VERBOSE|RC_CONFS|SERVICE" EXCEPT="$EXCEPT|pgm|SUCCESS|FAILURE|CHECK_ONLY|EXISTING_ONLY" EXCEPT="$EXCEPT|LIST_CONFS|LIST_SERVICE_CONFS" EXCEPT="$EXCEPT|f_sysrc_desc_awk|f_sysrc_delete_awk" # # Clean the environment (except for our required variables) # and then source the required files. # f_clean_env --except $EXCEPT if [ -f "$RC_DEFAULTS" -a -r "$RC_DEFAULTS" ]; then . "$RC_DEFAULTS" # # If passed `-a' (rather than `-A'), re-purge the # environment, removing the rc.conf(5) defaults. # [ "$SHOW_ALL" = "1" ] && f_clean_env --except rc_conf_files $EXCEPT # # If `-f file' was passed, set $rc_conf_files to an # explicit value, modifying the default behavior of # source_rc_confs(). # if [ "${RC_CONFS+set}" ]; then [ "$SHOW_ALL" = "1" -a "$SERVICE" -a \ ! "$DEFAULT" ] || rc_conf_files= rc_conf_files="$rc_conf_files $RC_CONFS" rc_conf_files="${rc_conf_files# }" rc_conf_files="${rc_conf_files% }" fi source_rc_confs # # If passed `-a' (rather than `-A'), remove # `rc_conf_files' unless it was defined somewhere # other than rc.conf(5) defaults. # [ "$SHOW_ALL" = "1" -a \ "$( f_sysrc_find rc_conf_files )" = "$RC_DEFAULTS" \ ] && unset rc_conf_files fi for NAME in $( set | awk -F= '/^[[:alpha:]_][[:alnum:]_]*=/ {print $1}' | grep -Ev "^($EXCEPT)$" ); do # # If enabled, describe rather than expand value # if [ "$DESCRIBE" ]; then echo "$NAME: $( f_sysrc_desc "$NAME" )" continue fi # # If `-F' is passed, find it and move on # if [ "$SHOW_FILE" ]; then [ "$SHOW_NAME" ] && echo -n "$NAME: " f_sysrc_find "$NAME" continue fi # # If `-X' is passed, delete the variables # if [ "$DELETE" = "2" ]; then f_sysrc_delete "$NAME" continue fi [ "$VERBOSE" ] && echo -n "$( f_sysrc_find "$NAME" ): " # # If `-N' is passed, simplify the output # if [ ! "$SHOW_VALUE" ]; then echo "$NAME" continue fi echo "${SHOW_NAME:+$NAME$SEP}$( f_sysrc_get "$NAME" )${SHOW_EQUALS:+\"}" done ) # # Ignore the remainder of positional arguments. # exit $SUCCESS fi # # Process command-line arguments # status=$SUCCESS while [ $# -gt 0 ]; do NAME="${1%%=*}" case "$NAME" in *+) mode=APPEND NAME="${NAME%+}" ;; *-) mode=REMOVE NAME="${NAME%-}" ;; *) mode=ASSIGN esac [ "$DESCRIBE" ] && echo "$NAME: $( f_sysrc_desc "$NAME" )" case "$1" in *=*) # # Like sysctl(8), if both `-d' AND "name=value" is passed, # first describe (done above), then attempt to set # # If verbose, prefix line with where the directive lives if [ "$VERBOSE" -a ! "$CHECK_ONLY" ]; then file=$( f_sysrc_find "$NAME" ) [ "$file" = "$RC_DEFAULTS" -o ! "$file" ] && file=$( f_sysrc_get 'rc_conf_files%%[$IFS]*' ) if [ "$SHOW_EQUALS" ]; then echo -n ": $file; " else echo -n "$file: " fi fi # # If `-x' or `-X' is passed, delete the variable and ignore the # desire to set some value # if [ "$DELETE" ]; then f_sysrc_delete "$NAME" || status=$FAILURE shift 1 continue fi # # If `-c' is passed, simply compare and move on # if [ "$CHECK_ONLY" ]; then if ! IGNORED=$( f_sysrc_get "$NAME?" ); then status=$FAILURE [ "$VERBOSE" ] && echo "$NAME: not currently set" shift 1 continue fi value=$( f_sysrc_get "$NAME" ) if [ "$value" != "${1#*=}" ]; then status=$FAILURE if [ "$VERBOSE" ]; then echo -n "$( f_sysrc_find "$NAME" ): " echo -n "$NAME: would change from " echo "\`$value' to \`${1#*=}'" fi elif [ "$VERBOSE" ]; then echo -n "$( f_sysrc_find "$NAME" ): " echo "$NAME: already set to \`$value'" fi shift 1 continue fi # # Determine both `before' value and appropriate `new' value # case "$mode" in APPEND) before=$( f_sysrc_get "$NAME" ) add="${1#*=}" delim="${add%"${add#?}"}" # first character oldIFS="$IFS" case "$delim" in ""|[$IFS]|[a-zA-Z0-9./]) delim=" " ;; *) IFS="$delim" esac new="$before" for a in $add; do [ "$a" ] || continue skip= for b in $before; do [ "$b" = "$a" ] && skip=1 break done [ "$skip" ] || new="$new$delim$a" done new="${new#"$delim"}" IFS="$oldIFS" unset add delim oldIFS a skip b [ "$SHOW_FILE" ] && before=$( f_sysrc_find "$NAME" ) ;; REMOVE) before=$( f_sysrc_get "$NAME" ) remove="${1#*=}" delim="${remove%"${remove#?}"}" # first character oldIFS="$IFS" case "$delim" in ""|[$IFS]|[a-zA-Z0-9./]) delim=" " ;; *) IFS="$delim" esac new= for b in $before; do [ "$b" ] || continue add=1 for r in $remove; do [ "$r" = "$b" ] && add= break done [ "$add" ] && new="$new$delim$b" done new="${new#"$delim"}" IFS="$oldIFS" unset remove delim oldIFS b add r [ "$SHOW_FILE" ] && before=$( f_sysrc_find "$NAME" ) ;; *) # ASSIGN if [ "$SHOW_FILE" ]; then before=$( f_sysrc_find "$NAME" ) else before=$( f_sysrc_get "$NAME" ) fi new="${1#*=}" esac # # If `-N' is passed, simplify the output # if [ ! "$SHOW_VALUE" ]; then echo "$NAME" f_sysrc_set "$NAME" "$new" || status=$FAILURE else if f_sysrc_set "$NAME" "$new"; then if [ "$SHOW_FILE" ]; then after=$( f_sysrc_find "$NAME" ) else after=$( f_sysrc_get "$NAME" ) fi echo -n "${SHOW_NAME:+$NAME$SEP}" echo -n "$before${SHOW_EQUALS:+\" #}" echo -n " -> ${SHOW_EQUALS:+\"}$after" echo "${SHOW_EQUALS:+\"}" else status=$FAILURE fi fi ;; *) if ! IGNORED=$( f_sysrc_get "$NAME?" ); then [ "$IGNORE_UNKNOWNS" -o "$QUIET" ] || f_err "%s: unknown variable '%s'\n" \ "$pgm" "$NAME" shift 1 status=$FAILURE continue fi # The above check told us what we needed for `-c' if [ "$CHECK_ONLY" ]; then shift 1 continue fi # # Like sysctl(8), when `-d' is passed, desribe it # (already done above) rather than expanding it # if [ "$DESCRIBE" ]; then shift 1 continue fi # # If `-x' or `-X' is passed, delete the variable # if [ "$DELETE" ]; then f_sysrc_delete "$NAME" || status=$FAILURE shift 1 continue fi # # If `-F' is passed, find it and move on # if [ "$SHOW_FILE" ]; then [ "$SHOW_NAME" ] && echo -n "$NAME: " f_sysrc_find "$NAME" shift 1 continue fi if [ "$VERBOSE" ]; then if [ "$SHOW_EQUALS" ]; then echo -n ": $( f_sysrc_find "$NAME" ); " else echo -n "$( f_sysrc_find "$NAME" ): " fi fi # # If `-N' is passed, simplify the output # if [ ! "$SHOW_VALUE" ]; then echo "$NAME" else echo "${SHOW_NAME:+$NAME$SEP}$( f_sysrc_get "$NAME" )${SHOW_EQUALS:+\"}" fi esac shift 1 done exit $status # $SUCCESS unless error occurred with either `-c' or `-x' ################################################################################ # END ################################################################################
Upload File
Create Folder