#!/bin/bash # Script which should help users install / tweak some stuff immediately # after installing Ubuntu 10.04 Lucid Lynx 32bit and 64bit. # # version 0.4 # # ## ## Copyright (C) 2010 Alin Andrei, http://www.webupd8.org ## ## This program is free software: you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 3 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program. If not, see . # #Options explainations: #Move window buttons to the right (Karmic style) - will move the metacity window buttons to the right side, in the following order: Minimize, Maximize, Close #Fix the Update Manager - will modify the Update Manager behavior so it doesn't autolaunch once a week. Instead, the Update Manager will show any available updates all the time in the notification area but will not popup any window automatically. This is the behavior Ubuntu used to have until Karmic. #Remove mounted drive icons from desktop - removes ntfs and usb drives from the desktop; usually when mounting a drive it shows up on the desktop #Disable the GDM login sound - all the sounds in Ubuntu can be turned off from a GUI except this one. This is the sound produced when the GDM login screen loads. #Enable the icons in menus and buttons - the icons in menus and buttons were removed in Gnome 2.28 (starting with Ubuntu Karmic). However, up until Lucid, users were able to enable these from the Appearence dialog preferences. This is no longer possible so use this tweak instead. #Disable the GDM login user list - in Lucid, the users are displayed in the GDM login screen (which IMO is a security concern). This fix will make no user show up in this list, and for logging in you must enter your username and password manually. #Fix 'apt-get update' delay for Google Chrome repository - when downloading Google Chrome .deb, it automatically adds the Google Chrome repository. This repository has a known issue which cause "sudo apt-get update" to take a very long time to complete. This tweak fixes this issue. #Add additional repositories (GetDeb, Medibuntu etc.) - Adds the following repositories: Getdeb, Medibuntu, Ubuntu universe and multiverse and lucid partner. #The second dialog - you already know what it does: installs the packages you select. #check if the user is running lucid 32 or 64bit if [ "lucid" = `lsb_release -cs` ]; then if [ "i686" = `uname -m` ]; then echo using Ubuntu 10.04 Lucid Lynx - ok elif [ "x86_64" = `uname -m` ]; then echo using Ubuntu 10.04 Lucid Lynx - ok else /usr/bin/zenity --warning --title="Error" --text="Error: You are not using Ubuntu 10.04 Lucid Lynx 32bit or 64bit" echo You are not using Ubuntu 10.04 Lucid Lynx 32bit or 64bit, exiting exit fi else /usr/bin/zenity --warning --title="Error" --text="Error: You are not using Ubuntu 10.04 Lucid Lynx" echo You are not using Ubuntu 10.04 Lucid Lynx, exiting exit fi # Need sudo privileges ROOT_UID=0 if [ "$UID" -ne "$ROOT_UID" ] then /usr/bin/zenity --warning --title="Error" --text="You must have sudo privileges to run this script. Try: sudo ./ubuntu-10.04-start-script_v0.4" echo "Exiting ... please run the script with sudo (eg: sudo ./ubuntu-10.04-start-script_v0.4)" exit fi #running gconf-tool with "sudo" fails to set the options for the current user so this tweak makes it possible to run sudo for gconf-tool2 and change the setting for the current user, not the root user ON_USER=$(cat /etc/passwd | grep :1000: | cut -d ':' -f 1) export $(grep -v "^#" ~/.dbus/session-bus/`cat /var/lib/dbus/machine-id`-0) if sudo -u $ON_USER test -z "$DBUS_SESSION_BUS_ADDRESS" ; then eval `sudo -u $ON_USER dbus-launch --sh-syntax --exit-with-session` fi echo $ON_USER echo $DBUS_SESSION echo $DBUS_SESSION_BUS_ADDRESS echo $DBUS_SESSION_BUS_WINDOWID echo $DBUS_SESSION_BUS_PID /usr/bin/zenity --info --text="Notice: if you do not select the 'Add additional repositories' option, you will not be able to install some packages in Step 2" choicess=`/usr/bin/zenity --title="Step 1: Tweaks, Fixes And Repos" --width=420 --height=400 \ --text="Select:" \ --list --column="Selected" --column="Tweak" \ --checklist FALSE "Move window buttons to the right (Karmic style)" FALSE "Fix the Update Manager" FALSE "Remove mounted drive icons from desktop" FALSE "Disable the GDM login sound" FALSE "Enable the icons in menus and buttons" FALSE "Disable the GDM login user list" TRUE "Fix 'apt-get update' delay for Google Chrome repository" TRUE "Add additional repositories (GetDeb, Medibuntu etc.)"` if [ $? -eq 0 ] then IFS="|" for choicee in $choicess do if [ "$choicee" = "Move window buttons to the right (Karmic style)" ]; then sudo -u $ON_USER "DBUS_SESSION_BUS_ADDRESS="$DBUS_SESSION_BUS_ADDRESS gconftool-2 --type string --set /apps/metacity/general/button_layout ":minimize,maximize,close" elif [ "$choicee" = "Fix the Update Manager" ] then sudo -u $ON_USER "DBUS_SESSION_BUS_ADDRESS="$DBUS_SESSION_BUS_ADDRESS gconftool -s --type bool /apps/update-notifier/auto_launch false elif [ "$choicee" = "Remove mounted drive icons from desktop" ] then sudo -u $ON_USER "DBUS_SESSION_BUS_ADDRESS="$DBUS_SESSION_BUS_ADDRESS gconftool -s --type bool /apps/nautilus/desktop/volumes_visible false elif [ "$choicee" = "Disable the GDM login sound" ] then sudo -u gdm gconftool-2 --set /desktop/gnome/sound/event_sounds --type bool false sudo -u $ON_USER "DBUS_SESSION_BUS_ADDRESS="$DBUS_SESSION_BUS_ADDRESS gconftool-2 --set /desktop/gnome/sound/event_sounds --type bool false elif [ "$choicee" = "Enable the icons in menus and buttons" ] then sudo -u $ON_USER "DBUS_SESSION_BUS_ADDRESS="$DBUS_SESSION_BUS_ADDRESS gconftool-2 --set /desktop/gnome/interface/buttons_have_icons --type bool true sudo -u $ON_USER "DBUS_SESSION_BUS_ADDRESS="$DBUS_SESSION_BUS_ADDRESS gconftool-2 --set /desktop/gnome/interface/menus_have_icons --type bool true elif [ "$choicee" = "Disable the GDM login user list" ] then sudo -u gdm gconftool-2 --set --type boolean /apps/gdm/simple-greeter/disable_user_list true elif [ "$choicee" = "Fix 'apt-get update' delay for Google Chrome repository" ] then echo "Acquire::http::Pipeline-Depth "0";" | sudo tee -a /etc/apt/apt.conf.d/90localsettings elif [ "$choicee" = "Add additional repositories (GetDeb, Medibuntu etc.)" ]; then sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup cat /etc/apt/sources.list_backup | sudo sed -e 's/.*main restricted$//g' > /etc/apt/sources.list #delete the ubuntu default repositories (only if they were not altered in which case we will check existing repos below) to avoid multiple identical repos ARRAY=( 'deb http://archive.ubuntu.com/ubuntu/ lucid main restricted universe multiverse' 'deb-src http://archive.ubuntu.com/ubuntu/ lucid main restricted universe multiverse' 'deb http://archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse' 'deb-src http://archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse' 'deb http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse' 'deb-src http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse' 'deb http://archive.canonical.com/ubuntu lucid partner' 'deb-src http://archive.canonical.com/ubuntu lucid partner' 'deb http://security.ubuntu.com/ubuntu lucid-security main restricted universe multiverse' 'deb-src http://security.ubuntu.com/ubuntu lucid-security main restricted universe multiverse' 'deb http://packages.medibuntu.org/ lucid free non-free' 'deb-src http://packages.medibuntu.org/ lucid free non-free' 'deb http://archive.getdeb.net/ubuntu lucid-getdeb apps' ) ELEMENTS=${#ARRAY[@]} for (( i=0;i<$ELEMENTS;i++)); do repos=`cat /etc/apt/sources.list | grep "${ARRAY[${i}]}"` if [ $? -eq 0 ] then echo "${ARRAY[${i}]}" already exists, skipping else echo "${ARRAY[${i}]}" | sudo tee -a /etc/apt/sources.list > /dev/null # add all the repositories which are not in the sources.list file already fi done wget -q http://packages.medibuntu.org/medibuntu-key.gpg -O- | sudo apt-key add - wget -O- http://archive.getdeb.net/getdeb-archive.key | sudo apt-key add - sudo apt-get update fi done IFS="" /usr/bin/zenity --info --text="Done! We will now proceed to step 2" else echo cancel selected fi choices=`/usr/bin/zenity --title="Step 2: Install packages" --width=520 --height=400 \ --text="Choose packages to install:" \ --list --column="Selected" --column="Package" \ --checklist TRUE "gimp" TRUE "pidgin" TRUE "wine" TRUE "chromium-browser" TRUE "gnome-do" TRUE "vlc" TRUE "mplayer" TRUE "thunderbird" TRUE "Codecs (multimedia, java, flash), additional archives support and fonts" TRUE "ubuntu-tweak" TRUE "dropbox" TRUE "CompizConfig Settings Manager" TRUE "Skype" TRUE "Google Chrome" FALSE "Development tools (from build-essential to Subversion and GIT)"` if [ $? -eq 0 ] then IFS="|" for choice in $choices do if [ "$choice" = "Codecs (multimedia, java, flash), additional archives support and fonts" ]; # sudo apt-get install "$choice" then if [ "i686" = `uname -m` ]; then sudo echo sun-java6-jre shared/accepted-sun-dlj-v1-1 select true | sudo /usr/bin/debconf-set-selections sudo apt-get install --yes sun-java6-plugin sudo apt-get -y --force-yes install gstreamer0.10-ffmpeg gstreamer0.10-pitfdll gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse libdvdnav4 libdvdread4 libdvdcss2 libxine1-ffmpeg ffmpeg w32codecs flashplugin-nonfree sun-java6-fonts rar unrar p7zip-full p7zip-rar unace unp ttf-mscorefonts-installer ttf-liberation else sudo echo sun-java6-jre shared/accepted-sun-dlj-v1-1 select true | sudo /usr/bin/debconf-set-selections sudo apt-get install --yes sun-java6-plugin sudo apt-get -y --force-yes install gstreamer0.10-ffmpeg gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse libdvdnav4 libdvdread4 libdvdcss2 libxine1-ffmpeg ffmpeg w64codecs sun-java6-fonts rar unrar p7zip-full p7zip-rar unace unp ttf-mscorefonts-installer ttf-liberation cd /tmp wget http://download.macromedia.com/pub/labs/flashplayer10/libflashplayer-10.0.45.2.linux-x86_64.so.tar.gz tar xzf libflashplayer-10.0.45.2.linux-x86_64.so.tar.gz sudo mv libflashplayer.so /usr/lib/mozilla/plugins rm libflashplayer-10.0.45.2.linux-x86_64.so.tar.gz fi elif [ "$choice" = "Google Chrome" ]; then cd /tmp if [ "i686" = `uname -m` ]; then wget http://dl.google.com/linux/direct/google-chrome-unstable_current_i386.deb sudo dpkg -i --force-all google-chrome-unstable_current_i386.deb sudo apt-get install -f -y rm google-chrome-unstable_current_i386.deb else wget http://dl.google.com/linux/direct/google-chrome-unstable_current_amd64.deb sudo dpkg -i --force-all google-chrome-unstable_current_amd64.deb sudo apt-get install -f -y rm google-chrome-unstable_current_amd64.deb fi elif [ "$choice" = "Skype" ]; then cd /tmp if [ "i686" = `uname -m` ]; then wget http://download.skype.com/linux/skype-ubuntu-intrepid_2.1.0.81-1_i386.deb sudo dpkg -i --force-all skype-ubuntu-intrepid_2.1.0.81-1_i386.deb sudo apt-get install -f -y rm skype-ubuntu-intrepid_2.1.0.81-1_i386.deb else wget http://download.skype.com/linux/skype-ubuntu-intrepid_2.1.0.81-1_amd64.deb sudo dpkg -i --force-all skype-ubuntu-intrepid_2.1.0.81-1_amd64.deb sudo apt-get install -f -y rm skype-ubuntu-intrepid_2.1.0.81-1_amd64.deb fi elif [ "$choice" = "Development tools (from build-essential to Subversion and GIT)" ]; then sudo apt-get -y --force-yes install build-essential automake make checkinstall devscripts patch dpatch patchutils autotools-dev debhelper quilt fakeroot xutils lintian pbuilder cmake dh-make libtool autoconf git-core subversion elif [ "$choice" = "dropbox" ]; then reposs=`cat /etc/apt/sources.list | grep "dropbox"` if [ $? -eq 0 ] then echo Dropbox repository already exists, skipping repository add sudo apt-get update sudo apt-get -y --force-yes install nautilus-dropbox else echo "deb http://linux.dropbox.com/ubuntu karmic main" | sudo tee -a /etc/apt/sources.list > /dev/null sudo gpg --keyserver pgp.mit.edu --recv-keys 3565780E sudo apt-get update sudo apt-get -y --force-yes install nautilus-dropbox fi elif [ "$choice" = "CompizConfig Settings Manager" ]; then sudo apt-get -y --force-yes install compizconfig-settings-manager else sudo apt-get -y --force-yes install $choice fi done IFS="" /usr/bin/zenity --info --text="Done! All the selected packages have been installed" else echo cancel selected fi #changelog #v0.4 #added Skype 32bit and 64bit download & install #sudo check: the script exists if it is not run as sudo #install compizconfig-settings-manager #show dialog when going from step 1 to step 2 and show "Done" dialog when all the packages in step 2 have been installed #fixed 'disable GDM login sound' #v0.3 #added gnome-do #Remove drive icons from desktop gconf tweak #fix Google Chrome repository slowness for "apt-get update" #some other fixes #v0.2: #added autoaccept for the java license when installing the java plugin #added dropbox repository and installation #added disable GDM login user list #added build-essential, subversion, git, etc