From 5ccc30daba7bda1c47da7c1144c59fd66866d138 Mon Sep 17 00:00:00 2001 From: Mercier Pierre-Olivier Date: Tue, 1 Oct 2013 04:57:52 +0200 Subject: [PATCH] Display error message on installation error --- commands/first-install.sh | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/commands/first-install.sh b/commands/first-install.sh index 8cfad19..7de5fff 100755 --- a/commands/first-install.sh +++ b/commands/first-install.sh @@ -3,6 +3,7 @@ # Install missing packages DEB_PACKAGES_LIST="screen libnet-ldap-perl libxml-libxml-perl libgearman-client-perl libmailtools-perl libmail-sendmail-perl libdatetime-format-iso8601-perl libnet-ip-perl" ARCH_PACKAGES_LIST="screen perl-io-socket-ssl perl-email-simple perl-email-mime perl-term-readkey perl-ldap perl-lwp-protocol-https perl-datetime-format-iso8601 perl-net-ip" +GENTOO_PACKAGES_LIST="app-misc/screen dev-perl/IO-Socket-SSL dev-perl/Email-Simple dev-perl/Email-MIME dev-perl/TermReadKey dev-perl/perl-ldap dev-perl/LWP-Protocol-https dev-perl/DateTime-Format-ISO8601 dev-perl/Net-IP" FBSD_PACKAGES_LIST="screen p5-IO-Socket-SSL p5-Email-Simple p5-Email-MIME p5-Term-ANSIColor p5-Term-ReadKey p5-LWP-Protocol-https p5-DateTime-Format-ISO8601 p5-Net-IP" KERNEL=`uname -s` @@ -14,7 +15,11 @@ then do if ! pkg info "$PK" > /dev/null 2> /dev/null then - PACKAGESITE="http://canon.acu.epita.fr/repo-lab" pkg install "$PK" + if ! PACKAGESITE="http://canon.acu.epita.fr/repo-lab" pkg install "$PK" + then + echo "Error during installation of $PK" + exit 1 + fi fi done @@ -26,7 +31,11 @@ then if ! whereis dpkg > /dev/null 2> /dev/null then - aptitude install dpkg + if ! aptitude install dpkg + then + echo "Error during installation of $PK" + exit 1 + fi fi for PK in $DEB_PACKAGES_LIST @@ -54,20 +63,39 @@ then do if ! pacman -Qi "$PK" > /dev/null 2> /dev/null then - pacman -S "$PK" + if ! pacman -S "$PK" + then + echo "Error during installation of $PK" + exit 1 + fi + fi + done + + elif [ -f "/etc/gentoo-release" ] + then + + for PK in $GENTOO_PACKAGES_LIST + do + if ! equery list "$PK" > /dev/null 2> /dev/null + then + if ! emerge "$PK" + then + echo "Error during installation of $PK" + exit 1 + fi fi done else - echo "Unknown distribution :(" + echo "Unsupported GNU/Linux distribution :(" exit 1; fi else - echo "Unknown operating system :(" + echo "Unsupported operating system :(" exit 1; fi