Skip to content

Instantly share code, notes, and snippets.

@roramigator
Created August 8, 2020 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roramigator/13983629e68dff50b05005aecfe561f5 to your computer and use it in GitHub Desktop.
Save roramigator/13983629e68dff50b05005aecfe561f5 to your computer and use it in GitHub Desktop.
wpa-boot-alarm
#!/bin/sh
set -e
if [[ $# -ne 3 ]] ; then
echo "usage: $0 </dev/disk> <ssid> <passphase>"
exit 1
fi
DISK="$1"
SSID="$2"
PASS="$3"
if [[ ! -b "${DISK}" ]] ; then
echo "not dev: ${DISK}"
exit 1
fi
if [[ "${USER}" != "root" ]] ; then
echo "become root."
exit 1
fi
echo ...mounting
mkdir root
mount "${DISK}2" root
cat << EOF >> root/etc/systemd/network/wlan0.network
[Match]
Name=wlan0
[Network]
DHCP=yes
EOF
wpa_passphrase "${SSID}" "${PASS}" > root/etc/wpa_supplicant/wpa_supplicant-wlan0.conf
ln -s \
/usr/lib/systemd/system/wpa_supplicant@.service \
root/etc/systemd/system/multi-user.target.wants/wpa_supplicant@wlan0.service
echo ...unmounting
umount root
echo ...finish!
rmdir root
@roramigator
Copy link
Author

Installation

ArchLinuxARM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment