Skip to content

Instantly share code, notes, and snippets.

@fsmithred
Created July 1, 2012 17:10
Show Gist options
  • Save fsmithred/3028993 to your computer and use it in GitHub Desktop.
Save fsmithred/3028993 to your computer and use it in GitHub Desktop.
make some choices
#!/usr/bin/env bash
# test_cli_menu
# alternate way of setting choices in cli refractainstaller
echo " Choose some options for the installation process. Enter the
numbers for the options you want, on one line, separated by spaces.
01 Change username
02 Change root password
03 Edit /etc/sudoers
04 Disable root login through ssh
05 Disable autologin to desktop
06 Disable autologin to console
xx Exit - Get me out of here!
"
read opts
echo -----
if $(echo $opts | grep -q xx) ; then
exit 0
fi
if $(echo $opts | grep -q 01) ; then
change_username="yes"
fi
if $(echo $opts | grep -q 02) ; then
change_root_pw="yes"
fi
if $(echo $opts | grep -q 03) ; then
edit_sudoers="yes"
fi
if $(echo $opts | grep -q 04) ; then
root_ssh="no"
fi
if $(echo $opts | grep -q 05) ; then
disable_auto_desktop="yes"
fi
if $(echo $opts | grep -q 06) ; then
disable_auto_console="yes"
fi
if [[ $change_username = "yes" ]] ; then
echo "Maybe there should be a change_user function."
fi
if [[ $change_root_pw = "yes" ]] ; then
echo "Good choice! (change root password)
Maybe this should be a function, too."
else
echo "You really *should* change the root password."
fi
if [[ $root_ssh = "no" ]] ; then
echo "Root login through ssh will be disabled."
fi
if [[ $disable_auto_console = "yes" ]] || [[ $disable_auto_desktop = "yes" ]] ; then
echo "The appropriate stuff will be disabled."
else
echo "If you changed your username, and that user was set for
autologin, you'll need to boot into single-user mode to disable autologin
manually."
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment