summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2006-12-30 22:53:20 +0000
committeryar <yar@FreeBSD.org>2006-12-30 22:53:20 +0000
commitc91e4c56f635b3ce863d881f8a49d213248826f9 (patch)
tree48f5b2fe4337977e994033a03ecdb0d82ffe59a6 /etc
parent04d777c063bfd2bb16af385cd179669da6a2404e (diff)
downloadFreeBSD-src-c91e4c56f635b3ce863d881f8a49d213248826f9.zip
FreeBSD-src-c91e4c56f635b3ce863d881f8a49d213248826f9.tar.gz
Eliminate global symbols starting with an underscore from rc.d
scripts, except for mdconfig* and jail. Such symbols are reserved for the rc.subr internals. Most scripts can be fixed by just declaring _foo symbols as local: few scripts actually need them to be global. Discussed with: dougb in freebsd-rc
Diffstat (limited to 'etc')
-rw-r--r--etc/rc.d/abi2
-rwxr-xr-xetc/rc.d/accounting2
-rw-r--r--etc/rc.d/archdep2
-rw-r--r--etc/rc.d/bluetooth4
-rwxr-xr-xetc/rc.d/bootconf.sh6
-rw-r--r--etc/rc.d/bridge16
-rwxr-xr-xetc/rc.d/ldconfig2
-rwxr-xr-xetc/rc.d/lpd4
-rw-r--r--etc/rc.d/moused18
-rw-r--r--etc/rc.d/netif19
-rw-r--r--etc/rc.d/nsswitch2
-rw-r--r--etc/rc.d/pppoed2
-rwxr-xr-xetc/rc.d/syslogd16
-rw-r--r--etc/rc.d/var8
-rwxr-xr-xetc/rc.d/ypbind2
-rwxr-xr-xetc/rc.d/yppasswdd2
-rwxr-xr-xetc/rc.d/ypserv2
-rw-r--r--etc/rc.d/ypset2
-rw-r--r--etc/rc.d/ypupdated2
-rw-r--r--etc/rc.d/ypxfrd2
20 files changed, 74 insertions, 41 deletions
diff --git a/etc/rc.d/abi b/etc/rc.d/abi
index 0c6b708..d2d3c31 100644
--- a/etc/rc.d/abi
+++ b/etc/rc.d/abi
@@ -23,6 +23,8 @@ sysv_start()
linux_start()
{
+ local _tmpdir
+
echo -n ' linux'
load_kld -e 'linux(aout|elf)' linux
if [ -x /compat/linux/sbin/ldconfigDisabled ]; then
diff --git a/etc/rc.d/accounting b/etc/rc.d/accounting
index 777555d..f2208e0 100755
--- a/etc/rc.d/accounting
+++ b/etc/rc.d/accounting
@@ -20,6 +20,8 @@ stop_cmd="accounting_stop"
accounting_start()
{
+ local _dir
+
_dir=`dirname "$accounting_file"`
if [ ! -d `dirname "$_dir"` ]; then
if ! mkdir -p "$_dir"; then
diff --git a/etc/rc.d/archdep b/etc/rc.d/archdep
index a53cf8d..220d94f 100644
--- a/etc/rc.d/archdep
+++ b/etc/rc.d/archdep
@@ -34,6 +34,8 @@ ibcs2_compat()
archdep_start()
{
+ local _arch
+
_arch=`${SYSCTL_N} hw.machine_arch`
echo -n "Initial $_arch initialization:"
case $_arch in
diff --git a/etc/rc.d/bluetooth b/etc/rc.d/bluetooth
index 54806f3..c48af64 100644
--- a/etc/rc.d/bluetooth
+++ b/etc/rc.d/bluetooth
@@ -43,6 +43,8 @@ stop_cmd="bluetooth_stop"
bluetooth_read_conf()
{
+ local _err _file _line _namespace
+
_file=$1
_namespace=$2
_err=0
@@ -225,6 +227,8 @@ bluetooth_shutdown_stack()
bluetooth_start()
{
+ local _file
+
dev=$1
# Automatically load modules
diff --git a/etc/rc.d/bootconf.sh b/etc/rc.d/bootconf.sh
index 24803bc..662dfae 100755
--- a/etc/rc.d/bootconf.sh
+++ b/etc/rc.d/bootconf.sh
@@ -45,8 +45,8 @@ bootconf_start()
done
echo
master=$$
- _DUMMY=/etc/passwd
- conf=${_DUMMY}
+ DUMMY=/etc/passwd
+ conf=${DUMMY}
while [ ! -d /etc/etc.$conf/. ]; do
trap "conf=$default; echo; echo Using default of $conf" ALRM
echo -n "Which configuration [$default] ? "
@@ -57,7 +57,7 @@ bootconf_start()
conf=$default
fi
if [ ! -d /etc/etc.$conf/. ]; then
- conf=${_DUMMY}
+ conf=${DUMMY}
fi
done
diff --git a/etc/rc.d/bridge b/etc/rc.d/bridge
index e2908db..5c8f61a 100644
--- a/etc/rc.d/bridge
+++ b/etc/rc.d/bridge
@@ -35,7 +35,7 @@
name="bridge"
start_cmd="bridge_start"
stop_cmd="bridge_stop"
-_cmd=""
+cmd=""
glob_int () {
case "$1" in
@@ -52,7 +52,7 @@ bridge_test () {
if [ -n "${interfaces}" ]; then
for i in ${interfaces}; do
if glob_int $iface $i ; then
- ifconfig $bridge $_cmd $iface > /dev/null 2>&1
+ ifconfig $bridge $cmd $iface > /dev/null 2>&1
return
fi
done
@@ -62,13 +62,13 @@ bridge_test () {
autobridge()
{
if [ -n "${autobridge_interfaces}" ]; then
- if [ -z "$_iflist" ]; then
+ if [ -z "$iflist" ]; then
# We're operating as a general network start routine.
- _iflist="`list_net_interfaces`"
+ iflist="`list_net_interfaces`"
fi
for br in ${autobridge_interfaces}; do
- for i in $_iflist; do
+ for i in $iflist; do
bridge_test $br $i
done
done
@@ -77,17 +77,17 @@ autobridge()
bridge_start()
{
- _cmd="addm"
+ cmd="addm"
autobridge
}
bridge_stop()
{
- _cmd="deletem"
+ cmd="deletem"
autobridge
}
-_iflist=$2
+iflist=$2
load_rc_config $name
run_rc_command "$1"
diff --git a/etc/rc.d/ldconfig b/etc/rc.d/ldconfig
index b59a2d9..481a2a5 100755
--- a/etc/rc.d/ldconfig
+++ b/etc/rc.d/ldconfig
@@ -17,7 +17,7 @@ stop_cmd=":"
ldconfig_start()
{
- local _files
+ local _files _ins
_ins=
ldconfig=${ldconfig_command}
diff --git a/etc/rc.d/lpd b/etc/rc.d/lpd
index dc2c3f3..ff64262 100755
--- a/etc/rc.d/lpd
+++ b/etc/rc.d/lpd
@@ -14,9 +14,9 @@ name="lpd"
rcvar=`set_rcvar`
command="/usr/sbin/${name}"
required_files="/etc/printcap"
-start_precmd="_chkprintcap"
+start_precmd="chkprintcap"
-_chkprintcap()
+chkprintcap()
{
if checkyesno chkprintcap_enable ; then
/usr/sbin/chkprintcap ${chkprintcap_flags}
diff --git a/etc/rc.d/moused b/etc/rc.d/moused
index 6ef67bf..7f167cb 100644
--- a/etc/rc.d/moused
+++ b/etc/rc.d/moused
@@ -14,9 +14,9 @@ name=moused
rcvar=`set_rcvar`
command="/usr/sbin/${name}"
start_cmd="moused_start"
-_pidprefix="/var/run/moused"
-pidfile="${_pidprefix}.pid"
-_pidarg=
+pidprefix="/var/run/moused"
+pidfile="${pidprefix}.pid"
+pidarg=
load_rc_config $name
# Set the pid file and variable name. The second argument, if it exists, is
@@ -25,8 +25,8 @@ load_rc_config $name
if [ -n "$2" ]; then
eval moused_$2_enable=\${moused_$2_enable-${moused_nondefault_enable}}
rcvar=`set_rcvar moused_$2`
- pidfile="${_pidprefix}.$2.pid"
- _pidarg="-I $pidfile"
+ pidfile="${pidprefix}.$2.pid"
+ pidarg="-I $pidfile"
fi
moused_start()
@@ -53,20 +53,20 @@ moused_start()
fi
echo -n "Starting ${ms} moused:"
- /usr/sbin/moused ${myflags} -p ${myport} -t ${mytype} ${_pidarg}
+ /usr/sbin/moused ${myflags} -p ${myport} -t ${mytype} ${pidarg}
- _mousechar_arg=
+ mousechar_arg=
case ${mousechar_start} in
[Nn][Oo] | '')
;;
*)
echo -n ' mousechar_start'
- _mousechar_arg="-M ${mousechar_start}"
+ mousechar_arg="-M ${mousechar_start}"
;;
esac
for ttyv in /dev/ttyv* ; do
- vidcontrol < ${ttyv} ${_mousechar_arg} -m on
+ vidcontrol < ${ttyv} ${mousechar_arg} -m on
done
echo '.'
}
diff --git a/etc/rc.d/netif b/etc/rc.d/netif
index 36b4596..61ef8e3 100644
--- a/etc/rc.d/netif
+++ b/etc/rc.d/netif
@@ -38,15 +38,15 @@ stop_cmd="network_stop"
cloneup_cmd="clone_up"
clonedown_cmd="clone_down"
extra_commands="cloneup clonedown"
-_cmdifn=
+cmdifn=
network_start()
{
# Set the list of interfaces to work on.
#
- _cmdifn=$*
+ cmdifn=$*
- if [ -z "$_cmdifn" ]; then
+ if [ -z "$cmdifn" ]; then
#
# We're operating as a general network start routine.
#
@@ -71,8 +71,8 @@ network_start()
# Resync ipfilter
/etc/rc.d/ipfilter resync
fi
- if [ -f /etc/rc.d/bridge -a -n "$_cmdifn" ] ; then
- /etc/rc.d/bridge start $_cmdifn
+ if [ -f /etc/rc.d/bridge -a -n "$cmdifn" ] ; then
+ /etc/rc.d/bridge start $cmdifn
fi
}
@@ -80,7 +80,7 @@ network_stop()
{
# Set the list of interfaces to work on.
#
- _cmdifn=$*
+ cmdifn=$*
echo -n "Stopping network:"
@@ -98,6 +98,8 @@ network_stop()
# configured interface(s).
network_common()
{
+ local _cooked_list _fail _func _verbose
+
_func=
_verbose=
@@ -111,15 +113,16 @@ network_common()
# Set the scope of the command (all interfaces or just one).
#
_cooked_list=
- if [ -n "$_cmdifn" ]; then
+ if [ -n "$cmdifn" ]; then
# Don't check that the interfaces exist. We need to run
# the down code even when the interface doesn't exist to
# kill off wpa_supplicant.
- _cooked_list="$_cmdifn"
+ _cooked_list="$cmdifn"
else
_cooked_list="`list_net_interfaces`"
fi
+ _fail=
for ifn in ${_cooked_list}; do
if ${_func} ${ifn} ; then
eval showstat_$ifn=1
diff --git a/etc/rc.d/nsswitch b/etc/rc.d/nsswitch
index a99459a..1540583 100644
--- a/etc/rc.d/nsswitch
+++ b/etc/rc.d/nsswitch
@@ -38,6 +38,8 @@ stop_cmd=":"
generate_host_conf()
{
+ local _cont _sources
+
nsswitch_conf=$1; shift;
host_conf=$1; shift;
diff --git a/etc/rc.d/pppoed b/etc/rc.d/pppoed
index b9cfb14..c939112 100644
--- a/etc/rc.d/pppoed
+++ b/etc/rc.d/pppoed
@@ -18,6 +18,8 @@ stop_cmd=":"
pppoed_start()
{
+ local _opts
+
if [ -n "${pppoed_provider}" ]; then
pppoed_flags="${pppoed_flags} -p ${pppoed_provider}"
fi
diff --git a/etc/rc.d/syslogd b/etc/rc.d/syslogd
index 45e50f8..272d6b0 100755
--- a/etc/rc.d/syslogd
+++ b/etc/rc.d/syslogd
@@ -18,12 +18,14 @@ required_files="/etc/syslog.conf"
start_precmd="syslogd_precmd"
extra_commands="reload"
-_sockfile="/var/run/syslogd.sockets"
+sockfile="/var/run/syslogd.sockets"
evalargs="rc_flags=\"\`set_socketlist\` \$rc_flags\""
altlog_proglist="named"
syslogd_precmd()
{
+ local _l _ldir
+
# Transitional symlink for old binaries
#
if [ ! -L /dev/log ]; then
@@ -33,7 +35,7 @@ syslogd_precmd()
# Create default list of syslog sockets to watch
#
- ( umask 022 ; > $_sockfile )
+ ( umask 022 ; > $sockfile )
# If running named(8) or ntpd(8) chrooted, added appropriate
# syslog socket to list of sockets to watch.
@@ -41,7 +43,7 @@ syslogd_precmd()
for _l in $altlog_proglist; do
eval _ldir=\$${_l}_chrootdir
if checkyesno `set_rcvar $_l` && [ -n "$_ldir" ]; then
- echo "${_ldir}/var/run/log" >> $_sockfile
+ echo "${_ldir}/var/run/log" >> $sockfile
fi
done
@@ -49,8 +51,8 @@ syslogd_precmd()
# internal copy of $syslogd_flags to force use of specific
# syslogd sockets.
#
- if [ -s $_sockfile ]; then
- echo "/var/run/log" >> $_sockfile
+ if [ -s $sockfile ]; then
+ echo "/var/run/log" >> $sockfile
eval $evalargs
fi
@@ -59,8 +61,10 @@ syslogd_precmd()
set_socketlist()
{
+ local _s _socketargs
+
_socketargs=
- for _s in `cat $_sockfile | tr '\n' ' '` ; do
+ for _s in `cat $sockfile | tr '\n' ' '` ; do
_socketargs="-l $_s $_socketargs"
done
echo $_socketargs
diff --git a/etc/rc.d/var b/etc/rc.d/var
index be434fc..e11b3c7 100644
--- a/etc/rc.d/var
+++ b/etc/rc.d/var
@@ -36,7 +36,7 @@ name="var"
load_rc_config $name
-_populate_var()
+populate_var()
{
/usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var > /dev/null
case ${sendmail_enable} in
@@ -73,7 +73,7 @@ esac
# in realistic diskless setups, we're probably ok.
case "${populate_var}" in
[Yy][Ee][Ss])
- _populate_var
+ populate_var
;;
[Nn][Oo])
exit 0
@@ -82,7 +82,7 @@ case "${populate_var}" in
if [ -d /var/run -a -d /var/db -a -d /var/empty ] ; then
true
elif [ -x /usr/sbin/mtree ] ; then
- _populate_var
+ populate_var
else
# We need mtree to populate /var so try mounting /usr.
# If this does not work, we can not boot so it is OK to
@@ -91,7 +91,7 @@ case "${populate_var}" in
if [ ! -x /usr/sbin/mtree ] ; then
exit 1
else
- _populate_var
+ populate_var
fi
fi
;;
diff --git a/etc/rc.d/ypbind b/etc/rc.d/ypbind
index 0ed5cd5..6067d10 100755
--- a/etc/rc.d/ypbind
+++ b/etc/rc.d/ypbind
@@ -20,6 +20,8 @@ command_args="${nis_client_flags}"
ypbind_precmd()
{
+ local _domain
+
if ! checkyesno rpcbind_enable && \
! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
diff --git a/etc/rc.d/yppasswdd b/etc/rc.d/yppasswdd
index 4e805f5..092a000 100755
--- a/etc/rc.d/yppasswdd
+++ b/etc/rc.d/yppasswdd
@@ -20,6 +20,8 @@ command_args="${nis_yppasswdd_flags}"
yppasswdd_precmd()
{
+ local _domain
+
if ! checkyesno rpcbind_enable && \
! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
diff --git a/etc/rc.d/ypserv b/etc/rc.d/ypserv
index 54ddd5b..11651d6 100755
--- a/etc/rc.d/ypserv
+++ b/etc/rc.d/ypserv
@@ -19,6 +19,8 @@ command_args="${nis_server_flags}"
ypserv_prestart()
{
+ local _domain
+
if ! checkyesno rpcbind_enable && \
! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
diff --git a/etc/rc.d/ypset b/etc/rc.d/ypset
index bf091c1..bc2c154 100644
--- a/etc/rc.d/ypset
+++ b/etc/rc.d/ypset
@@ -17,6 +17,8 @@ command_args="${nis_ypset_flags}"
ypset_precmd()
{
+ local _domain
+
if ! checkyesno rpcbind_enable && \
! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
diff --git a/etc/rc.d/ypupdated b/etc/rc.d/ypupdated
index 106db0f..e1d6fd7 100644
--- a/etc/rc.d/ypupdated
+++ b/etc/rc.d/ypupdated
@@ -15,6 +15,8 @@ start_precmd="rpc_ypupdated_precmd"
rpc_ypupdated_precmd()
{
+ local _domain
+
if ! checkyesno rpcbind_enable && \
! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
diff --git a/etc/rc.d/ypxfrd b/etc/rc.d/ypxfrd
index 00cf607..dd9488a 100644
--- a/etc/rc.d/ypxfrd
+++ b/etc/rc.d/ypxfrd
@@ -17,6 +17,8 @@ command_args="${nis_ypxfrd_flags}"
ypxfrd_precmd()
{
+ local _domain
+
if ! checkyesno rpcbind_enable && \
! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
OpenPOWER on IntegriCloud