diff options
Diffstat (limited to 'rc.d')
-rwxr-xr-x | rc.d/net-auto-wired | 15 | ||||
-rwxr-xr-x | rc.d/net-auto-wireless | 8 | ||||
-rwxr-xr-x | rc.d/net-profiles | 4 |
3 files changed, 12 insertions, 15 deletions
diff --git a/rc.d/net-auto-wired b/rc.d/net-auto-wired index 21f487d..859e57d 100755 --- a/rc.d/net-auto-wired +++ b/rc.d/net-auto-wired @@ -8,9 +8,9 @@ if [[ ! -x /usr/sbin/ifplugd ]]; then echo "Please install 'ifplugd' to use net-auto-wired" exit 1 -fi +fi -if [ -z "${WIRED_INTERFACE}" ]; then +if [[ -z "${WIRED_INTERFACE}" ]]; then echo "No interface name set. Add to /etc/conf.d/netcfg a line" echo " WIRED_INTERFACE=\"your_interface\"" exit 1 @@ -19,7 +19,7 @@ fi CFG=/etc/ifplugd/ifplugd.conf ACTION=/etc/ifplugd/netcfg.action PIDFILE=/var/run/ifplugd.$WIRED_INTERFACE.pid -[[ -f $PIDFILE ]] && PID=$(cat $PIDFILE) +[[ -f $PIDFILE ]] && read PID < $PIDFILE # Source ifplugd configuration [ -f $CFG ] && . $CFG @@ -31,8 +31,8 @@ case "$1" in fi stat_busy "Starting netcfg auto-wired mode for interface ${WIRED_INTERFACE}" A="`eval echo \$\{ARGS_${WIRED_INTERFACE}\}`" - [ -z "$A" ] && A="$ARGS" - [ -z "$PID" ] && /usr/sbin/ifplugd -i $WIRED_INTERFACE -r $ACTION $A + [[ "$A" ]] || A="$ARGS" + [[ "$PID" ]] || /usr/sbin/ifplugd -i $WIRED_INTERFACE -r $ACTION $A # ifplugd may return non-zero, but still succeed if -w is passed, as default in upstream config. sleep 1 if [[ -f $PIDFILE ]]; then @@ -45,8 +45,7 @@ case "$1" in stop) if ! ck_daemon net-auto-wired; then stat_busy "Stopping netcfg auto-wired mode for interface ${WIRED_INTERFACE}" - [ -n "$PID" ] && /usr/sbin/ifplugd -k -i $WIRED_INTERFACE -r $ACTION - if [ $? -eq 0 ]; then + if [[ "$PID" ]] && /usr/sbin/ifplugd -k -i $WIRED_INTERFACE -r $ACTION; then rm_daemon net-auto-wired stat_done else @@ -60,6 +59,6 @@ case "$1" in "$0" start ;; *) - echo "Usage: $0 {start|stop|restart}" + echo "Usage: $0 {start|stop|restart}" esac exit 0 diff --git a/rc.d/net-auto-wireless b/rc.d/net-auto-wireless index a03097b..79c43b0 100755 --- a/rc.d/net-auto-wireless +++ b/rc.d/net-auto-wireless @@ -10,7 +10,7 @@ if [[ ! -x /usr/sbin/wpa_actiond ]]; then exit 1 fi -if [ -z "${WIRELESS_INTERFACE}" ]; then +if [[ -z "${WIRELESS_INTERFACE}" ]]; then echo "No interface name set. Add to /etc/conf.d/netcfg a line" echo " WIRELESS_INTERFACE=\"your_interface\"" exit 1 @@ -31,8 +31,7 @@ case "$1" in done stat_busy "Starting netcfg auto-wireless mode for interface ${WIRELESS_INTERFACE}" - /usr/bin/netcfg-wpa_actiond "${WIRELESS_INTERFACE}" >/dev/null - if [ $? -eq 0 ]; then + if /usr/bin/netcfg-wpa_actiond "${WIRELESS_INTERFACE}" >/dev/null; then add_daemon net-auto-wireless stat_done else @@ -42,8 +41,7 @@ case "$1" in stop) if ! ck_daemon net-auto-wireless; then stat_busy "Stopping netcfg auto-wireless mode for interface ${WIRELESS_INTERFACE}" - /usr/bin/netcfg-wpa_actiond stop "${WIRELESS_INTERFACE}" >/dev/null - if [ $? -eq 0 ]; then + if /usr/bin/netcfg-wpa_actiond stop "${WIRELESS_INTERFACE}" >/dev/null; then rm_daemon net-auto-wireless stat_done else diff --git a/rc.d/net-profiles b/rc.d/net-profiles index f7770ee..e8b8bc7 100755 --- a/rc.d/net-profiles +++ b/rc.d/net-profiles @@ -70,9 +70,9 @@ case "$1" in # shutdown any profiles started by netcfg (or from NET_PROFILES in rc.conf) # JP: only attempt to disconnect the profiles _this daemon_ was told to control - for profile in $(cat "$STATE_DIR/net-profiles"); do + while read profile; do /usr/bin/netcfg2 down "$profile" - done + done < "$STATE_DIR/net-profiles" rm -f "$STATE_DIR/net-profiles" rm_daemon net-profiles ;; |