diff options
author | Olav Vitters <olav@vitters.nl> | 2020-08-12 15:59:40 +0200 |
---|---|---|
committer | Olav Vitters <olav@vitters.nl> | 2020-08-12 15:59:40 +0200 |
commit | 9848c7c2e6cce9eb12cbad423df814b0cb6829c5 (patch) | |
tree | bd78a89325a5660a20f9b028d2d087d909d7bc53 | |
parent | 4445ce640902b50e4e477cce4def371578a2cb59 (diff) | |
download | initscripts-9848c7c2e6cce9eb12cbad423df814b0cb6829c5.tar initscripts-9848c7c2e6cce9eb12cbad423df814b0cb6829c5.tar.gz initscripts-9848c7c2e6cce9eb12cbad423df814b0cb6829c5.tar.bz2 initscripts-9848c7c2e6cce9eb12cbad423df814b0cb6829c5.tar.xz initscripts-9848c7c2e6cce9eb12cbad423df814b0cb6829c5.zip |
ifup-hso: shellcheck: fix most shell quoting issues
-rwxr-xr-x | mageia/network-scripts/ifup-hso | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/mageia/network-scripts/ifup-hso b/mageia/network-scripts/ifup-hso index 859e5bf9..556ae797 100755 --- a/mageia/network-scripts/ifup-hso +++ b/mageia/network-scripts/ifup-hso @@ -9,7 +9,7 @@ CONFIG=$1 [ -f "${CONFIG}" ] || CONFIG=ifcfg-${1} source_config -if [ "${2}" = "boot" -a "${ONBOOT}" = "no" ]; then +if [ "${2}" = "boot" ] && [ "${ONBOOT}" = "no" ]; then exit fi @@ -17,10 +17,10 @@ fi [ "${DEBUG}" = "yes" ] && CHATDBG="-v" CHATSCRIPT=/etc/sysconfig/network-scripts/chat-${DEVNAME} -[ -f ${CHATSCRIPT} ] || { +[ -f "${CHATSCRIPT}" ] || { CHATSCRIPT=/etc/sysconfig/network-scripts/chat-${PARENTDEVNAME} } -[ -f ${CHATSCRIPT} ] || { +[ -f "${CHATSCRIPT}" ] || { echo $"/etc/sysconfig/network-scripts/chat-${DEVNAME} does not exist" echo $"ifup-hso for ${DEVNAME} exiting" logger -p daemon.info -t ifup-hso \ @@ -28,19 +28,19 @@ CHATSCRIPT=/etc/sysconfig/network-scripts/chat-${DEVNAME} exit 1 } -CELLULAR_PIN=$(cat pin-${DEVICE} 2>/dev/null) -if [ -n "$CELLULAR_PIN" -a -x /usr/sbin/comgt ]; then - COMGTPIN=$CELLULAR_PIN comgt PIN -d $MODEMPORT +CELLULAR_PIN=$(cat "pin-${DEVICE}" 2>/dev/null) +if [ -n "$CELLULAR_PIN" ] && [ -x /usr/sbin/comgt ]; then + COMGTPIN=$CELLULAR_PIN comgt PIN -d "$MODEMPORT" fi -if ! /usr/sbin/chat ${CHATDBG} -s -f ${CHATSCRIPT} < $MODEMPORT > $MODEMPORT; then +if ! /usr/sbin/chat ${CHATDBG} -s -f "${CHATSCRIPT}" < "$MODEMPORT" > "$MODEMPORT"; then echo $"Connect script failed" exit 1 fi -CHATSCRIPT=`mktemp /tmp/chatXXXXXX` -CHATRESULT=`mktemp /tmp/chatXXXXXX` -cat > $CHATSCRIPT <<EOF +CHATSCRIPT=$(mktemp /tmp/chatXXXXXX) +CHATRESULT=$(mktemp /tmp/chatXXXXXX) +cat > "$CHATSCRIPT" <<EOF ABORT ERROR TIMEOUT 10 "" ATZ @@ -52,8 +52,8 @@ TRIES=10 BOOTARG=$2 while [ "$TRIES" -gt 0 ]; do - if /usr/sbin/chat ${CHATDBG} -s -V -f ${CHATSCRIPT} < $MODEMPORT > $MODEMPORT 2> ${CHATRESULT}; then - DATA=$(grep ^_OWANDATA $CHATRESULT) + if /usr/sbin/chat ${CHATDBG} -s -V -f "${CHATSCRIPT}" < "$MODEMPORT" > "$MODEMPORT" 2> "${CHATRESULT}"; then + DATA=$(grep ^_OWANDATA "$CHATRESULT") if [ -n "$DATA" ]; then set $(echo $DATA | cut -d ',' -f 2,4,5 --output-delimiter ' ') IPADDR=$1 @@ -63,16 +63,16 @@ while [ "$TRIES" -gt 0 ]; do fi fi sleep 2 - let TRIES=$TRIES-1 + (( TRIES-- )) done -rm -f $CHATSCRIPT $CHATRESULT +rm -f "$CHATSCRIPT" "$CHATRESULT" if [ "$TRIES" = 0 ]; then echo $"Connect script failed (HSO)" exit 1 fi -ifconfig $DEVICE $IPADDR up -route add default dev $DEVICE ${METRIC:+metric $METRIC} +ifconfig "$DEVICE" "$IPADDR" up +route add default dev "$DEVICE" "${METRIC:+metric $METRIC}" export DNS1 DNS2 exec /etc/sysconfig/network-scripts/ifup-post ${CONFIG} $BOOTARG |