From 09c5e5d415d5813f49d871dc0712212a92a695ed Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Thu, 22 Nov 2007 13:28:14 +0000 Subject: Use yesno for more robustness --- net.BSD/iwconfig.sh | 4 ++-- net.Linux/ifplugd.sh | 4 ++-- net.Linux/iwconfig.sh | 4 ++-- net.Linux/netplugd.sh | 4 ++-- net.Linux/pppd.sh | 4 ++-- net/macchanger.sh | 2 +- net/wpa_supplicant.sh | 4 ++-- sh/net.sh | 4 ++-- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/net.BSD/iwconfig.sh b/net.BSD/iwconfig.sh index 9825464..182bc47 100644 --- a/net.BSD/iwconfig.sh +++ b/net.BSD/iwconfig.sh @@ -554,7 +554,7 @@ iwconfig_configure() { iwconfig_pre_start() { # We don't configure wireless if we're being called from # the background - ${IN_BACKGROUND} && return 0 + yesno ${IN_BACKGROUND} && return 0 save_options "SSID" "" _exists || return 0 @@ -586,7 +586,7 @@ iwconfig_pre_start() { } iwconfig_post_stop() { - ${IN_BACKGROUND} && return 0 + yesno ${IN_BACKGROUND} && return 0 _is_wireless || return 0 iwconfig_defaults #iwconfig "${IFACE}" txpower 0 2>/dev/null diff --git a/net.Linux/ifplugd.sh b/net.Linux/ifplugd.sh index 23788a7..3c90f86 100644 --- a/net.Linux/ifplugd.sh +++ b/net.Linux/ifplugd.sh @@ -36,7 +36,7 @@ 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 - ${IN_BACKGROUND} && return 0 + yesno ${IN_BACKGROUND} && return 0 _exists || return 0 @@ -99,7 +99,7 @@ ifplugd_pre_start() { } ifplugd_stop() { - ${IN_BACKGROUND} && return 0 + yesno ${IN_BACKGROUND} && return 0 local pidfile="/var/run/ifplugd.${IFACE}.pid" [ ! -e "${pidfile}" ] && return 0 diff --git a/net.Linux/iwconfig.sh b/net.Linux/iwconfig.sh index 6aa4002..066f258 100644 --- a/net.Linux/iwconfig.sh +++ b/net.Linux/iwconfig.sh @@ -685,7 +685,7 @@ iwconfig_configure() { iwconfig_pre_start() { # We don't configure wireless if we're being called from # the background - ${IN_BACKGROUND} && return 0 + yesno ${IN_BACKGROUND} && return 0 save_options "SSID" "" _exists || return 0 @@ -750,7 +750,7 @@ iwconfig_pre_start() { } iwconfig_post_stop() { - ${IN_BACKGROUND} && return 0 + yesno ${IN_BACKGROUND} && return 0 _exists || return 0 iwconfig_defaults iwconfig "${IFACE}" txpower off 2>/dev/null diff --git a/net.Linux/netplugd.sh b/net.Linux/netplugd.sh index 422bbf1..160c6a6 100644 --- a/net.Linux/netplugd.sh +++ b/net.Linux/netplugd.sh @@ -39,7 +39,7 @@ netplugd_pre_start() { local pidfile="/var/run/netplugd-${IFACE}.pid" timeout= # We don't start netplug if we're being called from the background - ${IN_BACKGROUND} && return 0 + yesno ${IN_BACKGROUND} && return 0 _exists || return 0 @@ -101,7 +101,7 @@ netplugd_pre_start() { } netplugd_stop() { - ${IN_BACKGROUND} && return 0 + yesno ${IN_BACKGROUND} && return 0 local pidfile="/var/run/netplugd-${IFACE}.pid" [ ! -e "${pidfile}" ] && return 0 diff --git a/net.Linux/pppd.sh b/net.Linux/pppd.sh index 71ffb18..de63dc9 100644 --- a/net.Linux/pppd.sh +++ b/net.Linux/pppd.sh @@ -45,7 +45,7 @@ pppd_pre_start() { # Set our base metric metric=4000 - if ${IN_BACKGROUND} ; then + if yesno ${IN_BACKGROUND}; then local config= eval config=\$config_${IFVAR} # If no config for ppp then don't default to DHCP @@ -245,7 +245,7 @@ pppd_start() { } pppd_stop() { - ${IN_BACKGROUND} && return 0 + yesno ${IN_BACKGROUND} && return 0 local pidfile="/var/run/ppp-${IFACE}.pid" [ ! -s "${pidfile}" ] && return 0 diff --git a/net/macchanger.sh b/net/macchanger.sh index 4febac2..c2dc27f 100644 --- a/net/macchanger.sh +++ b/net/macchanger.sh @@ -31,7 +31,7 @@ _config_vars="$_config_vars mac" macchanger_pre_start() { # We don't change MAC addresses from background - ${IN_BACKGROUND} && return 0 + yesno ${IN_BACKGROUND} && return 0 local mac= opts= diff --git a/net/wpa_supplicant.sh b/net/wpa_supplicant.sh index 1bdbb9c..1955905 100644 --- a/net/wpa_supplicant.sh +++ b/net/wpa_supplicant.sh @@ -80,7 +80,7 @@ wpa_supplicant_pre_start() { # We don't configure wireless if we're being called from # the background unless we're not currently running - if [ "${IN_BACKGROUND}" = "true" ] ; then + if yesno ${IN_BACKGROUND}; then if service_started_daemon "${SVCNAME}" /sbin/wpa_supplicant ; then SSID=$(_get_ssid "${IFACE}") SSIDVAR=$(_shell_var "${SSID}") @@ -186,7 +186,7 @@ wpa_supplicant_post_stop() { wpac=/bin/wpa_cli fi - if [ "${IN_BACKGROUND}" = "true" ] ; then + if yesno "${IN_BACKGROUND}"; then # Only stop wpa_supplicant if it's not the controlling daemon ! service_started_daemon "${SVCNAME}" "${wpas}" 1 fi diff --git a/sh/net.sh b/sh/net.sh index 74b3ac8..42e6d01 100755 --- a/sh/net.sh +++ b/sh/net.sh @@ -28,7 +28,7 @@ MODULESDIR="${RC_LIBDIR}/net" MODULESLIST="${RC_SVCDIR}/nettree" _config_vars="config routes" -[ -z "${IN_BACKGROUND}" ] && IN_BACKGROUND=false +[ -z "${IN_BACKGROUND}" ] && IN_BACKGROUND="NO" description="Configures network interfaces." @@ -644,7 +644,7 @@ stop() { fi done - [ "${IN_BACKGROUND}" != "true" ] && \ + ! yesno ${IN_BACKGROUND} && \ [ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ] && \ _down 2>/dev/null -- cgit v1.2.3