Skip to content

Instantly share code, notes, and snippets.

@unakatsuo
Last active March 26, 2021 23:58
Show Gist options
  • Save unakatsuo/dca1e1abd57a4bbbc120005c1b0891f8 to your computer and use it in GitHub Desktop.
Save unakatsuo/dca1e1abd57a4bbbc120005c1b0891f8 to your computer and use it in GitHub Desktop.
Run custom tui menu on tty1 with systemd getty.
#!/bin/bash
set -e
function show_main_menu() {
whiptail --nocancel --menu "Main Menu" 12 35 4 \
1 "Network Configuration" \
2 "Modify Hostname" \
3 "Factory Reset" \
3>&2 2>&1 1>&3
}
item=$(show_main_menu)
case $item in
1)
nmtui edit eth0
;;
2)
nmtui hostname
;;
3)
echo "Factory Reset"
read
;;
*)
echo "QUIT"
;;
esac
# /etc/systemd/system/getty\@tty1.service.d/override.conf
[Service]
ExecStart=
ExecStart=-/usr/sbin/agetty --autologin root --login-program /root/menu.sh --noissue --noclear %I $TERM
@unakatsuo
Copy link
Author

unakatsuo commented Jun 17, 2018

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