#!/bin/bash # Ubuntu Post Installation Script # Author: James Brahm # Mail: james@jamesbrahm.us # # Usage instructions: # wget jamesbrahm.us/setup # bash setup # Initial Stuff HEIGHT=10 WIDTH=78 if (whiptail --title "Ubuntu Post Installation Script" --yesno "Author: James Brahm\nMail: james@jamesbrahm.us\n\nDo you want to begin the script?" 10 78) then echo "Starting script..." else echo "Aborting..." exit 0; fi echo "Post installation script for Ubuntu 18.04"; cd $HOME; echo "Changed directory to "$HOME; # Install updates if (whiptail --title "Updates" --yesno "Do you want to check for and install updates?" 10 78) then sudo apt update sudo apt full-upgrade else echo "" fi # Basic Tools RESP=$(whiptail --title "Basic Tools" --checklist \ "Which of these would you like to install? Use space to select." 22 78 4 \ "vim" "VImproved text editor" ON \ "screen" "GNU terminal multiplexer" ON \ "terminator" "GUI terminal multiplexer" ON \ "firefox" "Web browser" ON \ 3>&1 1>&2 2>&3) for package in $RESP do sudo apt install -y $(eval echo $package) done if [[ $RESP == *"vim"* ]] then cd ~ rm vimrc wget jamesbrahm.us/static/vimrc mv vimrc .vimrc fi # Development Tools RESP=$(whiptail --title "Development Tools" --checklist \ "Which of these would you like to install? Use space to select." 22 78 8 \ "git" "Version control system" ON \ "gcc" "GNU C Compiler" ON \ "g++" "GNU C++ Compiler" ON \ "gdb" "GNU debugger" ON \ "gcc-multilib" "" ON \ "python-pip" "Python package installer" ON \ "virtualenv" "Virtual Environment" ON \ "default-jdk" "Java compiler" ON \ 3>&1 1>&2 2>&3) for package in $RESP do sudo apt install -y $(eval echo $package) done if [[ $RESP == *"gdb"* ]] then if (whiptail --yesno "Would you like to install pwndbg extensions for gdb?\n\nThis is quite useful for exploit development or reverse-engineering." 10 78) then sudo apt install git echo "Cloning pwndbg into home..." cd ~ git clone https://github.com/pwndbg/pwndbg cd pwndbg ./setup.sh cd ~ fi fi # Fun Stuff RESP=$(whiptail --title "Just for Fun" --checklist \ "Which of the following would you like to install? Use space to select." 22 78 3 \ "sl" "Steam Locomotive" OFF \ "fortune" "Fortune Cookie" OFF \ "cmatrix" "See the code of the matrix" OFF \ 3>&1 1>&2 2>&3) for package in $RESP do sudo apt install -y $(eval echo $package) done # System Utilities RESP=$(whiptail --title "System Utilities" --checklist \ "Which of the following would you like to install? Use space to select." 22 78 8 \ "p7zip-full" "7zip tool" ON \ "powertop" "Power saving utility" ON \ "tlp" "Another power utility" ON \ "nautilus-dropbox" "File synchronization tool" ON \ "dos2unix" "Line ending converter" ON \ "nmap" "Nework scanner" ON \ "curl" "Downloader" ON \ "ntfs-3g" "Windows FS support" ON \ "gparted" "GNOME Partition Manager" ON \ 3>&1 1>&2 2>&3) for package in $RESP do sudo apt install -y $(eval echo $package) done # If Dropbox was selected, start it # Honestly I don't know if this actually works if [[ $RESP == *"nautilus-dropbox"* ]] then dropbox start -i fi # Powertop isn't useful unless you use it # I usually set everything to good anyway if [[ $RESP == *"powertop"* ]] then if (whiptail --yesno "Would you like to automatically use powertop to tune your power settings on boot?\nThis will install a root cron job that runs powertop --auto-tune automatically.\n\nThis really is only necessary on laptops where you care about power consumption." 10 78) then echo "@reboot /usr/sbin/powertop --auto-tune" | sudo tee --append /var/spool/cron/crontabs/root whiptail --title "Warning" --msgbox "A cron job has been added to start powertop. However, we did not check to see if one already exists. If you aren't sure, run 'sudo crontab -e' to ensure it's only there once." 10 78 fi fi # Media RESP=$(whiptail --title "Media & Office" --checklist \ "Which of the following would you like to install? Use space to select." 22 78 5 \ "libreoffice" "Office suite" ON \ "vlc" "Media player" ON \ "gimp" "Photo editor" ON \ "inkscape" "Vector graphic editor" OFF \ "openshot-qt" "Video editor" OFF \ 3>&1 1>&2 2>&3) for package in $RESP do sudo apt install -y $(eval echo $package) done # Servers RESP=$(whiptail --title "Local servers" --checklist \ "Which of the following would you like to install? Use space to select." 22 78 5 \ "apache2" "Web server" OFF \ "openssh-server" "SSH server" ON \ 3>&1 1>&2 2>&3) for package in $RESP do sudo apt install -y $(eval echo $package) done # Academic RESP=$(whiptail --title "Academic Tools" --checklist \ "Which of the following would you like to install? Use space to select." 22 78 4 \ "speedcrunch" "Calculator" ON \ "pandoc" "Markdown to pdf" ON \ "texlive" "LaTeX distribution" OFF \ "calibre" "Book reader" OFF \ 3>&1 1>&2 2>&3) for package in $RESP do sudo apt install -y $(eval echo $package) done # Firewall stuff if (whiptail --yesno "Set basic firewall rules?\n\nThis will deny incoming connections by default." 10 78) then sudo apt install -y ufw yes | sudo ufw reset yes | sudo ufw enable sudo ufw default deny incoming sudo ufw default allow outgoing fi # Google Chrome, the real version, not Chromium if (whiptail --yesno "Do you want to install Chrome?" 10 78) then echo "Downloading Chrome installer..." cd Downloads rm google-chrome-stable_current_amd64.deb wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb echo "Installing dependency resolution tool (gdebi)..." sudo apt install -y gdebi echo "Installing Chrome..." sudo gdebi google-chrome-stable_current_amd64.deb cd ~ fi # CAC if (whiptail --yesno "Do you want to install DoD CAC support?" 10 78) then # Install CAC middleware sudo apt install -y libpcsclite1 pcscd pcsc-tools # Install cac reader sudo apt install -y coolkey # Alert user of next steps whiptail --title "Next Steps" --msgbox "CAC support has been installed, but you are not yet configured to use DoD sites like DTS. You need to do two things.\n\n1. Download the DoD root certificates and configure Firefox to use them.\n\n2. Configure Firefox to trust the Coolkey security device." 10 78 whiptail --title "Next Steps" --msgbox "You can get by without the certs, but you need to to this in Firefox:\nPreferences -> Advanced -> Encryption -> Security Devices -> Load -> /usr/lib/pkcs11/libcoolkeypk11.so" 10 78 fi # Modify the global shortcut file for KDE # This allows you to use keyboard shortcuts to switch between workspaces # This was the default in Unity and I miss it if (whiptail --yesno "Enable Unity/GNOME-style workspace switching in KDE?\n\nI find this really useful, but I've only tested it on Kubuntu 18.04.\n\nIn fact, it doesn't usually work there so you probably need to do this manually. Sorry!" 10 78) then sed -i 's/Switch One Desktop Up=none,none,Switch One Desktop Up/Switch One Desktop Up=Ctrl+Alt+Up,none,Switch One Desktop Up/' ~/.config/kglobalshortcutsrc sed -i 's/Switch One Desktop Down=none,none,Switch One Desktop Down/Switch One Desktop Down=Ctrl+Alt+Down,none,Switch One Desktop Down/' ~/.config/kglobalshortcutsrc sed -i 's/Switch One Desktop to the Left=none,none,Switch One Desktop to the Left/Switch One Desktop to the Left=Ctrl+Alt+Left,none,Switch One Desktop to the Left/' ~/.config/kglobalshortcutsrc sed -i 's/Switch One Desktop to the Right=none,none,Switch One Desktop to the Right/Switch One Desktop to the Right=Ctrl+Alt+Right,none,Switch One Desktop to the Right/' ~/.config/kglobalshortcutsrc sed -i 's/Window One Desktop Up=none,none,Window One Desktop Up/Window One Desktop Up=Ctrl+Alt+Shift+Up,none,Window One Desktop Up/' ~/.config/kglobalshortcutsrc sed -i 's/Window One Desktop Down=none,none,Window One Desktop Down/Window One Desktop Down=Ctrl+Alt+Shift+Down,none,Window One Desktop Down/' ~/.config/kglobalshortcutsrc sed -i 's/Window One Desktop to the Left=none,none,Window One Desktop to the Left/Window One Desktop to the Left=Ctrl+Alt+Shift+Left,none,Window One Desktop to the Left/' ~/.config/kglobalshortcutsrc sed -i 's/Window One Desktop to the Right=none,none,Window One Desktop to the Right/Window One Desktop to the Right=Ctrl+Alt+Shift+Right,none,Window One Desktop to the Right/' ~/.config/kglobalshortcutsrc fi if (whiptail --yesno "Would you like to install Chinese input tools? This works really well on XFCE but does not recognize KDE applications as an input window." 10 78) then sudo apt install -y fcitx fcitx-googlepinyin whiptail --title "Next Steps" --msgbox "fcitx and googlepinyin have been installed, but you may need to manually add that as an input. Additionally, you need to reboot and then start fcitx to get input switching to work. I'm not kidding, actually reboot your computer." 10 78 fi echo "Done!"