#!/bin/bash # ======================================= # Script setup # ======================================= set -e set -o pipefail # ======================================= # Helper functions # ======================================= # Ask a question and return true or false based on the users input ask() { # from https://djm.me/ask local prompt default reply while true; do if [ "${2:-}" = "Y" ]; then prompt="Y/n" default=Y elif [ "${2:-}" = "N" ]; then prompt="y/N" default=N else prompt="y/n" default= fi echo -n "$1 [$prompt] " read -r reply ~/.custom echo "" >~/.variables # files to be copied once mkdir -p "$HOME/.config/Code/User" cp "$PWD"/config/code/syncLocalSettings.json ~/.config/Code/User/ # system fixes echo fs.inotify.max_user_watches=524288 | sudo tee /etc/sysctl.d/40-max-user-watches.conf && sudo sysctl --system mkdir -p ~/Pictures/Screenshots setDateTimeConfig } # Installs the dependencies on Arch Linux function install_dependencies { fileToList dependencies/pacman.txt | xargs sudo pacman --noconfirm -S install_trizen set +e fileToList dependencies/aur.txt | xargs trizen -S --noconfirm set -e fileToList dependencies/npm.txt | xargs sudo npm install -g } # set up a new ssh key function create_ssh_key { ssh-keygen -t ed25519 -C "info@rickvanlieshout.com" eval "$(ssh-agent -s)" } # ======================================= # User output functions # ======================================= # Run the intro bit function intro { echo "___ ___ _ _ _ _ _ " echo "| \/ | | | (_) | | | | ( )" echo "| . . | __ _ ___| |_ ___ _ __ _ __ ___ _ _ __ __| |___| |__ |/ " echo "| |\/| |/ _\` / __| __/ _ \ '__| '_ \` _ \| | '_ \ / _' |_ / '_ \ " echo "| | | | (_| \__ \ || __/ | | | | | | | | | | | (_| |/ /| | | | " echo "\_| |_/\__,_|___/\__\___|_| |_| |_| |_|_|_| |_|\__,_/___|_| |_| " echo " " echo " " echo " __ _ _ " echo " / _(_) ___ (_) " echo " ___ ___ _ __ | |_ _ __ _ ( _ ) _ __ _ ___ ___ " echo " / __/ _ \| '_ \| _| |/ _\` | / _ \/\ | '__| |/ __/ _ \ " echo "| (_| (_) | | | | | | | (_| | | (_> < | | | | (_| __/ " echo " \___\___/|_| |_|_| |_|\__, | \___/\/ |_| |_|\___\___| " echo " __/ | " echo " |___/ " echo "" } function computer { echo " /\ " echo " / \ " echo " /_ %%==O=% _____________ " echo " % - -% | '\\\\\\\\\\" echo " _____c% > __ | ' ____|_ " echo " (_|. . % \` % .' | + '||:::::: " echo " ||. ___)%%%%_.' | '||_____| " echo " ||.( \ ~ / ,)' \'_______|_____| " echo " || /| \'/ |\ ___/____|___\___ " echo " _,,,;!___*_____\_| _ ' <<<:| " echo " / /| |_________'___o_o| " echo " /_____/ / " echo " |:____|/ \"Boy, I LOVE this stuff\". " echo "" echo "" } # ======================================= # Main loop # ======================================= clear # Run the intro function intro ask "Do you want to continue installing my config and rice?" Y && # Ask for dependency installation if ask "Do you want to install the applications listen in ./dependencies? (might prompt for password)" Y; then install_dependencies fi # Ask for SSH generation if ask "Do you want to generate a new SSH key?" Y; then create_ssh_key fi # Ask for config installation if ask "Do you want to install the config files?" Y; then install_config fi # Ask for font installation if ask "Do you want to install the fonts?" Y; then install_fonts fi # Autostart docker and add user if ask "Do you want to set up docker for this user?" Y; then install_docker fi # ask to enable the display manager if ask "Do you want to enable sddm?" Y; then sudo systemctl set-default graphical.target sudo systemctl enable sddm.service sudo mkdir -p "/etc/sddm.conf.d/" curl "http://gravatar.com/avatar/$(echo -n "info@rickvanlieshout.com" | md5sum - | cut -d' ' -f1)?s=1024" | sudo tee /usr/share/sddm/faces/mastermindzh.face.icon >/dev/null sudo ln -sf "$PWD"/config/sddm/default.conf /etc/sddm.conf.d/ fi clear computer # ask for pc specific install prompt=$(echo $'\n> ' "Please select a specific computer to install or q to finish the install") PS3="$prompt: " select opt in "$PWD/computers"/*; do if ((REPLY == "q")); then break elif ((REPLY > 0)); then bash "$opt/install.sh" break else echo "Invalid option. Try another one." fi done clear echo "Enjoy using my rice! Do not forget to select i3 in sddm :)"