Le script ci-après complète une installation standard d’Ubuntu avec les applications que j’utilise régulièrement.
Syntaxe:
sudo bash install.sh [options]
Sans options d’exécution, uniquement les applications communes à toutes les architectures sont installées. Il est toutefois possible de compléter l’installation des modules communs par le truchement des options suivantes:
| Options | |
--nocommon |
N’installe pas les applications communes à toutes les architectures. |
--noupdate |
N’effectue pas le nettoyage et la mise à jour de la liste des packages (apt). |
--dev |
Installe les applications communes ainsi que les outils de développement |
-x, --xps |
Installe les applications communes, les outils de développement ainsi que certaines applications spécifiques pour un PC Dell XPS. |
-h, --help |
Affiche l’aide et quitte. |
#!/bin/bash
# -*- coding: utf-8 -*-
##
# =============================================================================
# Script for full system installation
#
# Author : Pascal Rapaz
# Version: 1.0.0
# Date : 15.05.2010 Creation
#
# License: GPL-2+
# This package 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 2 of the License, or
# (at your option) any later version.
#
# This package 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.
#
# If you need the GNU General Public License write to:
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
# (c) 2008-2009, Pascal Rapaz (RapazP - pascal.rapaz@rapazp.ch)
# =============================================================================
##
UBUNTU_NAME=lucid
RED="\033[1;31m%10s %s\033[0m\n"
GREEN="\033[1;32m%10s %s\033[0m\n"
BLUE="\033[1;34m%10s %s\033[0m\n"
# execute the installation script
function launchInstall
{
_isSuperUser
printf "$BLUE" "[START]" "Installation script"
if [ "$update" = "y" ]; then
_aptList
_update
fi
if [ "$common" = "y" ]; then
common
fi
if [ "$development" = "y" ]; then
development
fi
if [ "$xps" = "y" ]; then
xps
fi
if [ "$update" = "y" ]; then
_clean
fi
printf "$BLUE" "[END]" "Installation script"
}
# install common applications for all systems
function common
{
# internet
printf "$GREEN" "[INSTALL]" "Internet applications"
apt-get -y install thunderbird amule xchat flashplugin-nonfree chromium-browser
printf "$GREEN" "[INSTALL]" "Office applications"
apt-get -y install openoffice.org-java-common alexandria
# photo
printf "$GREEN" "[INSTALL]" "Image manipulation"
apt-get -y install geeqie gthumb inkscape
# audio
printf "$GREEN" "[INSTALL]" "Audio manipulation"
apt-get -y install audacious audacious-plugins audacious-plugins-extra lame audacity easytag normalize-audio banshee sound-juicer
# video and graphics
printf "$GREEN" "[INSTALL]" "Video manipulation and graphics tools"
apt-get -y install vlc mplayer mencoder ffmpeg compiz compiz-fusion-bcop compizconfig-settings-manager compiz-fusion-plugins-extra compiz-fusion-plugins-main
# video codecs
printf "$GREEN" "[INSTALL]" "Video codecs"
apt-get -y install gstreamer0.10-ffmpeg gstreamer0.10-plugins-ugly gstreamer0.10-plugins-bad
# network
printf "$GREEN" "[INSTALL]" "Network application"
apt-get -y install samba smbfs ssh gnome-rdp vinagre vino
# archive manager
printf "$GREEN" "[INSTALL]" "Archive manager"
apt-get -y install unace rar p7zip-full
# compiz
printf "$GREEN" "[INSTALL]" "Miscalenous"
apt-get -y install tomboy grsync purrr cvs asciidoc fop gparted fslint alexandria python-wxgtk2.8 vim grub2-splashimages htop comixcursors google-gadgets-gtk
printf "$BLUE" "[INFO]" "Following applications must be added manually:"
printf "$BLUE" "" "ubuntu-tweak DBVisualizer Eclipse Jajuk Opera Nero VirtualBox Xaraxtreme Zattoo"
}
# install particular applications for XPS
function xps
{
# G15 LCD
printf "$GREEN" "[INSTALL]" "Logitech G15 LCD screen"
apt-get -y install g15composer g15daemon g15daemon-audacious g15stats
}
# install applications for development
function development
{
# dev
printf "$GREEN" "[INSTALL]" "Development"
apt-get -y install sun-java6-jdk sun-java6-plugin meld python-pyexiv2 glade libbluetooth-dev bluefish
# debian packages
printf "$GREEN" "[INSTALL]" "Tools for debian packages creation"
apt-get -y install build-essential dpkg-dev debhelper devscripts fakeroot alien
# network security
printf "$GREEN" "[INSTALL]" "Network security"
apt-get -y install aircrack-ng kismet zenmap
# language
printf "$GREEN" "[INSTALL]" "Language support"
apt-get -y install manpages-fr-extra manpages-fr-dev
}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Packages management
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# create apt list for specific applications
function _aptList
{
printf "$GREEN" "[INFO]" "create list file for specific repositories then get gpg signature"
# Banshee
FILE=/etc/apt/sources.list.d/banshee.list
printf "$GREEN" "[ADD]" "Banshee repository"
echo deb http://ppa.launchpad.net/banshee-team/banshee-unstable/ubuntu $UBUNTU_NAME main > $FILE
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6E80C6B7
# Bluefish
FILE=/etc/apt/sources.list.d/bluefish.list
printf "$GREEN" "[ADD]" "Bluefish repository"
echo deb http://debian.wgdd.de/ubuntu jaunty main restricted universe multiverse > $FILE
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0F719C35E394D996
# Alexandria
FILE=/etc/apt/sources.list.d/alexandria.list
printf "$GREEN" "[ADD]" "Alexandria repository"
echo deb http://ppa.launchpad.net/alexandria-team/ppa/ubuntu $UBUNTU_NAME main
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 929E5EC4
}
# update repository
function _update
{
printf "$GREEN" "[CLEAN]" "update packages list"
apt-get update
}
# clean repository
function _clean
{
printf "$GREEN" "[CLEAN]" "Remove packages there is no longer requiered"
apt-get -y autoremove
}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Helper functions
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Check if user are in su mode
function _isSuperUser
{
# Test if you're in super-user mode
if [ ! `id -u` -eq 0 ]
then
printf "$RED" "[ERROR]" "You must have root privileges to run this command!"
exit 1
fi
}
# print help
function usage
{
echo
echo "Usage: sudo bash install.sh [OPTION] "
echo "Complete the ubuntu standard installation with custom applications"
echo "Without any options, install only common applications"
echo
echo " Parameters:"
echo " --nocommon Don't install common applications"
echo " --noupdate Don't update or clean apt package list"
echo " --dev Install common and development applications"
echo " -x, --xps Install common, development and XPS specific applications"
echo
echo " -h, --help Display this help then quit"
}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Launch part
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# retrieve command parameters
common=y
update=y
while [ "$1" != "" ]; do
case $1 in
--nocommon ) common=n
;;
--noupdate ) update=n
;;
--dev ) development=y
;;
-x | --xps ) xps=y
development=y
;;
-h | --help ) usage
exit
;;
esac
shift
done
launchInstall