aboutsummaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-20 12:02:47 -0500
committerCraig Jennings <c@cjennings.net>2026-05-20 12:02:47 -0500
commit618e6cce0b1662f50c6e766bba7e11b6d6952532 (patch)
tree20f90c1b162138dad1ef53de69765cbc931dd8df /init
parent2172c904e34e044ba938d5a4948182d9fd878816 (diff)
downloadarchsetup-618e6cce0b1662f50c6e766bba7e11b6d6952532.tar.gz
archsetup-618e6cce0b1662f50c6e766bba7e11b6d6952532.zip
fix: correct a POSIX-sh bashism in init and document two SC2034 cases
init runs under #!/bin/sh but used $(<file) to read /etc/hostname, a bashism that breaks on a strict POSIX sh. I switched it to $(cat) and quoted $interface_up in the same script. The two VM_IP assignments in the test scripts are read by the sourced validation.sh, which shellcheck can't follow, so they now carry a documented disable=SC2034 instead of a bare suppression. The rest of the shellcheck findings across the scripts are intentional (word-splitting on $SSH_OPTS, integer tests in [ ]) or already accepted, so I left them alone.
Diffstat (limited to 'init')
-rwxr-xr-xinit4
1 files changed, 2 insertions, 2 deletions
diff --git a/init b/init
index a9ac5f3..a20bf7c 100755
--- a/init
+++ b/init
@@ -8,11 +8,11 @@ pacman -S --noconfirm tmux git
echo "root:welcome" | chpasswd
# find the hostname from the file
-hostname=$(</etc/hostname)
+hostname=$(cat /etc/hostname)
# identify which interface is up, then find the ip address
interface_up=$(ip -br addr show | grep UP | grep -v 'lo' | awk '{print $1}' | head -n1)
-ipaddress=$(ip addr show $interface_up | grep 'inet ' | awk '{print $2}' | cut -d/ -f1)
+ipaddress=$(ip addr show "$interface_up" | grep 'inet ' | awk '{print $2}' | cut -d/ -f1)
# start the ssh daemon
systemctl start sshd