bug fix
[automated-distro-installer] / wrt-setup
index bce6a4ad98668a88fa4909cdabd4502695470e32..975a1dd1ee390349d97c0be9c6cdc08bfebaa5e4 100755 (executable)
--- a/wrt-setup
+++ b/wrt-setup
@@ -21,11 +21,13 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
 
 [[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@"
 
-x="$(readlink -f "$BASH_SOURCE")"; cd ${x%/*}
+this_file="$(readlink -f -- "${BASH_SOURCE[0]}")"
+readonly this_file this_dir="${this_file%/*}"
+cd "$this_dir"
 
 usage() {
-  cat <<EOF
-usage: ${0##*/} [-h|--help] [HOST/IP] [wrt-setup-local_ARGS]
+  cat <<'EOF'
+usage: wrt-setup [-h|--help] [HOST/IP] [wrt-setup-local_ARGS]
 setup my router in general: dhcp, dns, etc.
 
 Default HOST is 10.0.0.1 or 10.2.0.1 if they are the gateway, otherwise
@@ -45,7 +47,7 @@ ssh wrt
 opkg install /root/bash_5.0-3_mips_24kc.ipk
 EOF
   wrt-setup-local -h
-  exit $1
+  exit 0
 }