Last active
February 28, 2019 13:34
-
-
Save gabrieleara/0e77e9cb8ab8fee483cb749a636a6103 to your computer and use it in GitHub Desktop.
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
| #!/bin/bash | |
| ### FUNCTIONS ### | |
| # Ask the user a simple yes/no question. Any response other than yes (no case) | |
| # will lead to a negative answer | |
| confirm() { | |
| # Call this function with a prompt string (without y/N) or use the default | |
| # prompt "Are you sure?" | |
| local response | |
| read -r -p "${1:-Are you sure?} [y/N] " response | |
| case "$response" in | |
| [yY][eE][sS]|[yY]) | |
| echo 1 | |
| ;; | |
| *) | |
| echo 0 | |
| ;; | |
| esac | |
| } | |
| # Ask the user a simple yes/no question. Any response other than yes (no case) | |
| # will lead to a negative answer | |
| confirm_timeout() { | |
| # The first argument is the timeout in seconds, the second behaves exactly | |
| # like in confirm() | |
| # Call this function with a prompt string (without y/N) or use the default | |
| # prompt "Are you sure?" | |
| local response | |
| read -r -t $1 -p "${2:-Are you sure?} [y/N] " response | |
| if [ $? == 0 ]; then | |
| case "$response" in | |
| [yY][eE][sS]|[yY]) | |
| echo 1 | |
| ;; | |
| *) | |
| echo 0 | |
| ;; | |
| esac | |
| else | |
| echo 0 | |
| fi | |
| } | |
| # Print a section separator between parts of the script | |
| section() { | |
| echo "" | |
| echo "" | |
| echo "$1" | |
| echo "" | |
| } | |
| # Downloads and installs a deb file, then deletes said file. Takes care even of | |
| # unmet dependencies during deb file installation | |
| download_install() { | |
| # Argument 1 is the readable name for the user | |
| # Argument 2 is the link for download | |
| # They are both required | |
| section "$1 installation..." | |
| echo "Downloading files..." | |
| wget -O - $2 > /tmp/temp_installer.deb | |
| echo "Installing..." | |
| sudo dpkg -i /tmp/temp_installer.deb || sudo apt-get install -f -y | |
| echo "Removing old files..." | |
| rm /tmp/temp_installer.deb | |
| echo "$1 installation completed!" | |
| } | |
| ### INTRO ### | |
| echo "You are executing Gabriele Ara's post-installation script." | |
| echo "You'll be asked to insert your sudo password for later use..." | |
| set -e | |
| sudo echo "" | |
| default=0 | |
| not_default=1 | |
| ### PARSING ARGUMENTS ### | |
| while [ "$1" ]; do | |
| case $1 in | |
| -d|--default) | |
| default=1 | |
| not_default=0 | |
| break | |
| esac | |
| shift | |
| done | |
| ### SETTINGS ### | |
| # TODO: SAMBA | |
| # Default configuration | |
| if ((default)) ; then | |
| hide_snaps=1 | |
| install_nvidia_switch=0 | |
| install_sushi=1 | |
| install_java=1 | |
| install_allegro4=1 | |
| install_libfftw3=1 | |
| install_powerline=1 | |
| install_netbeans=0 | |
| install_clion=1 | |
| install_vscode=1 | |
| install_albert=1 | |
| install_audacity=1 | |
| install_telegram=1 | |
| install_skype=1 | |
| install_chrome=1 | |
| install_spotify=1 | |
| install_mailspring=1 | |
| install_obs=1 | |
| install_handbrake=1 | |
| install_popcorn=1 | |
| install_kodi=0 | |
| install_blender=1 | |
| install_custom_blender=0 | |
| install_synergy=0 | |
| install_typora=1 | |
| install_node=1 | |
| install_docker=1 | |
| install_gimp_latest=1 | |
| install_theme_arc=1 | |
| install_theme_arc_default=0 | |
| install_theme_macos=1 | |
| install_theme_macos_default=1 | |
| install_grub_customizer=1 | |
| install_deskchanger=1 | |
| install_webapps=1 | |
| echo "Default settings have been loaded!" | |
| else | |
| echo "You will now be asked to configure what you would like to install among optional features:" | |
| hide_snaps=$(confirm "Would you like to hide snap folder in home?" ) | |
| install_nvidia_switch=$(confirm "Do you have both an external NVIDIA graphic card and an internal Intel one?") | |
| install_sushi=$(confirm "Would you like to install Gnome Sushi?") | |
| install_java=$(confirm "Would you like to install Java?") | |
| install_allegro4=$(confirm "Would you like to install Allegro 4.4?") | |
| install_libfftw3=$(confirm "Would you like to install libfftw3?") | |
| install_powerline=$(confirm "Would you like to install Powerline Shell?") | |
| # install_netbeans=$(confirm "Would you like to install Netbeans IDE (it will install also Java)?") | |
| install_netbeans=0 | |
| install_clion=$(confirm "Would you like to install CLion IDE?") | |
| install_vscode=$(confirm "Would you like to install VS Code editor?") | |
| install_albert=$(confirm "Would you like to install Albert launcher?") | |
| install_audacity=$(confirm "Would you like to install Audacity?") | |
| install_telegram=$(confirm "Would you like to install Telegram Desktop client?") | |
| install_skype=$(confirm "Would you like to install Skype for Linux?") | |
| install_chrome=$(confirm "Would you like to install Google Chrome?") | |
| install_spotify=$(confirm "Would you like to install Spotify client?") | |
| install_mailspring=$(confirm "Would you like to install Mailspring email client?") | |
| install_obs=$(confirm "Would you like to install OBS Studio?" ) | |
| install_handbrake=$(confirm "Would you like to install HandBrake?" ) | |
| install_popcorn=$(confirm "Would you like to install Popcorn Time?") | |
| install_kodi=$(confirm "Would you like to install Kodi?") | |
| install_synergy=$(confirm "Would you like to install Synergy (mouse/keyboard sharing)?") | |
| install_typora=$(confirm "Would you like to install Typora (markdown editor)?") | |
| install_blender=$(confirm "Would you like to install Blender?" ) | |
| if ((install_blender)) ; then | |
| install_custom_blender=$(confirm "Would you like to install it from custom repo?") | |
| else | |
| install_custom_blender=0 | |
| fi | |
| install_node=$(confirm "Would you like to install Node.js?" ) | |
| install_docker=$(confirm "Would you like to install Docker?" ) | |
| install_gimp_latest=$(confirm "Would you like to have latest Gimp version (not shipped in standard Ubuntu repo)?") | |
| install_theme_arc=$(confirm "Would you like to install Arc theme?" ) | |
| if ((install_theme_arc)) ; then | |
| install_theme_arc_default=$(confirm "Set as theme?") # TODO: this | |
| fi | |
| install_theme_macos=$(confirm "Would you like to install macOS theme (MacBuntu)?" ) | |
| if ((install_theme_macos)) ; then | |
| install_theme_macos_default=$(confirm "Set as theme?") | |
| fi | |
| install_grub_customizer=$(confirm "Would you like to install Grub Customizer?" ) | |
| install_deskchanger=$(confirm "Are you going to use DeskChanger Gnome Extension (installed separately)?") | |
| install_webapps=$(confirm "Would you like to install some webapps (WhatsApp, Overleaf - it will install also Node.js)?") | |
| if ((install_netbeans)) ; then | |
| install_java=1 | |
| fi | |
| if ((install_webapps)) ; then | |
| install_node=1 | |
| fi | |
| section "Thank you for your patience, the install script is now fully configured and will start installation..." | |
| fi # default | |
| ### SET SU PASSWORD ### | |
| if (($(confirm "Would you like to set root password now?"))) ; then | |
| sudo passwd | |
| fi | |
| ### HIDING SNAPS ### | |
| if ((hide_snaps)) ; then | |
| # Hiding snap folder in home | |
| echo snap >> ~/.hidden ; | |
| fi | |
| # Author does not believe in the success of snap packages. While they are useful | |
| # in that they successfully provide containerization for multiple applications, | |
| # honestly it's a pain in the ass the fact that they have to see a virtual file | |
| # system every time you try to open or save a file. In addition, regional support | |
| # for snap packages lacks the ability to recognize standard folders (Documents, | |
| # Downloads and so on) in languages different than English, often creating said | |
| # folders alongside default ones. | |
| ### INSTALLING REPOSITORIES ### | |
| section "INSTALLING REPOSITORIES" | |
| # Enabling standard repositories | |
| sudo apt-add-repository main --no-update -y | |
| sudo apt-add-repository universe --no-update -y | |
| sudo apt-add-repository restricted --no-update -y | |
| sudo apt-add-repository multiverse --no-update -y | |
| # These packages are needed to install strange repositories | |
| sudo apt update | |
| sudo apt install curl software-properties-common -y | |
| ### First we install simple repositories, they don't need curl or software-properties-common | |
| # Spotify public key and repository | |
| if ((install_spotify)) ; then | |
| sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 931FF8E79F0876134EDDBDCCA87FF9DF48BF1C90 | |
| echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list | |
| fi | |
| # Latest version of Gimp (2.10.x) is not present in Ubuntu repos | |
| if ((install_gimp_latest)) ; then | |
| sudo add-apt-repository ppa:otto-kesselgulasch/gimp --no-update -y | |
| fi | |
| # Grub Customizer repository | |
| if ((install_grub_customizer)) ; then | |
| sudo apt-add-repository ppa:danielrichter2007/grub-customizer --no-update -y | |
| fi | |
| # Offical Oracle-Java8 installer repository | |
| if ((install_java)) ; then | |
| sudo add-apt-repository ppa:webupd8team/java --no-update -y | |
| fi | |
| # OBS Studio screen recorder repository | |
| if ((install_obs)) ; then | |
| sudo add-apt-repository ppa:obsproject/obs-studio --no-update -y | |
| fi | |
| # Typora key and repository | |
| if ((install_typora)) ; then | |
| wget -qO - https://typora.io/linux/public-key.asc | sudo apt-key add - | |
| sudo add-apt-repository 'deb https://typora.io/linux ./' --no-update -y | |
| fi | |
| # Custom Blender repository | |
| if ((install_custom_blender)) ; then | |
| sudo add-apt-repository ppa:thomas-schiex/blender --no-update -y | |
| fi | |
| # MacBuntu theme repository | |
| if ((install_theme_macos)) ; then | |
| sudo add-apt-repository ppa:noobslab/macbuntu --no-update -y | |
| fi | |
| ### More complex repositories, they require curl or software-properties-common | |
| ### to be installed | |
| # This script adds Node.js repository | |
| if ((install_node)) ; then | |
| curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash - | |
| fi | |
| # The following repo is needed to install docker-ce | |
| if ((install_docker)) ; then | |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
| sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" --no-update -y | |
| fi | |
| # The following operations are needed to install Albert | |
| if ((install_albert)) ; then | |
| curl https://build.opensuse.org/projects/home:manuelschneid3r/public_key | sudo apt-key add - | |
| sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/manuelschneid3r/xUbuntu_18.04/ /' > /etc/apt/sources.list" | |
| fi | |
| ### INSTALLING PACKAGES ### | |
| section "INSTALLING BASIC PACKAGES" | |
| installed_packages="exfat-fuse exfat-utils build-essential apt-file cmake git" | |
| installed_packages="$installed_packages linux-headers-generic p7zip-full valgrind" | |
| installed_packages="$installed_packages htop manpages-posix manpages-posix-dev" | |
| installed_packages="$installed_packages tree vim-gtk3 gnome-tweak-tool stress" | |
| installed_packages="$installed_packages gparted vlc gimp gnuplot cpufrequtils" | |
| installed_packages="$installed_packages colordiff hwloc" | |
| # I accept license in advance for Java 8 | |
| if ((install_java)) ; then | |
| echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections | |
| echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections | |
| installed_packages="$installed_packages oracle-java8-installer" | |
| fi | |
| if ((install_grub_customizer)) ; then | |
| installed_packages="$installed_packages grub-customizer" | |
| fi | |
| if ((install_nvidia_switch)) ; then | |
| installed_packages="$installed_packages bumblebee bumblebee-nvidia primus" | |
| fi | |
| if ((install_audacity)) ; then | |
| installed_packages="$installed_packages audacity" | |
| fi | |
| if ((install_albert)) ; then | |
| installed_packages="$installed_packages albert" | |
| fi | |
| if ((install_docker)) ; then | |
| installed_packages="$installed_packages docker-ce docker-compose" | |
| fi | |
| # Used to install Gnome Extensions from Google Chrome | |
| if ((install_chrome)) ; then | |
| installed_packages="$installed_packages chrome-gnome-shell" | |
| fi | |
| if ((install_node)) ; then | |
| installed_packages="$installed_packages nodejs" | |
| fi | |
| if ((install_spotify)) ; then | |
| installed_packages="$installed_packages spotify-client" | |
| fi | |
| # NOTICE: ffmpeg is actually a requirement of obs-studio | |
| # not a "standalone" package in this case | |
| if ((install_obs)) ; then | |
| installed_packages="$installed_packages ffmpeg obs-studio" | |
| fi | |
| # NOTICE: this is needed only if you are interested in Desk Changer Gnome Extension | |
| if ((install_desk_changer)) ; then | |
| installed_packages="$installed_packages python-gi" | |
| fi | |
| if ((install_allegro4)) ; then | |
| installed_packages="$installed_packages liballegro4.4 liballegro4-dev" | |
| installed_packages="$installed_packages allegro4-doc libasound2-dev" | |
| installed_packages="$installed_packages libasound2-doc" | |
| fi | |
| if ((install_libfftw3)) ; then | |
| installed_packages="$installed_packages libfftw3-dev" | |
| fi | |
| # Needed by Popcorn-Time | |
| if ((install_popcorn)) ; then | |
| installed_packages="$installed_packages libcanberra-gtk-module libgconf-2-4" | |
| fi | |
| # Needed by Powerline Shell | |
| if ((install_powerline)) ; then | |
| installed_packages="$installed_packages fonts-powerline python-pip" | |
| fi | |
| if ((install_blender)) ; then | |
| installed_packages="$installed_packages blender" | |
| fi | |
| if ((install_sushi)) ; then | |
| installed_packages="$installed_packages gnome-sushi" | |
| fi | |
| # HandBrake-CLI is a command-line variant | |
| if ((install_handbrake)) ; then | |
| installed_packages="$installed_packages handbrake handbrake-cli" | |
| fi | |
| if ((install_theme_arc)) ; then | |
| installed_packages="$installed_packages arc-theme" | |
| fi | |
| if ((install_theme_macos)) ; then | |
| # I personally never use LibreOffice | |
| # installed_packages="$installed_packages libreoffice-style-sifr" | |
| installed_packages="$installed_packages macbuntu-os-icons-v1804 macbuntu-os-ithemes-v1804" | |
| fi | |
| if ((install_kodi)) ; then | |
| installed_packages="$installed_packages kodi" | |
| fi | |
| if ((install_synergy)) ; then | |
| installed_packages="$installed_packages synergy" | |
| fi | |
| if ((install_typora)) ; then | |
| installed_packages="$installed_packages typora" | |
| fi | |
| # Sorting the list of installed packages (removing duplicates) | |
| installed_packages=$(echo $installed_packages | xargs -n1 | sort -u | xargs) | |
| echo "Updating repositories..." | |
| sudo apt update | |
| echo "" | |
| echo "The next command will install the following repositories: " | |
| echo "" | |
| echo $installed_packages | |
| echo "" | |
| echo "" | |
| sudo apt install $installed_packages -y | |
| section "PACKAGES INSTALLED" | |
| if ((install_telegram)) ; then | |
| ### INSTALLING TELEGRAM ### | |
| section "INSTALLING TELEGRAM" | |
| # My preferred way to install telegram is to download it as an archive from the | |
| # web and install it under /opt folder. This because the snap package really is | |
| # bad and PPA updates are slow (they are not maintained very frequently). | |
| # To update it check for updates within the application. | |
| cd /tmp | |
| wget https://telegram.org/dl/desktop/linux -O - > tsetup.tar.xz | |
| tar xf tsetup.tar.xz | |
| sudo rm -rf /opt/Telegram | |
| sudo mv /tmp/Telegram /opt/ | |
| sudo ln -f -s /opt/Telegram/Telegram /usr/local/bin/telegram-desktop | |
| # TODO: check if updater works this way (not so secure) | |
| sudo chmod -R a+w /opt/Telegram/* | |
| rm tsetup.tar.xz | |
| cd - > /dev/null | |
| echo "Telegram Installed! Start it with telegram-desktop!" | |
| echo "Run it once to create its desktop entry." | |
| fi # install_telegram | |
| if ((install_popcorn)) ; then | |
| ### INSTALLING POPCORN TIME ### | |
| section "INSTALLING POPCORN TIME" | |
| cd /tmp | |
| wget -O Popcorn-Time.tar.xz http://mirror02.popcorntime.sh/build/Popcorn-Time-0.3.10-Linux-64.tar.xz | |
| mkdir popcorntime | |
| tar xf Popcorn-Time.tar.xz -C popcorntime | |
| sudo rm -rf /opt/popcorntime | |
| sudo mv popcorntime /opt | |
| sudo ln -f -s /opt/popcorntime/Popcorn-Time /usr/local/bin/popcorn-time | |
| cd - > /dev/null | |
| # TODO: check permissions for popcorn-time executable | |
| # sudo chmod a+x /opt/popcorntime/Popcorn-Time | |
| # sudo chmod a+x /opt/popcorntime | |
| # Creating icon and desktop file | |
| sudo wget -q https://upload.wikimedia.org/wikipedia/commons/6/6c/Popcorn_Time_logo.png -O /usr/share/icons/Popcorn-Time.png | |
| echo "[Desktop Entry]" | sudo tee /usr/share/applications/popcorn-time.desktop > /dev/null | |
| echo "Version = 1.0" | sudo tee -a /usr/share/applications/popcorn-time.desktop > /dev/null | |
| echo "Type = Application" | sudo tee -a /usr/share/applications/popcorn-time.desktop > /dev/null | |
| echo "Terminal = false" | sudo tee -a /usr/share/applications/popcorn-time.desktop > /dev/null | |
| echo "Name = Popcorn Time" | sudo tee -a /usr/share/applications/popcorn-time.desktop > /dev/null | |
| echo "Exec = popcorn-time" | sudo tee -a /usr/share/applications/popcorn-time.desktop > /dev/null | |
| echo "Icon = Popcorn-Time" | sudo tee -a /usr/share/applications/popcorn-time.desktop > /dev/null | |
| echo "Categories = Application;Network" | sudo tee -a /usr/share/applications/popcorn-time.desktop > /dev/null | |
| echo "Popcorn-Time Installed! Start it with popcorn-time!" | |
| fi # install_popcorn | |
| if ((install_java)) ; then | |
| ### SETTING UP JAVA_HOME ### | |
| section "Adding JAVA_HOME..." | |
| sudo sh -c "echo 'export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")' >> /etc/profile" | |
| ### SETTING UP AN APPLICATION GROUP FOR JAVA APPLICATIONS - DOES NOT WORK ### | |
| # app_folders=$(gsettings get org.gnome.desktop.app-folders folder-children | perl -pe "s/(\[[',\w\s]*)(\])/\1, 'Java'\2/g") | |
| # gsettings set org.gnome.desktop.app-folders folder-children "$app_folders" | |
| # gsettings set org.gnome.desktop.app-folders.folder:/org/gnome/desktop/app-folders/folders/Java/ name 'Java' | |
| # gsettings set org.gnome.desktop.app-folders.folder:/org/gnome/desktop/app-folders/folders/Java/ apps "['sun-java.desktop', 'sun-javaws.desktop', 'sun_java.desktop', 'JB-java-jdk8.desktop', 'JB-javaws-jdk8.desktop']" | |
| fi # install_java | |
| if ((install_nvidia_switch)) ; then | |
| ### INSTALLING NVIDIA ### | |
| section "Installing an NVIDIA graphic card control switch..." | |
| echo "Downloading files..." | |
| cd /tmp | |
| git clone https://gist.github.com/a392e30863560da7376a527d07e33089.git nvidia | |
| sudo cp nvidia/nvidia_* /usr/local/bin/ | |
| sudo chmod a+x /usr/local/bin/nvidia_* | |
| rm -r -f nvidia | |
| cd - > /dev/null | |
| echo "NVIDIA control switch installed, see commands nvidia_on, nvidia_off and nvidia_status." | |
| fi # install_nvidia | |
| if ((install_powerline)) ; then | |
| ### INSTALLING POWERLINE SHELL ### | |
| section "Installing Powerline Shell (with custom configuration)..." | |
| pip install powerline-shell | |
| mkdir -p ~/.config/powerline-shell | |
| # Installing Poweline Shell into .bashrc | |
| echo '' | tee -a ~/.bashrc > /dev/null | |
| echo '# Powerline Shell Stuff' | tee -a ~/.bashrc > /dev/null | |
| echo '' | tee -a ~/.bashrc > /dev/null | |
| echo 'PATH="$HOME/.local/bin/:$PATH"' | tee -a ~/.bashrc > /dev/null | |
| echo 'function _update_ps1() {' | tee -a ~/.bashrc > /dev/null | |
| echo ' PS1=$(powerline-shell $?)' | tee -a ~/.bashrc > /dev/null | |
| echo '}' | tee -a ~/.bashrc > /dev/null | |
| echo '' | tee -a ~/.bashrc > /dev/null | |
| echo 'if [[ $TERM != linux && ! $PROMPT_COMMAND =~ _update_ps1 ]]; then' | tee -a ~/.bashrc > /dev/null | |
| echo ' PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"' | tee -a ~/.bashrc > /dev/null | |
| echo 'fi' | tee -a ~/.bashrc > /dev/null | |
| echo '' | tee -a ~/.bashrc > /dev/null | |
| # Updating .bashrc configuration | |
| # I cannot update .bashrc from a non-interactive shell, so I need to execute | |
| # the followinf command manually to keep going | |
| PATH="$HOME/.local/bin/:$PATH" | |
| # Generating default configuration | |
| #powerline-shell --generate-config > ~/.config/powerline-shell/config.json | |
| # The following is my custom Powerline Shell configuration | |
| cd /tmp/ && git clone https://gist.github.com/e63937d1a71c58308abaceaa05d13070.git powerline-config && cp powerline-config/config.json ~/.config/powerline-shell/ && rm -rf powerline-config && cd - > /dev/null | |
| # Installing standalone font for special characters in Powerline Shell | |
| cd /tmp/ && git clone "https://github.com/abertsch/Menlo-for-Powerline.git" && mkdir -p ~/.fonts && cp "Menlo-for-Powerline/*.ttf" ~/.fonts && rm -rf "Menlo-for-Powerline" && cd - > /dev/null && fc-cache -vf ~/.fonts | |
| echo "Powerline Shell installed with a custom configuration, to revert to default configuration run: powerline-shell --generate-config > ~/.config/powerline-shell/config.json" | |
| fi # install_powerline | |
| if ((install_theme_macos)) ; then | |
| section "Fixing some problems with macOS theme (completely normal)..." | |
| # Uncomment for Mac Serif Fonts (which I don't use) | |
| # cd /tmp && wget -O mac-fonts.zip http://drive.noobslab.com/data/Mac/macfonts.zip && mkdir -p ~/.fonts && unzip mac-fonts.zip -d ~/.fonts && rm mac-fonts.zip && cd - > /dev/null && fc-cache -vf ~/.fonts | |
| # NOTICE: Icon packs is MacBuntu-OS, theme is MacBuntu-OS-MJV and cursors are MacBuntu-OSX-cursors | |
| # Downloading Alfred's icon as Albert's icon | |
| sudo wget https://www.alfredapp.com/media/logo.png -O /usr/share/icons/MacBuntu-OS/apps/128/albert.png | |
| # Mailspring's icon set to default mail icon | |
| sudo cp /usr/share/icons/MacBuntu-OS/apps/128/mail-client.png /usr/share/icons/MacBuntu-OS/apps/128/mailspring.png | |
| # Fixing wrong full trash can icon | |
| cd /usr/share/icons/MacBuntu-OS/places | |
| sudo find . -name "*trash*" -exec cp --parents \{\} ../status --verbose \; | |
| cd - > /dev/null | |
| sudo touch /usr/share/icons/MacBuntu-OS | |
| sudo gtk-update-icon-cache | |
| echo "All fixed!" | |
| if ((install_theme_macos_default)) ; then | |
| echo "Setting it as default theme..." | |
| gsettings set org.gnome.desktop.interface gtk-theme 'MacBuntu-OS-MJV' | |
| gsettings set org.gnome.desktop.interface icon-theme 'MacBuntu-OS' | |
| gsettings set org.gnome.desktop.interface cursor-theme 'Macbuntu-OSX-cursors' | |
| echo "Done!" | |
| fi | |
| fi # install_theme_macos | |
| ### INSTALLING DOWNLOADABLE DEB PACKAGES ### | |
| if ((install_chrome)) ; then | |
| # Google Chrome | |
| download_install "Chrome" "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" | |
| fi | |
| if ((install_vscode)) ; then | |
| # VS Code | |
| download_install "VS Code" "https://go.microsoft.com/fwlink/?LinkID=760868" | |
| fi | |
| if ((install_skype)) ; then | |
| # Skype | |
| download_install "Skype" "https://go.skype.com/skypeforlinux-64.deb" | |
| fi | |
| if ((install_mailspring)) ; then | |
| # Mailspring | |
| download_install "Mailspring" "https://updates.getmailspring.com/download?platform=linuxDeb" | |
| fi | |
| if ((install_webapps)) ; then | |
| ### INSTALLING WEBAPPS ### | |
| section "INSTALLING WEBAPPS" | |
| echo "Installing nativefier..." | |
| sudo npm install nativefier -g | |
| echo "Downloading a wrapper command..." | |
| cd /tmp | |
| git clone https://gist.github.com/684882880c8c057858732b5e40032aa8.git webinstall | |
| sudo cp webinstall/webinstall /usr/local/bin/webinstall | |
| sudo chmod a+x /usr/local/bin/webinstall | |
| rm -r -f webinstall | |
| cd - > /dev/null | |
| echo "Wrapper command downloaded, see command webinstall." | |
| echo "Installing a few webapps:" | |
| echo "Installing WhatsApp..." | |
| # WhatsApp recently broke, asking for Chrome 36+ even if Nativefier uses a very recent version of Chrome | |
| # The following file fixes that temporarily | |
| echo "if (document.body.innerText.replace(/\n/g, ' ').search(/whatsapp works with.*to use whatsapp.*update/i) === 0)" > /tmp/whatsapp-fix.js | |
| echo "navigator.serviceWorker.getRegistration().then(function (r) { r.unregister(); document.location.reload() });" >> /tmp/whatsapp-fix.js | |
| webinstall -n Whatsapp --tray --single-instance --inject /tmp/whatsapp-fix.js web.whatsapp.com | |
| rm /tmp/whatsapp-fix.js | |
| echo "Installing Overleaf..." | |
| webinstall -n Overleaf www.overleaf.com | |
| # echo "Installing Messenger..." | |
| # webinstall -n Messenger --single-instance www.messenger.com | |
| # echo "Installing Teams (Microsoft)" | |
| # wget -O /tmp/icon.png https://luna1.co/cae4f2.png | |
| # webinstall -n Teams --tray --single-instance teams.microsoft.com --internal-urls "(?:http[s]{0,1}\:\/\/)*(teams\.microsoft\.com|login.microsoftonline.com)" --icon /tmp/icon.png | |
| # rm /tmp/icon.png | |
| echo webapps >> ~/.hidden | |
| echo "Webapps installation completed!" | |
| fi # install_webapps | |
| if ((install_docker)) ; then | |
| ### CONFIGURING DOCKER ### | |
| section "Docker configuration..." | |
| sudo usermod -aG docker $USER | |
| sudo systemctl start docker | |
| sudo systemctl enable docker | |
| echo "Docker configured correctly." | |
| echo "Notice however that you must restart your system to use it." | |
| fi # install_docker | |
| if ((install_clion)) ; then | |
| ### INSTALLING CLION ### | |
| section "Installing CLion..." | |
| cd /tmp && wget https://download.jetbrains.com/cpp/CLion-2018.2.6.tar.gz && sudo tar xvzf CLion-*.tar.gz -C /opt/ && cd - > /dev/null | |
| # Asking the user whether he/she wants to run CLion for the first time | |
| echo "Next question has a time limit of 5 seconds:" | |
| run_it=$(confirm_timeout 5 "CLion has been installed, would you like to run it for the first time now?") | |
| if ((run_it)) ; then | |
| sh /opt/clion-*/bin/clion.sh | |
| else | |
| echo 'CLion was not run, to run it the first time use: sh /opt/clion-*/bin/clion.sh' | |
| fi # run_it | |
| fi # install_clion | |
| ### FINALIZING ### | |
| section "Checking if some other updates are necessary..." | |
| sudo apt clean | |
| sudo apt update | |
| sudo apt full-upgrade -y | |
| sudo apt install -f -y | |
| sudo apt autoremove -y | |
| ### ADDITIONAL OPERATIONS ### | |
| echo "Please, set nano as default editor in the following form:" | |
| sudo update-alternatives --config editor | |
| ### Downloading the settings To-Do list ### | |
| section "Downloading the settings To-Do list..." | |
| mkdir -p ~/postinstall | |
| cd /tmp | |
| git clone https://gist.github.com/a19fe3db83b440f578ed2c518fe98eda.git settings | |
| cp settings/* ~/postinstall | |
| rm -r -f settings | |
| cd - > /dev/null | |
| section "Every operation has been completed, check your posinstall directory for any additional operation needed!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment