[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a
David GUENAULT
dguenault at monitoring-fr.org
Tue Feb 28 22:19:09 UTC 2012
The following commit has been merged in the debian/master branch:
commit 9f640abd30877406115cda2bd77acc226c1cab2b
Author: David GUENAULT <dguenault at monitoring-fr.org>
Date: Mon Feb 6 16:26:00 2012 +0100
Added option to choose to remove (or not) pnp4nagios when removing shinken
diff --git a/contrib/alternative-installation/shinken-install/shinken.conf b/contrib/alternative-installation/shinken-install/shinken.conf
index c7da872..b3fe3fd 100644
--- a/contrib/alternative-installation/shinken-install/shinken.conf
+++ b/contrib/alternative-installation/shinken-install/shinken.conf
@@ -172,7 +172,7 @@ cecho ()
# Argument $1 = message
# Argument $2 = foreground color
# Argument $3 = background color
-
+ # Argument $4 = if not zero then do not add line feed
case "$2" in
"black")
fcolor='30'
@@ -240,6 +240,77 @@ cecho ()
return
}
+function cread(){
+ # $1 : text
+ # $2 : color
+ # $3 : default
+ # $3 : choices
+
+ # Argument $4 = if not zero then do not add line feed
+ case "$2" in
+ "black")
+ fcolor='30'
+ ;;
+ "red")
+ fcolor='31'
+ ;;
+ "green")
+ fcolor='32'
+ ;;
+ "yellow")
+ fcolor='33'
+ ;;
+ "blue")
+ fcolor='34'
+ ;;
+ "magenta")
+ fcolor='35'
+ ;;
+ "cyan")
+ fcolor='36'
+ ;;
+ "white")
+ fcolor='37'
+ ;;
+ *)
+ fcolor=''
+ esac
+
+ if [ -z $bcolor ]
+ then
+ echo -ne "\E["$fcolor"m"$1""
+ else
+ echo -ne "\E["$fcolor";"$bcolor"m"$1""
+ fi
+ read readvalue
+
+ if [ -z "$readvalue" ]
+ then
+ readvalue=$3
+ tput sgr0
+ return
+ else
+ match=0
+ for av in $4
+ do
+ if [ "$av" == "$readvalue" ]
+ then
+ match=1
+ fi
+ done
+ if [ $match -eq 0 ]
+ then
+ tput sgr0
+ cecho " > Invalid value ($readvalue) allowed values are [$4]" red
+ cread "$1" "$2" "$3" "$4"
+ return
+ else
+ tput sgr0
+ return
+ fi
+ fi
+}
+
function cadre(){
# display a colored enclosure
# $1 => text
diff --git a/contrib/alternative-installation/shinken-install/shinken.sh b/contrib/alternative-installation/shinken-install/shinken.sh
index 0680134..ac01eb3 100755
--- a/contrib/alternative-installation/shinken-install/shinken.sh
+++ b/contrib/alternative-installation/shinken-install/shinken.sh
@@ -63,41 +63,48 @@ function remove(){
rm -Rf /etc/default/shinken
fi
if [ -f "/etc/init.d/shinken" ]
- then
+ then
cecho " > Removing startup scripts" green
- case $CODE in
- REDHAT)
- chkconfig shinken off
- chkconfig --del shinken
- ;;
- DEBIAN)
- update-rc.d -f shinken remove >> /tmp/shinken.install.log 2>&1
- ;;
- esac
- fi
+ case $CODE in
+ REDHAT)
+ chkconfig shinken off
+ chkconfig --del shinken
+ ;;
+ DEBIAN)
+ update-rc.d -f shinken remove >> /tmp/shinken.install.log 2>&1
+ ;;
+ esac
+ fi
rm -f /etc/init.d/shinken*
if [ -d "$PNPPREFIX" ]
then
- cecho " > Removing pnp4nagios" green
- rm -Rf $PNPPREFIX
- case $CODE in
- REDHAT)
- /etc/init.d/npcd stop
- chkconfig npcd off
- chkconfig --del npcd
- rm -f /etc/init.d/npcd
- rm -f /etc/httpd/conf.d/pnp4nagios
- /etc/init.d/httpd restart
- ;;
- DEBIAN)
- /etc/init.d/npcd stop
- update-rc.d -f npcd remove >> /tmp/shinken.install.log 2>&1
- rm -f /etc/init.d/npcd
- rm -f /etc/apache2/conf.d/pnp4nagios
- /etc/init.d/apache2 restart
- ;;
- esac
+ doremove="n"
+ cread " > found a pnp4nagios installation : do you want to remove it ? (y|N) => " yellow "n" "y n"
+ if [ "$readvalue" == "y" ]
+ then
+ cecho " > Removing pnp4nagios" green
+ rm -Rf $PNPPREFIX
+ case $CODE in
+ REDHAT)
+ /etc/init.d/npcd stop >> /tmp/shinken.install.log 2>&1
+ chkconfig npcd off >> /tmp/shinken.install.log 2>&1
+ chkconfig --del npcd >> /tmp/shinken.install.log 2>&1
+ rm -f /etc/init.d/npcd >> /tmp/shinken.install.log 2>&1
+ rm -f /etc/httpd/conf.d/pnp4nagios >> /tmp/shinken.install.log 2>&1
+ /etc/init.d/httpd restart >> /tmp/shinken.install.log 2>&1
+ ;;
+ DEBIAN)
+ /etc/init.d/npcd stop >> /tmp/shinken.install.log 2>&1
+ update-rc.d -f npcd remove >> /tmp/shinken.install.log 2>&1
+ rm -f /etc/init.d/npcd >> /tmp/shinken.install.log 2>&1
+ rm -f /etc/apache2/conf.d/pnp4nagios >> /tmp/shinken.install.log 2>&1
+ /etc/init.d/apache2 restart >> /tmp/shinken.install.log 2>&1
+ ;;
+ esac
+ else
+ cecho " > Aborting uninstallation of pnp4nagios" yellow
+ fi
fi
return 0
--
UNNAMED PROJECT
More information about the Pkg-nagios-changes
mailing list