From 37a78367b03f77b618c65085accadf2643779379 Mon Sep 17 00:00:00 2001 From: Olav Vitters Date: Tue, 28 Jul 2020 10:57:57 +0200 Subject: network-up: fix most shellcheck issues (usually quoting) --- mandriva/network-up | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/mandriva/network-up b/mandriva/network-up index d77b2137..7d5360e9 100755 --- a/mandriva/network-up +++ b/mandriva/network-up @@ -42,13 +42,13 @@ interfaces=$(/bin/ls ifcfg* | \ function may_have_link() { local DEVICE=$1 local LINKDELAY=0 - ! check_link_down ${DEVICE} || is_associating ${DEVICE} + ! check_link_down "${DEVICE}" || is_associating "${DEVICE}" } function is_associating() { local DEVICE=$1 - is_wireless_device ${DEVICE} || return 1 - local AP=`iwgetid -a -r ${DEVICE} 2>/dev/null` + is_wireless_device "${DEVICE}" || return 1 + local AP=$(iwgetid -a -r "${DEVICE}" 2>/dev/null) [ -n "$AP" ] && [ "$AP" != "00:00:00:00:00:00" ] && [ "$AP" != "44:44:44:44:44:44" ] && [ "$AP" != "FF:FF:FF:FF:FF:FF" ] } @@ -68,7 +68,7 @@ function should_wait_network() { eval $(LANG=C grep -F "DNS1=" "ifcfg-$i") eval $(LANG=C grep -F "DNS2=" "ifcfg-$i") eval $(LANG=C grep -F "NM_CONTROLLED=" "ifcfg-$i") - [ -z "$REALDEVICE" -a -n "$PARENTDEVICE" ] && REALDEVICE=$PARENTDEVICE + [ -z "$REALDEVICE" ] && [ -n "$PARENTDEVICE" ] && REALDEVICE=$PARENTDEVICE [ -z "$REALDEVICE" ] && REALDEVICE=${DEVICE%%:*} if [ $LINK_DETECTION_DELAY -lt $MIN_LINK_DETECTION_DELAY ]; then LINK_DETECTION_DELAY=$MIN_LINK_DETECTION_DELAY @@ -98,13 +98,13 @@ function should_wait_network() { fi # ignore devices that are not present - ip -o link show ${DEVICE} &>/dev/null || continue + ip -o link show "${DEVICE}" &>/dev/null || continue - ! is_false $NM_CONTROLLED && is_nm_running && _use_nm=true + ! is_false "$NM_CONTROLLED" && is_nm_running && _use_nm=true # for NM controlled just ask NetworkManager if [ "$_use_nm" = "true" ]; then # Ignore disabled wifi h/w - if is_nm_device_unavailable ${DEVICE}; then + if is_nm_device_unavailable "${DEVICE}"; then # Question: Is NM cleverer than us here? Does it do this delay # internally and mark it as disconnected until it knows better? @@ -117,7 +117,7 @@ function should_wait_network() { continue fi - is_nm_active ${DEVICE} || return 0 + is_nm_active "${DEVICE}" || return 0 # The resolvconf check below uses a single generic "NetworkManager" # DNS file, rather than device specific ones, so fudge the device. @@ -135,7 +135,7 @@ function should_wait_network() { fi # check address is set - ADDR=`ip addr show scope global ${DEVICE} | awk '/inet/ {print $2;}'` + ADDR=$(ip addr show scope global "${DEVICE}" | awk '/inet/ {print $2;}') if [ -z "$ADDR" ]; then return 0 fi @@ -144,7 +144,7 @@ function should_wait_network() { # wait for changes to be propagated by resolvconf if needed if [ -e $RESOLVCONF_FLAGFILE ]; then if [ "$BOOTPROTO" = "dhcp" ] && ! is_false "$PEERDNS" \ - || [ -n "$DNS1" -o -n "$DNS2" ]; then + || [ -n "$DNS1" ] || [ -n "$DNS2" ]; then if [ ! -e $RESOLVCONF_DIR/$DEVICE ]; then return 0 fi @@ -181,7 +181,7 @@ case "$1" in stop) ;; *) - gprintf "Usage: %s\n" "$(basename $0) {start|stop}" + gprintf "Usage: %s\n" "$(basename "$0") {start|stop}" exit 1 esac -- cgit v1.2.1