aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2023-03-30 23:22:36 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2023-03-30 23:22:36 +0200
commitcd890066f9677d0af4ba3f722e0f1c06751adccc (patch)
tree2fa52b032c4028d5cd71ad0de37f962c838499ce
parent3d52b2129312d5a91bb9619d78e0578c98f31547 (diff)
make it look cool
-rw-r--r--elk.hook29
-rwxr-xr-xinstall14
2 files changed, 33 insertions, 10 deletions
diff --git a/elk.hook b/elk.hook
index d5cbabf..9ed9375 100644
--- a/elk.hook
+++ b/elk.hook
@@ -11,17 +11,34 @@ run_hook() {
echo
modprobe -a -q dm-crypt >/dev/null 2>&1
- if [ ! -e "/dev/disk/by-uuid/${authusbuuid}" ]; then
- printf "AuthUSB not found, please plug it in...\r"
-
- while [ ! -e "/dev/disk/by-uuid/${authusbuuid}" ]; do
+ if [ ! -e "/dev/disk/by-uuid/${elkuuid}" ]; then
+ printf '\033[?25l'
+ while [ ! -e "/dev/disk/by-uuid/${elkuuid}" ]; do
+ printf '\033[1m[ \033[31mTIMEOUT\033[0m\033[1m ]\033[0m Waiting for ELK USB [* ]\r'
+ sleep 0.1
+ [ -e "/dev/disk/by-uuid/${elkuuid}" ] && break;
+ printf '\033[1m[ \033[31mTIMEOUT\033[0m\033[1m ]\033[0m Waiting for ELK USB [ * ]\r'
+ sleep 0.1
+ [ -e "/dev/disk/by-uuid/${elkuuid}" ] && break;
+ printf '\033[1m[ \033[31mTIMEOUT\033[0m\033[1m ]\033[0m Waiting for ELK USB [ * ]\r'
+ sleep 0.1
+ [ -e "/dev/disk/by-uuid/${elkuuid}" ] && break;
+ printf '\033[1m[ \033[31mTIMEOUT\033[0m\033[1m ]\033[0m Waiting for ELK USB [ *]\r'
+ sleep 0.1
+ [ -e "/dev/disk/by-uuid/${elkuuid}" ] && break;
+ printf '\033[1m[ \033[31mTIMEOUT\033[0m\033[1m ]\033[0m Waiting for ELK USB [ * ]\r'
+ sleep 0.1
+ [ -e "/dev/disk/by-uuid/${elkuuid}" ] && break;
+ printf '\033[1m[ \033[31mTIMEOUT\033[0m\033[1m ]\033[0m Waiting for ELK USB [ * ]\r'
sleep 0.1
done
+
+ printf '\033[2K\033[?25h'
fi
stty -echo
- printf "Enter Decryption Password: "
+ printf 'Enter Decryption Password: '
read password
stty echo
- printf "$password" | cryptsetup open "/dev/disk/by-uuid/${authusbuuid}" authkeys
+ printf "$password" | cryptsetup open "/dev/disk/by-uuid/${elkuuid}" elkdev
}
diff --git a/install b/install
index 5ee5f42..c8277d9 100755
--- a/install
+++ b/install
@@ -1,12 +1,18 @@
#!/bin/sh
-USB_UUID="$1"
+install_elk() {
+ cp ./elk.hook /etc/initcpio/hooks/elk
+ cp ./elk.install /etc/initcpio/install/elk
+ echo "Run 'mkinitcpio -P' to rebuild the initramfs"
+}
+
+[ "$1" = "elk" ] && install_elk && exit
+USB_UUID="$1"
[ -z "$USB_UUID" ] && echo ./install [UUID] && exit
sed ./keyusbctl -e "s/\[USB_UUID\]/${USB_UUID}/g" > /usr/local/sbin/keyusbctl
cp ./usb-unplug.rules /etc/udev/rules.d/
-cp ./elk.hook /etc/initcpio/hooks/elk
-cp ./elk.install /etc/initcpio/install/elk
chmod +x /usr/local/sbin/keyusbctl
-echo type 'udevadm control --reload' to reload the udev rules
+echo "Run 'udevadm control --reload' to reload the udev rules"
+install_elk