Last active
December 17, 2015 11:49
-
-
Save alixaxel/5605638 to your computer and use it in GitHub Desktop.
Post-install script for (X)Ubuntu 13.04 (Raring) Desktop Edition
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 | |
| # CC0 License | |
| # http://creativecommons.org/publicdomain/zero/1.0/ | |
| # | |
| # daveBox 0.1.1 (gist.github.com/alixaxel/5605638) | |
| # Copyleft (c) 2013 Alix Axel <[email protected]> | |
| clear && echo -e "\e[1;31mdaveBox 0.1.1\e[0m\n" | |
| if [[ $( whoami ) != "root" ]]; then | |
| echo -e "\e[1;31mIs that you?\e[0m" && exit 1 | |
| fi | |
| if [[ ! -f /etc/debian_version ]]; then | |
| echo -e "\e[1;31mI think you know what the problem is.\e[0m" && exit 1 | |
| else | |
| daveBox_Battery=$( upower --enumerate | grep "battery" ) | |
| daveBox_Codename=$( lsb_release -sc | awk '{ print tolower($0) }' ) | |
| fi | |
| if [[ $daveBox_Codename != "raring" ]]; then | |
| echo -e "\e[1;31mI'm afraid I can't do that.\e[0m" && exit 1 | |
| fi | |
| for daveBox_PPA in linrunner/tlp spotify stebbins/handbrake-releases webupd8team/java webupd8team/sublime-text-2 webupd8team/y-ppa-manager yannubuntu/boot-repair; do | |
| if [[ $daveBox_PPA == "linrunner/tlp" && -z $daveBox_Battery ]]; then | |
| continue | |
| elif [[ $daveBox_PPA == "spotify" ]]; then | |
| if [[ `grep "deb http://repository.spotify.com stable non-free" /etc/apt/sources.list | wc -l` -eq 0 ]]; then | |
| echo -e "deb http://repository.spotify.com stable non-free\n" >> /etc/apt/sources.list | |
| fi | |
| echo -e "\e[1;33mI'm adding the '$daveBox_PPA' repository.\e[0m" && ( apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 94558F59 ) > /dev/null 2>&1 | |
| else | |
| echo -e "\e[1;33mI'm adding the '$daveBox_PPA' PPA.\e[0m" && ( add-apt-repository -y ppa:$daveBox_PPA ) > /dev/null 2>&1 | |
| fi | |
| done | |
| echo -e "\e[1;33mI'm updating the repositories...\e[0m" && ( apt-get -qq -y update && apt-get -qq -y upgrade ) > /dev/null 2>&1 | |
| for daveBox_package in brltty gnome-orca ttf-indic-fonts-core ttf-punjabi-fonts unity-lens-friends unity-lens-gwibber unity-lens-help unity-lens-music unity-lens-photos unity-lens-radios unity-lens-shopping unity-lens-video; do | |
| echo -e "\e[1;33mI'm removing '$daveBox_package'.\e[0m" && ( apt-get -qq -y purge $daveBox_package ) > /dev/null | |
| done | |
| for daveBox_package in android-tools-* bleachbit boot-repair build-essential calibre chromium-browser curl deja-dup filezilla flashplugin-installer fslint gdmap geany gimp git-core gparted gufw handbrake htop libreoffice meld midori mysql-workbench namebench nano oracle-java7 pinta preload python-dev python-pip spotify-client sqlite3 sqliteman sublime-text tlp ubuntu-restricted-extras undistract-me units vlc y-ppa-manager zram-config; do | |
| if [[ $daveBox_package == "tlp" && -z $daveBox_Battery ]]; then | |
| continue | |
| fi | |
| echo -e "\e[1;33mI'm installing '$daveBox_package'.\e[0m" | |
| if [[ $daveBox_package == "calibre" ]]; then | |
| ( apt-get -qq -y install calibre ) > /dev/null 2>&1 | |
| elif [[ $daveBox_package == "handbrake" ]]; then | |
| ( apt-get -qq -y install handbrake-cli handbrake-gtk ) > /dev/null 2>&1 | |
| elif [[ $daveBox_package == "libreoffice" ]]; then | |
| ( apt-get -qq -y install libreoffice-calc libreoffice-writer ) > /dev/null | |
| elif [[ $daveBox_package == "oracle-java7" ]]; then | |
| if [[ -f /usr/bin/debconf-set-selections ]]; then | |
| ( echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections ) > /dev/null | |
| fi | |
| ( apt-get -qq -y purge "^openjdk*" && apt-get -qq -y install oracle-java7-installer oracle-java7-set-default ) > /dev/null | |
| elif [[ $daveBox_package == "tlp" ]]; then | |
| echo -e "\e[1;33mI'm starting 'tlp'.\e[0m" && ( apt-get -qq -y purge tlp && apt-get -qq -y install tlp tlp-rdw && tlp start ) > /dev/null | |
| elif [[ $daveBox_package == "ubuntu-restricted-extras" ]]; then | |
| if [[ -f /usr/bin/debconf-set-selections ]]; then | |
| ( echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections ) > /dev/null | |
| fi | |
| ( apt-get -qq -y install ubuntu-restricted-extras ) > /dev/null 2>&1 | |
| elif [[ $daveBox_package == "zram-config" ]]; then | |
| ( apt-get -qq -y install zram-config ) > /dev/null | |
| else | |
| ( apt-get -qq -y install $daveBox_package ) > /dev/null | |
| fi | |
| done | |
| if [[ -f /etc/sysctl.conf ]]; then | |
| echo -e "\e[1;33mI'm decreasing 'vm.swappiness' to 10.\e[0m" && ( sysctl -w vm.swappiness=10 ) > /dev/null | |
| echo -e "\e[1;33mI'm decreasing 'vm.vfs_cache_pressure' to 50.\e[0m" && ( sysctl -w vm.vfs_cache_pressure=50 ) > /dev/null | |
| if [[ `grep "vm.swappiness=" /etc/sysctl.conf | wc -l` -eq 0 ]]; then | |
| echo "vm.swappiness=60" >> /etc/sysctl.conf | |
| fi | |
| if [[ `grep "vm.vfs_cache_pressure=" /etc/sysctl.conf | wc -l` -eq 0 ]]; then | |
| echo "vm.vfs_cache_pressure=100" >> /etc/sysctl.conf | |
| fi | |
| ( sed -i -r 's~^vm.swappiness[[:blank:]]*=[[:blank:]]*[0-9]*$~vm.swappiness=10~' /etc/sysctl.conf ) | |
| ( sed -i -r 's~^vm.vfs_cache_pressure[[:blank:]]*=[[:blank:]]*[0-9]*$~vm.vfs_cache_pressure=50~' /etc/sysctl.conf ) | |
| fi | |
| if [[ -f /etc/default/grub ]]; then | |
| echo -e "\e[1;33mI'm decreasing 'GRUB_TIMEOUT' to 3.\e[0m" && ( sed -i -r 's~^GRUB_TIMEOUT=[0-9]*$~GRUB_TIMEOUT=3~' /etc/default/grub && update-grub ) > /dev/null 2>&1 | |
| fi | |
| if [[ -f /etc/default/apport ]]; then | |
| echo -e "\e[1;33mI'm disabling 'apport'.\e[0m" && ( sed -i -r 's~^enabled=1$~enabled=0~' /etc/default/apport ) | |
| fi | |
| if [[ -f /etc/initramfs-tools/conf.d/resume ]]; then | |
| echo -e "\e[1;33mI'm disabling 'kinit'.\e[0m" && ( sed -i -r 's~^#?RESUME=~#RESUME=~' /etc/initramfs-tools/conf.d/resume ) | |
| fi | |
| if [[ -f /etc/default/console-setup ]]; then | |
| ( sed -i -r 's~^ACTIVE_CONSOLES="/dev/tty[[]1-[0-9]+[]]"~ACTIVE_CONSOLES="/dev/tty[1-3]"~' /etc/default/console-setup ) | |
| for daveBox_tty in /etc/init/tty*.conf; do | |
| if [[ ${daveBox_tty:13:1} -gt 3 ]]; then | |
| echo -e "\e[1;33mI'm removing the TTY '$daveBox_tty'.\e[0m" && ( rm $daveBox_tty ) | |
| fi | |
| done | |
| fi | |
| if [[ $DESKTOP_SESSION != "xubuntu" && $( type -P gsettings ) ]]; then | |
| echo -e "\e[1;33mI'm disabling the overlay scrollbar.\e[0m" && ( gsettings set com.canonical.desktop.interface scrollbar-mode normal ) | |
| fi | |
| for daveBox_service in apport bluetooth saned; do | |
| echo -e "\e[1;33mI'm removing the '$daveBox_service' service.\e[0m" && ( update-rc.d -f $daveBox_service remove ) > /dev/null | |
| done | |
| while read daveBox_partition; do | |
| if [[ "$daveBox_partition" =~ sd.$ ]]; then | |
| daveBox_device=${daveBox_partition:${#daveBox_partition} - 3} | |
| if [[ `hdparm -I /dev/$daveBox_device | grep "TRIM supported"` ]]; then | |
| echo -e "\e[1;31mYour '/dev/$daveBox_device' device seems to support TRIM, see //goo.gl/tmHgkC and //wiki.debian.org/SSDOptimization.\e[0m" | |
| fi | |
| fi | |
| done < /proc/partitions | |
| echo -e "\e[1;33mI'm cleaning up...\e[0m" && ( apt-get -qq -y upgrade && apt-get -qq -y autoremove && apt-get -qq -y autoclean ) && exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
What it Does
Post-install script for (X)Ubuntu 13.04 (Raring) Desktop edition.
It installs and removes a bunch of software (see below) according to my preference.
Some of the installed packages (
preload,zram-config) will usually give your Ubuntu setup a speed boost.The remaining packages are either must-haves, small utilities or software I use for (Android + Python) development.
Additionally, some tweaks are performed (should work for the best if you have a decent(ish) system):
kinit(sleep & hibernate) is disabledoverlaytonormalGRUB_TIMEOUTis decreased from the default value of10to3vm.swappinessis decreased from the default value of60to10vm.vfs_cache_pressureis decreased from the default value of100to50apport(error reporting),bluetoothandsaned(scanner sharing) services are disabled6to2Feel free to fork this script and adapt it to your needs. For a server version, check out halBox.
What it Does Not Do
Removed Packages
brlttygnome-orcaopenjdk*ttf-indic-fonts-corettf-punjabi-fontsunity-lens-friendsunity-lens-gwibberunity-lens-helpunity-lens-musicunity-lens-photosunity-lens-radiosunity-lens-shoppingunity-lens-videoInstalled Packages
android-tools-*bleachbitbuild-essentialchromium-browsercurldeja-dupfilezillaflashplugin-installerfslintgdmapgeanygimpgit-coregufwhtoplibreofficemeldmidorimysql-workbenchnamebenchnanooracle-java7pintapreloadpython-dev+python-pipspotify-clientsqlite3sqlitemansublime-texttlp(only if you have a battery)ubuntu-restricted-extrasundistract-meunitsvlcy-ppa-managerzram-config