Massive whitespace cleanup

This commit is contained in:
Roy Marples 2007-11-28 15:45:03 +00:00
parent 444f23e2d1
commit ac9279cc0d
68 changed files with 613 additions and 608 deletions

View File

@ -42,7 +42,7 @@ ipfw() {
init() {
# Load the kernel module
if ! sysctl net.inet.ip.fw.enable=1 >/dev/null 2>/dev/null; then
if ! sysctl net.inet.ip.fw.enable=1 >/dev/null 2>&1; then
if ! kldload ipfw; then
eend 1 "Unable to load firewall module"
return 1

View File

@ -34,7 +34,7 @@ name="Network Time Protocol Daemon"
depend() {
use dns
need localmount
after bootmisc ntpdate ntp-client
after bootmisc ntp-client
}
start_pre() {

View File

@ -27,7 +27,7 @@
command=/usr/sbin/sshd
command_args=${sshd_args}
pidfile=/var/run/sshd.pid
required_files=/etc/sshd/sshd_config
required_files=/etc/ssh/sshd_config
required_dirs=/var/empty
depend() {

View File

@ -64,7 +64,7 @@ if [ -n "${mnt}" -a -w "${RC_LIBDIR}" ] ; then
f_opts="-m -c"
[ "${RC_UNAME}" = "Linux" ] && f_opts="-c"
if [ -n "$(fuser ${f_opts} "${svcdir}" 2>/dev/null)" ]; then
fuser -k ${f_opts} "${svcdir}" 1>/dev/null 2>/dev/null
fuser -k ${f_opts} "${svcdir}" >/dev/null 2>&1
sleep 2
fi
cp -p "${RC_SVCDIR}"/deptree "${RC_SVCDIR}"/depconfig \

View File

@ -45,7 +45,7 @@ iwconfig_get_wep_status() {
_iwconfig_get() {
LC_ALL=C ifconfig "${IFACE}" | \
sed -n -e "s/^[[:space:]]*ssid \(.*\) channel \([0-9]*\) bssid \(..:..:..:..:..:..\)\$/\\$1/p"
sed -n -e "s/^[[:space:]]*ssid \(.*\) channel \([0-9]*\).* bssid \(..:..:..:..:..:..\)\$/\\$1/p"
}
_get_ssid() {

View File

@ -28,8 +28,9 @@ apipa_depend() {
}
_random() {
if [ -n "${BASH}" ] ; then
echo "${RANDOM}"
local r=${RANDOM}
if [ -n "${r}" ]; then
echo "${r}"
else
uuidgen | sed -n -e 's/[^[:digit:]]//g' -e 's/\(^.\{1,7\}\).*/\1/p'
fi

View File

@ -35,21 +35,21 @@ ifplugd_depend() {
ifplugd_pre_start() {
local pidfile="/var/run/ifplugd.${IFACE}.pid" timeout= args=
# We don't start netplug if we're being called from the background
# We don't start ifplugd if we're being called from the background
yesno ${IN_BACKGROUND} && return 0
_exists || return 0
# We need a valid MAC address
# It's a basic test to ensure it's not a virtual interface
if ! _get_mac_address >/dev/null 2>/dev/null ; then
vewarn "netplug only works on interfaces with a valid MAC address"
if ! _get_mac_address >/dev/null 2>&1; then
vewarn "ifplugd only works on interfaces with a valid MAC address"
return 0
fi
# We don't work on bonded, bridges, tun/tap, vlan or wireless
for f in bond bridge tuntap vlan wireless; do
if type "_is_${f}" >/dev/null 2>/dev/null ; then
if type "_is_${f}" >/dev/null 2>&1; then
if _is_${f}; then
veinfo "netplug does not work with" "${f}"
return 0
@ -74,13 +74,13 @@ ifplugd_pre_start() {
eval timeout=\$plug_timeout_${IFVAR}
[ -z "${timeout}" ] && timeout=-1
if [ ${timeout} -eq 0 ]; then
ewarn "WARNING: infinite timeout set for" "${IFACE}" "to come up"
ewarn "WARNING: infinite timeout set for ${IFACE} to come up"
elif [ ${timeout} -lt 0 ]; then
einfo "Backgrounding ..."
exit 1
fi
veinfo "Waiting for" "${IFACE}" "to be marked as started"
veinfo "Waiting for ${IFACE} to be marked as started"
local i=0
while true; do
@ -89,12 +89,12 @@ ifplugd_pre_start() {
exit 0
fi
sleep 1
[ ${timeout} -eq 0 ]] && continue
[ ${timeout} -eq 0 ] && continue
i=$((${i} + 1))
[ ${i} -ge ${timeout} ] && break
done
eend 1 "Failed to configure" "${IFACE}" "in the background"
eend 1 "Failed to configure ${IFACE} in the background"
exit 1
}

View File

@ -287,7 +287,7 @@ iwconfig_associate() {
ebegin "Connecting to \"${SSID}\" in ${mode} mode ${w}"
if [ "${SSID}" != "any" ] && type preassociate >/dev/null 2>/dev/null ; then
if [ "${SSID}" != "any" ] && type preassociate >/dev/null 2>&1; then
veinfo "Running preassociate function"
veindent
( preassociate )
@ -313,7 +313,7 @@ iwconfig_associate() {
iwconfig_report
if type postassociate >/dev/null 2>/dev/null ; then
if type postassociate >/dev/null 2>&1; then
veinfo "Running postassociate function"
veindent
( postassociate )
@ -377,7 +377,7 @@ iwconfig_scan() {
case "${line}" in
*Address:*)
APS=$((${APS} + 1))
eval MAC_${APS}=\""$(echo "${line#*: }" | tr '[:lower:]' '[:upper:]')"\"
eval MAC_${APS}="\""$(echo "${line#*: }" | tr '[:lower:]' '[:upper:]')"\""
eva l QUALITY_${APS}=0
;;
*ESSID:*)
@ -388,7 +388,7 @@ iwconfig_scan() {
*Mode:*)
x="$(echo "${line#*:}" | tr '[:upper:]' '[:lower:]')"
if [ "${x}" = "master" ]; then
eval MODE_${APS}=\"managed\"
eval MODE_${APS}=managed
else
eval MODE_${APS}=\$x
fi

View File

@ -45,14 +45,14 @@ netplugd_pre_start() {
# We need a valid MAC address
# It's a basic test to ensure it's not a virtual interface
if ! _get_mac_address >/dev/null 2>/dev/null ; then
if ! _get_mac_address >/dev/null 2>&1; then
vewarn "netplug only works on interfaces with a valid MAC address"
return 0
fi
# We don't work on bonded, bridges, tun/tap, vlan or wireless
for f in bond bridge tuntap vlan wireless; do
if type "_is_${f}" >/dev/null 2>/dev/null ; then
if type "_is_${f}" >/dev/null 2>&1; then
if _is_${f}; then
veinfo "netplug does not work with" "${f}"
return 0
@ -76,13 +76,13 @@ netplugd_pre_start() {
eval timeout=\$plug_timeout_${IFVAR}
[ -z "${timeout}" ] && timeout=-1
if [ ${timeout} -eq 0 ]; then
ewarn "WARNING: infinite timeout set for" "${IFACE}" "to come up"
ewarn "WARNING: infinite timeout set for ${IFACE} to come up"
elif [ ${timeout} -lt 0 ]; then
einfo "Backgrounding ..."
exit 1
fi
veinfo "Waiting for" "${IFACE}" "to be marked as started"
veinfo "Waiting for ${IFACE} to be marked as started"
local i=0
while true; do
@ -91,12 +91,12 @@ netplugd_pre_start() {
exit 0
fi
sleep 1
[ ${timeout} -eq 0 ]] && continue
[ ${timeout} -eq 0 ] && continue
i=$((${i} + 1))
[ ${i} -ge ${timeout} ] && break
done
eend 1 "Failed to configure" "${IFACE}" "in the background"
eend 1 "Failed to configure ${IFACE} in the background"
exit 1
}

View File

@ -67,7 +67,7 @@ pump_stop() {
start-stop-daemon --quiet --test --stop --exec /sbin/pump || return 0
# Check that pump is running on the interface
if ! pump --status --interface "${IFACE}" >/dev/null 2>/dev/null ; then
if ! pump --status --interface "${IFACE}" >/dev/null 2>&1; then
return 0
fi

View File

@ -39,7 +39,7 @@ wpa_supplicant_depend() {
# Only set these functions if not set already
# IE, prefer to use iwconfig
if ! type _get_ssid >/dev/null 2>/dev/null ; then
if ! type _get_ssid >/dev/null 2>&1; then
_get_ssid() {
local timeout=5 ssid=
@ -91,7 +91,7 @@ wpa_supplicant_pre_start() {
fi
save_options "SSID" ""
ebegin "Starting wpa_supplicant on" "${IFVAR}"
ebegin "Starting wpa_supplicant on ${IFVAR}"
if [ -x /sbin/iwconfig ]; then
local x=

View File

@ -242,7 +242,7 @@ for x in "devpts /dev/pts 0755 ,gid=5,mode=0620" "tmpfs /dev/shm 1777 ,nodev"; d
if [ ! -d "$2" ] && \
[ "${m}" = "devfs" -o "${m}" = "udev" ]; then
mkdir -m "$3" -p "$2" >/dev/null 2>/dev/null || \
mkdir -m "$3" -p "$2" >/dev/null 2>&1 || \
ewarn "Could not create $2!"
fi

View File

@ -138,13 +138,15 @@ KV_to_int() {
}
_sanitize_path() {
local IFS=":" p=
local IFS=":" p= path=
for p in ${PATH}; do
case "${p}" in
/lib/rc/sbin|/bin|/sbin|/usr/bin|/usr/sbin|/usr/local/bin|/usr/local/sbin);;
*) printf "%s" ":${p}";;
*) path="${path}:${p}";;
esac
done
echo "${path}"
}
# Allow our scripts to support zsh

View File

@ -36,16 +36,18 @@ description="Configures network interfaces."
__IFS="
"
_shell_var() {
local rem=$1 c= r=
local rem=$1 c= r= var=
while [ -n "${rem}" ]; do
r=${rem#?}
c=${rem%${r}}
case "${c}" in
[a-zA-Z0-9]) printf "%c" "${c}";;
*) printf "_";;
[a-zA-Z0-9]);;
*) c=_;;
esac
var=${var}${c}
rem=${r}
done
echo ${var}
}
depend() {
@ -351,7 +353,7 @@ _load_modules() {
# Wrap our provides
local f=
for f in pre_start start post_start; do
eval "${provides}_${f}() { type ${mod}_${f} >/dev/null 2>/dev/null || return 0; ${mod}_${f} \"\$@\"; }"
eval "${provides}_${f}() { type ${mod}_${f} >/dev/null 2>&1 || return 0; ${mod}_${f} \"\$@\"; }"
done
eval module_${mod}_provides="${provides}"
@ -365,7 +367,7 @@ _load_modules() {
eval x=\$module_${mod}_provides
[ -z "${x}" ] && continue
for f in pre_start start post_start; do
eval "${x}_${f}() { type ${mod}_${f} >/dev/null 2>/dev/null || return 0; ${mod}_${f} \"\$@\"; }"
eval "${x}_${f}() { type ${mod}_${f} >/dev/null 2>&1 || return 0; ${mod}_${f} \"\$@\"; }"
done
eval module_${x}_providedby="${mod}"
;;
@ -446,7 +448,7 @@ start() {
# We up the iface twice if we have a preup to ensure it's up if
# available in preup and afterwards incase the user inadvertently
# brings it down
if type preup >/dev/null 2>/dev/null ; then
if type preup >/dev/null 2>&1; then
_up 2>/dev/null
ebegin "Running preup"
eindent
@ -457,7 +459,7 @@ start() {
_up 2>/dev/null
for module in ${MODULES}; do
if type "${module}_pre_start" >/dev/null 2>/dev/null ; then
if type "${module}_pre_start" >/dev/null 2>&1; then
if ! ${module}_pre_start; then
eend 1
exit 1
@ -508,7 +510,7 @@ start() {
null) :;;
[0-9]*|*:*) _add_address ${config};;
*)
if type "${config}_start" >/dev/null 2>/dev/null ; then
if type "${config}_start" >/dev/null 2>&1; then
"${config}"_start
else
eerror "nothing provides \`${config}'"
@ -533,7 +535,7 @@ start() {
done
if ! ${oneworked}; then
if type failup >/dev/null 2>/dev/null ; then
if type failup >/dev/null 2>&1; then
ebegin "Running failup"
eindent
failup
@ -569,7 +571,7 @@ ${routes}"
*) cmd="-host ${cmd}";;
esac
if ${hidefirstroute}; then
_add_route ${cmd} >/dev/null 2>/dev/null
_add_route ${cmd} >/dev/null 2>&1
hidefirstroute=false
else
_add_route ${cmd} >/dev/null
@ -580,7 +582,7 @@ ${routes}"
unset IFS
for module in ${MODULES}; do
if type "${module}_post_start" >/dev/null 2>/dev/null ; then
if type "${module}_post_start" >/dev/null 2>&1; then
if ! ${module}_post_start; then
eend 1
exit 1
@ -588,7 +590,7 @@ ${routes}"
fi
done
if type postup >/dev/null 2>/dev/null ; then
if type postup >/dev/null 2>&1; then
ebegin "Running postup"
eindent
postup
@ -610,7 +612,7 @@ stop() {
_load_modules false
fi
if type predown >/dev/null 2>/dev/null ; then
if type predown >/dev/null 2>&1; then
ebegin "Running predown"
eindent
predown || return 1
@ -623,7 +625,7 @@ stop() {
fi
for module in ${MODULES}; do
if type "${module}_pre_stop" >/dev/null 2>/dev/null ; then
if type "${module}_pre_stop" >/dev/null 2>&1; then
if ! ${module}_pre_stop; then
eend 1
exit 1
@ -632,18 +634,18 @@ stop() {
done
for module in ${MODULES}; do
if type "${module}_stop" >/dev/null 2>/dev/null ; then
if type "${module}_stop" >/dev/null 2>&1; then
${module}_stop
fi
done
# Only delete addresses for non PPP interfaces
if ! type is_ppp >/dev/null 2>/dev/null || ! is_ppp ; then
if ! type is_ppp >/dev/null 2>&1 || ! is_ppp; then
_delete_addresses "${IFACE}"
fi
for module in ${MODULES}; do
if type "${module}_post_stop" >/dev/null 2>/dev/null ; then
if type "${module}_post_stop" >/dev/null 2>&1; then
${module}_post_stop
fi
done
@ -654,7 +656,7 @@ stop() {
type resolvconf >/dev/null 2>&1 && resolvconf -d "${IFACE}"
if type postdown >/dev/null 2>/dev/null ; then
if type postdown >/dev/null 2>&1; then
ebegin "Running postdown"
eindent
postdown

View File

@ -63,7 +63,7 @@ is_net_fs() {
is_union_fs() {
[ ! -x /sbin/unionctl ] && return 1
unionctl "$1" --list >/dev/null 2>/dev/null
unionctl "$1" --list >/dev/null 2>&1
}
get_bootparam() {

View File

@ -67,7 +67,7 @@ do_unmount() {
local sig="KILL"
[ ${retry} -gt 0 ] && sig="TERM"
fuser ${f_kill}${sig} -k ${f_opts} "${mnt}" \
>/dev/null 2>/dev/null
>/dev/null 2>&1
sleep 1
retry=$((${retry} - 1))
;;