#!/bin/sh # 23/02/07 - English version. Original is at # http://nicofo.tuxfamily.org/scripts/xgl/installXGL # 20/01/07 - version 1 # 06/02/07 - version 2 Mis à jour pour pouvoir faire des updates # 08/03/07 - version 3 Possibilité de désinstaller # 01/04/07 - version 4 Architectures x86_64 # # nicofo - http://nicofo.tuxfamily.org # # installation et configuration automatique de xgl et compiz pour GNOME, KDE et XFCE testRoot() { if [ $(id -u) -ne 0 ]; then echo -e "The installation and configuration of XGL must be run as \033[1mroot\033[0m." exit 1 fi } #RPM à installer (en fonction de l'architecture) : if [ "$(rpm -q --qf '%{ARCH}\n' kernel | tail -1)" = "x86_64" ]; then ARCH="64" site="http://fedoraxgl.tuxfamily.org/repository/5/x86_64/" RPM=" compiz-1.0.0-4.x86_64.rpm fedora-xgl-settings-0.0.1-2.noarch.rpm gset-compiz-0.3.3-1.x86_64.rpm libsvg-0.1.4-1.x86_64.rpm libsvg-cairo-0.1.6-1.x86_64.rpm xgl-hardware-list-1.0.0-2.noarch.rpm xorg-x11-server-Xgl-1.1.99.1-3.x86_64.rpm" else ARCH="32" site="http://fedoraxgl.tuxfamily.org/repository/5/i386" RPM=" compiz-1.0.0-5.i386.rpm fedora-xgl-settings-0.0.1-2.noarch.rpm gset-compiz-0.3.3-1.i386.rpm libsvg-0.1.4-1.i386.rpm libsvg-cairo-0.1.6-1.i386.rpm xgl-hardware-list-1.0.0-2.noarch.rpm xorg-x11-server-Xgl-1.1.99.1-3.i386.rpm" fi if [ $# -ge 1 ]; then if [ $1 = "-r" ] || [ $1 = "--remove" ]; then testRoot #Déconfigurer XGL : echo -e "\033[1;34m1) Remove configuration files...\033[0m " wget http://nicofo.tuxfamily.org/scripts/xgl/xgl-settings_FC5.tar.gz -O xgl-settings_FC5.tar.gz tar -xzf xgl-settings_FC5.tar.gz configureXgl sh configureXgl -r rm -f configureXgl xgl-settings_FC5.tar.gz #Supprimer les RPM installés : echo -e "\n\033[1;34m2) Uninstall XGL...\033[0m" RPM_R=$(echo "$RPM"|sed "s/-[0-9\.]\+-.*rpm$//") rpm -e $RPM_R rpm -e fedora-xgl-repository if [ -z "$(rpm -e glitz-glx glitz --test)" ]; then rpm -e glitz-glx glitz fi #Supprimer Beryl : if [ -f /usr/bin/beryl ]; then echo -en "\033[1;34m3) Do you want to remove Beryl as well [y/N] ?\033[0m" read res if [ "$res" == "y" ] || [ "$res" == "Y" ] ;then yum remove beryl\* fi fi echo -e "\n\033[1mUninstallation finished.\033[0m" else echo "Usage:" echo " installXGL install and configure XGL and compiz," echo " installXGL -r|--remove uninstall XGL and compiz." fi exit 0 fi testRoot texte=( "Installation of the XGL repository" "Removal of the current version of compiz" "Installation of XGL and compiz" "Configuration of XGL for compiz and beryl" ) N=${#texte[*]} #nombre total d'étapes = nombre d'éléments dans $texte (ou : ${#texte[@]}) n=0 #étape actuelle (à partir de 0) #$etat = status de l'étape précédente #0=OK ; autre=KO ; -1=STOP ; -2=so (sans objet) etat=0 erreur="" avant="\033[2m" actuel="\033[1;5;33;42m" apres="\033[1;34m" normal="\033[m" ok="\033[1;32m[ OK ]\033[0m" ko="\033[1;31m[ KO ]\033[0m" so="\033[1;36m[Alrdy done]\033[0m" stop() { echo echo -e "\033[31m$erreur\033[0m" read -p "Installation cannot continue. Do you want to continue anyway [y/N] ? " res if [ ! "$res" == "y" ] && [ ! "$res" == "Y" ] ;then exit $n fi echo etat=0 erreur="" } menu() { #status : 0=OK ; autre=KO ; -1=STOP ; -2=so (sans objet) if [ $n -gt 0 ]; then status[$((n-1))]=$etat fi if [ $etat -eq -1 ]; then stop fi clear for i in $(seq 0 $(($N-1))); do if [ $i -lt $n ]; then echo -en $avant elif [ $i -eq $n ]; then echo -en $actuel else echo -en $apres fi echo -n "$(($i+1))) ${texte[$i]}" if [ $i -lt $n ]; then echo -en "\033[500C\033[15D$normal" #fin ligne if [ ${status[$i]} -eq 0 ]; then echo -e "$ok" elif [ ${status[$i]} -eq -2 ]; then echo -e "$so" else echo -e "$ko" fi else echo -e "$normal" fi done n=$(($n+1)) echo ; echo erreur="" etat=0 } #Installation du dépôt 'fedora-xgl' (pour les mises à jour p. ex.) menu if [ "$(rpm -q fedora-xgl-repository)" = "fedora-xgl-repository-1.0-3" ]; then etat=-2 else rpm -Uhv http://fedoraxgl.tuxfamily.org/repository/fedora-xgl-repository-1.0-3.noarch.rpm etat=$? sed -i "s#\$releasever#5#g" /etc/yum.repos.d/fedora-xgl.repo fi #Désinstallation de la version actuelle de compiz menu tmp=$(rpm -q compiz) if [ $? -ne 0 ] || [ -n "$(echo $tmp|grep "^compiz-1.0.0-[45]$")" ] ; then etat=-2 else rpm -e compiz if [ $? -ne 0 ]; then etat=-1; erreur="Cannot remove the current version of compiz." fi fi #Installation de XGL et compiz menu if [ -n "$(rpm -q compiz|grep "^compiz-1.0.0-[45]$")" ] \ && [ "$(rpm -q xorg-x11-server-Xgl)" = "xorg-x11-server-Xgl-1.1.99.1-3" ]; then etat=-2 else #installation : yum -y install glitz-glx if [ $? -ne 0 ]; then erreur="Error while installing the dependencies (glitz-glx) of XGL." stop fi for file in $RPM; do wget $site/$file -c if [ ! -f ${file} ]; then erreur="Error while downloading '$site/$file'." stop break fi done rpm -Uhv $RPM --test >/dev/null 2>&1 if [ $? -eq 0 ]; then rpm -Uhv $RPM installOK=$? else echo -e "\n\n\033[1;34mDependencies are needed to install XGL:\033[0m" rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-AL-CAPCOM yum install $RPM if [ -n "$(rpm -q compiz|grep "^compiz-1.0.0-[45]$")" ] \ && [ "$(rpm -q xorg-x11-server-Xgl)" = "xorg-x11-server-Xgl-1.1.99.1-3" ]; then installOK=0 else installOK=1 fi fi if [ $installOK -ne 0 ] ; then etat=-1 erreur="Error at the installation of the RPM of XGL and compiz." else rm -f $RPM if [ $ARCH = "64" ]; then mkdir /usr/lib/compiz #sinon bug avec gset-compiz fi fi fi #Configuration de XGL pour compiz et beryl menu wget http://nicofo.tuxfamily.org/scripts/xgl/xgl-settings_FC5.tar.gz -O xgl-settings_FC5.tar.gz if [ ! -s xgl-settings_FC5.tar.gz ]; then erreur="Error while downloading 'http://nicofo.tuxfamily.org/scripts/xgl/xgl-settings_FC5.tar.gz'." etat=-1 else tar -xzf xgl-settings_FC5.tar.gz #traduction en anglais de 'chooseCompositeWM' FR=( "texte=(.*)" "Gestionnaire de fenêtres avec XGL" "Quel gestionnaire de fenêtres voulez-vous avec XGL ?" "--column=\"Gestionnaire de fenêtres\"" "Beryl n'est pas installé.*yum :" "Voulez-vous appliquer la.*session." "La modification aura lieu au prochain démarrage de votre session." ) EN=( "texte=(\"Compiz\" \"Beryl (with beryl-manager)\" \"Beryl (without beryl-manager)\" \"(No composite window manager)\")" "Composite window manager with XGL" "Which composite window manager do you want with XGL ?" "--column=\"Window manager\"" "Beryl is not installed ! \\\nYou can install it using yum:" "Do you want to apply the modification now ?\\\n\\\nOtherwise, the modification will take place with the next starting of your session." "The modification will take place with the next starting of your session." ) i=0 for fr in "${FR[@]}"; do # echo "$fr -> ${EN[$i]}" sed -i "s/$fr/${EN[$i]}/" chooseCompositeWM i=$(($i+1)) done ./configureXgl if [ $? -ne 0 ]; then etat=-1; fi rm -f xgl-settings_FC5.tar.gz $(tar -tf xgl-settings_FC5.tar.gz) fi #Fin menu if [ ! -f /usr/bin/beryl ]; then echo -e "\033[1;34m -------INFO-------------------------------------------------------------" echo -e " \033[1mCompiz\033[0;34m has been installed. But you can also install \033[1mBeryl\033[0;34m with yum :\n\t\033[1;47;30myum install beryl\033[0m" echo -e "\033[1;34m ------------------------------------------------------------------------\033[0m\n" fi echo -e "Installation finished. You can now launch a new GNOME, KDE or XFCE session and\nchoose \033[1mXGL\033[0m." echo -e "At any time you can choose to use \033[1mCompiz\033[0m or \033[1mBeryl\033[0m through the Gnome/KDE menu -> Preferences/Settings -> \"XGL Window Manager\"."