Last active
August 29, 2015 14:17
-
-
Save phroa/a7f1107d120f765d5daa to your computer and use it in GitHub Desktop.
script to set up essential ubuntu vps things. use if you want. curl, pipe to "sudo bash" -- "sh" doesn't cut it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c_black="$(tput setaf 0)" | |
c_red="$(tput setaf 1)" | |
c_green="$(tput setaf 2)" | |
c_yellow="$(tput setaf 3)" | |
c_blue="$(tput setaf 4)" | |
c_magenta="$(tput setaf 5)" | |
c_cyan="$(tput setaf 6)" | |
c_white="$(tput setaf 7)" | |
c_reset="$(tput sgr0)" | |
opt_upgrade_packages=0 | |
opt_install_buildtools=0 | |
opt_install_google_authenticator=0 | |
current_phase=1 | |
print_phase() { | |
printf "\n%bPhase %b%s: %s%b\n\n" "$c_magenta" "$current_phase" "$c_cyan" "$1" "$c_reset" | |
let current_phase+=1 | |
} | |
printf "%b===================================================%b\n\n" "$c_green" "$c_reset" | |
printf "%b Ubuntu VPS Setup%b\n\n" "$c_yellow" "$c_reset" | |
printf "%b===================================================%b\n\n" "$c_green" "$c_reset" | |
print_phase "Make sure we're root" | |
#if [[ $EUID -ne 0 ]]; then | |
# printf "%bThis script must be run as root!\nTry using \`curl\` and piping to \`sudo bash\`.%b\n" "$c_yellow" "$c_reset" 1>&2 | |
# exit 1 | |
#fi | |
printf "%bAlready running as root.%b\n" "$c_green" "$c_reset" | |
sleep 1 | |
print_phase "Check options" | |
read -p "${c_magenta}Upgrade apt packages? ${c_yellow}[Y/n]$c_reset " -n 1 -r | |
echo | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
let opt_upgrade_packages=1 | |
fi | |
#read -p "${c_magenta}Install common build/dev tools? ${c_yellow}[Y/n]$c_reset " -n 1 -r -e | |
#case $REPLY in | |
# y|Y ) let opt_install_buildtools=1;; | |
#esac | |
# | |
#read -p "${c_magenta}Have SSH use Google Authenticator for two-factor auth? ${c_yellow}[Y/n]$c_reset " -n 1 -r -e | |
#case $REPLY in | |
# y|Y ) let opt_install_google_authenticator=1;; | |
#esac | |
printf "upgrade? ${opt_upgrade_packages}\n" | |
printf "tools? ${opt_install_buildtools}\n" | |
printf "auth? ${opt_install_google_authenticator}\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment