summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-11-29 15:23:49 -0600
committerCraig Jennings <c@cjennings.net>2024-11-29 15:23:49 -0600
commit5daddeb0848a1e3f3dfc607b111fdc6cc52186fa (patch)
treeaa76cd00cab7c1a764737596b50a33932a4779d7 /init
parent916e999777ecdab646e32c7ba4939f45f1bcc0e2 (diff)
avoid hardcoding network interface
Diffstat (limited to 'init')
-rwxr-xr-xinit13
1 files changed, 11 insertions, 2 deletions
diff --git a/init b/init
index 159fe6a..bf22cd3 100755
--- a/init
+++ b/init
@@ -1,12 +1,21 @@
#!/bin/sh
+
+# update and install tmux and git
pacman -Sy --noconfirm
pacman -S --noconfirm tmux git
-systemctl start sshd
+# change the root password
echo "root:welcome" | chpasswd
+
+# find the hostname from the file
hostname=$(</etc/hostname)
-ipaddress=$(ip addr show wlan0 | grep 'inet ' | awk '{print $2}' | cut -d/ -f1)
+# identify which interface is up, then find the ip address
+interface_up=$(ip addr show | grep "state UP" -B2 | head -n1 | awk '{print $2}' | sed 's/://')
+ipaddress=$(ip addr show $(interface_up) | grep 'inet ' | awk '{print $2}' | cut -d/ -f1)
+
+# start the ssh daemon
+systemctl start sshd
echo ""; echo ""; echo "init complete. "
echo "you may ssh root@$hostname or ssh root@$ipaddress using the password 'welcome'"