[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a

David GUENAULT dguenault at monitoring-fr.org
Tue Feb 28 22:16:48 UTC 2012


The following commit has been merged in the debian/master branch:
commit c1300a928d24e539dae03bfe9be3680c7dc42e21
Author: David GUENAULT <dguenault at monitoring-fr.org>
Date:   Sat Jan 28 13:55:49 2012 +0100

    Fix a big bug in architecture detection and package detection

diff --git a/contrib/alternative-installation/shinken-install/shinken.conf b/contrib/alternative-installation/shinken-install/shinken.conf
index 5dd6ff7..1fc230e 100644
--- a/contrib/alternative-installation/shinken-install/shinken.conf
+++ b/contrib/alternative-installation/shinken-install/shinken.conf
@@ -43,6 +43,10 @@ export DATE=$(date +%Y%m%d%H%M%S)
 export GIT="https://github.com/naparuba/shinken.git"
 
 export ARCH=$(uname -i)
+if [ "$ARCH" == "unknown" ]
+then
+    ARCH=$(uname -m)
+fi
 export DIST=$(/usr/bin/lsb_release -i | awk '{print $NF}')
 export VERS=$(/usr/bin/lsb_release -r | awk '{print $NF}' | awk -F. '{print $1}')
 
@@ -95,13 +99,14 @@ then
 fi
 export SETUPTOOLSVERS="0.6c11"
 export RHELSETUPTOOLS="http://pypi.python.org/packages/source/s/setuptools/setuptools-$SETUPTOOLSVERS.tar.gz"
-export APTPKGS="build-essential libperl-dev python-setuptools libsqlite3-dev python-dev pyro sqlite3 nmap unzip python-gridfs python-pymongo"
+export APTPKGS="build-essential libperl-dev python-setuptools libsqlite3-dev python-dev pyro sqlite3 nmap unzip"
 export PYLIBSRHEL="paramiko:paramiko netifaces:netifaces multiprocessing:multiprocessing simplejson:simplejson pysqlite:sqlite3 MySQL-python:MySQLdb pyro:Pyro.core pymongo:pymongo"
 export PYLIBSRHEL6="paramiko:paramiko netifaces:netifaces simplejson:simplejson pysqlite:sqlite3 MySQL-python:MySQLdb pyro:Pyro.core"
-export PYLIBSDEB="paramiko:paramiko netifaces:netifaces pyro:Pyro.core simplejson:simplejson pysqlite:sqlite MySQL-python:MySQLdb pymongo:pymongo"
+export PYLIBSDEB="paramiko:paramiko netifaces:netifaces simplejson:simplejson pysqlite:sqlite3 MySQL_python:MySQLdb pymongo:pymongo"
 export PYRO="http://pypi.python.org/packages/source/P/Pyro/Pyro-3.12.tar.gz"
 
-export VSPHERESDKAPTPKGS="libssl-dev perl-doc liburi-perl libxml-libxml-perl libcrypt-ssleay-perl ia32-libs libclass-methodmaker-perl libsoap-lite-perl libsoap-lite-perl libuuid-perl make libnagios-plugin-perl"
+#export VSPHERESDKAPTPKGS="libssl-dev perl-doc liburi-perl libxml-libxml-perl libcrypt-ssleay-perl ia32-libs libclass-methodmaker-perl libsoap-lite-perl libsoap-lite-perl libuuid-perl make libnagios-plugin-perl"
+export VSPHERESDKAPTPKGS="libssl-dev perl-doc liburi-perl libxml-libxml-perl libcrypt-ssleay-perl ia32-libs libclass-methodmaker-perl libsoap-lite-perl libsoap-lite-perl make libnagios-plugin-perl"
 export VSPHERESDKYUMPKGS="openssl-devel perl-URI perl-XML-LibXML perl-Crypt-SSLeay perl-SOAP-Lite perl-Class-MethodMaker uuid-perl make perl-libwww-perl.noarch" 
 export NAGPLUGYUMPKGS="perl-Class-Accessor perl-Config-Tiny perl-Math-Calc-Units perl-Params-Validate"
 export NAGPLUGPERL="http://search.cpan.org/CPAN/authors/id/T/TO/TONVOON/Nagios-Plugin-0.36.tar.gz"
@@ -147,7 +152,7 @@ export MKURI="http://mathias-kettner.de/download/check_mk-$MKVER.tar.gz"
 export MKPREFIX="/usr/local/check_mk"
 export MKAPTPKG="libapache2-mod-python"
 
-export WMICAPTPKG="autoconf python libdatetime-perl libnagios-plugin-perl libconfig-inifiles-perl"
+export WMICAPTPKG="autoconf libdatetime-perl libnagios-plugin-perl libconfig-inifiles-perl"
 export WMICYUMPKG="autoconf python perl-DateTime perl-Config-IniFiles"
 export WMIC="http://dev.zenoss.org/svn/trunk/inst/externallibs/wmi-1.3.13.tar.bz2"
 export CHECKWMIPLUS="http://edcint.co.nz/checkwmiplus/sites/default/files/check_wmi_plus.v1.49.tar.gz"
@@ -155,3 +160,187 @@ export CHECKWMIPLUS="http://edcint.co.nz/checkwmiplus/sites/default/files/check_
 export CHECKHPASM="http://labs.consol.de/wp-content/uploads/2011/10/check_hpasm-4.3.tar.gz"
 export CHECKHPASMAPTPKGS="snmp libnet-snmp-perl"
 export CHECKHPASMYUMPKGS="perl-Net-SNMP net-snmp"
+
+
+###################################
+### TEXT PRESENTATION FUNCTIONS ### 
+###################################
+
+cecho ()                    
+{
+
+        # Argument $1 = message
+        # Argument $2 = foreground color
+        # Argument $3 = background color
+
+        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
+        case "$3" in
+                "black")
+                        bcolor='40'
+                        ;;
+               "red")
+                        bcolor='41'
+                        ;;
+                "green")
+                        bcolor='42'
+                        ;;
+                "yellow")
+                        bcolor='43'
+                        ;;
+                "blue")
+                        bcolor='44'
+                        ;;
+                "magenta")
+                        bcolor='45'
+                        ;;
+                "cyan")
+                        bcolor='46'
+                        ;;
+                "white")
+                        bcolor='47'
+                        ;;
+                *)
+                        bcolor=""
+        esac
+
+        if [ -z $bcolor ]
+        then
+                echo -ne "\E["$fcolor"m"$1"\n"
+        else
+                echo -ne "\E["$fcolor";"$bcolor"m"$1"\n"
+        fi
+        tput sgr0
+        return
+}
+
+function cadre(){
+    # display a colored enclosure
+    # $1 => text
+    # $2 => color
+    cecho "+--------------------------------------------------------------------------------" $2
+    cecho "| $1" $2
+    cecho "+--------------------------------------------------------------------------------" $2
+}
+
+######################
+### MISC FUNCTIONS ###
+######################
+
+function pythonver(){
+    versions="2.4 2.5 2.6 2.7"
+        LASTFOUND=""
+        # is there any python here ?
+        for v in $versions
+        do
+                which python$v >> /tmp/shinken.install.log 2>&1 
+                if [ $? -eq 0 ]
+                then
+                        LASTFOUND="python$v"
+                fi
+        done
+        if [ -z "$LASTFOUND" ]
+        then
+                # finaly try to find a default python
+                which python >> /tmp/shinken.install.log 2>&1 
+                if [ $? -ne 0 ]
+                then
+                        echo "No python interpreter found !"
+                        exit 2
+                else
+                        echo "python found"
+                        LASTFOUND=$(which python)
+                fi
+        fi
+        PY=$LASTFOUND
+    echo $PY
+}
+function pythonvershort(){
+    versions="2.4 2.5 2.6 2.7"
+        LASTFOUND=""
+        # is there any python here ?
+        for v in $versions
+        do
+                which python$v >> /tmp/shinken.install.log 2>&1 
+                if [ $? -eq 0 ]
+                then
+                        LASTFOUND="$v"
+                fi
+        done
+        PY=$LASTFOUND
+    echo $PY
+}
+
+function rheldvd(){
+    # this is only for my personal needs
+    # dvd mounted ?
+    if [ "$CODE" != "REDHAT" ]
+    then
+        cecho " > Only for REDHAT" red
+        exit 2
+    fi
+    cadre "Setup rhel dvd for yum (this is only for my development purpose)" green
+    dvdm=$(cat /proc/mounts | grep "^\/dev\/cdrom")
+    if [ -z "$dvdm" ]
+    then
+        if [ ! -d "/media/cdrom" ]
+        then
+            mkdir -p "/media/cdrom"
+        fi
+        cecho " > Insert RHEL/CENTOS DVD and press ENTER" yellow
+        read -p " > ENTER when ready "
+        mount -t iso9660 -o ro /dev/cdrom /media/cdrom >> /tmp/shinken.install.log 2>&1 
+        if [ $? -eq 0 ]
+        then
+            dvdm=$(cat /proc/mounts | grep "^\/dev\/cdrom")
+            if [ -z "$dvdm" ]
+            then
+                cecho " > Unable to mount RHEL/CENTOS DVD !" red
+                exit 2
+            else
+                if [ ! -d "/media/cdrom/Server" ]
+                then
+                    cecho "Invalid DVD" red
+                    exit 2
+                else
+                    if [ ! -f "/etc/yum.repos.d/rheldvd.repo" ]
+                    then
+                        echo "[dvd]" > /etc/yum.repos.d/rheldvd.repo
+                        echo "name=rhel dvd" >> /etc/yum.repos.d/rheldvd.repo
+                        echo "baseurl=file:///media/cdrom/Server" >> /etc/yum.repos.d/rheldvd.repo
+                        echo "enabled=1" >> /etc/yum.repos.d/rheldvd.repo
+                        echo "gpgcheck=0" >> /etc/yum.repos.d/rheldvd.repo
+                    fi
+                fi
+            fi
+        else 
+            cecho " > Error while mounting DVD" red
+        fi    
+    fi    
+}
diff --git a/contrib/alternative-installation/shinken-install/shinken.sh b/contrib/alternative-installation/shinken-install/shinken.sh
index 2413d6e..a4b2b2d 100755
--- a/contrib/alternative-installation/shinken-install/shinken.sh
+++ b/contrib/alternative-installation/shinken-install/shinken.sh
@@ -48,94 +48,6 @@ function trap_handler()
         exit 2
 }
 
-###################################
-### TEXT PRESENTATION FUNCTIONS ### 
-###################################
-
-cecho ()                    
-{
-
-        # Argument $1 = message
-        # Argument $2 = foreground color
-        # Argument $3 = background color
-
-        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
-        case "$3" in
-                "black")
-                        bcolor='40'
-                        ;;
-               "red")
-                        bcolor='41'
-                        ;;
-                "green")
-                        bcolor='42'
-                        ;;
-                "yellow")
-                        bcolor='43'
-                        ;;
-                "blue")
-                        bcolor='44'
-                        ;;
-                "magenta")
-                        bcolor='45'
-                        ;;
-                "cyan")
-                        bcolor='46'
-                        ;;
-                "white")
-                        bcolor='47'
-                        ;;
-                *)
-                        bcolor=""
-        esac
-
-        if [ -z $bcolor ]
-        then
-                echo -ne "\E["$fcolor"m"$1"\n"
-        else
-                echo -ne "\E["$fcolor";"$bcolor"m"$1"\n"
-        fi
-        tput sgr0
-        return
-}
-
-function cadre(){
-    # display a colored enclosure
-    # $1 => text
-    # $2 => color
-    cecho "+--------------------------------------------------------------------------------" $2
-    cecho "| $1" $2
-    cecho "+--------------------------------------------------------------------------------" $2
-}
-
-
 function remove(){
     trap 'trap_handler ${LINENO} $? remove' ERR
     cadre "Removing shinken" green
@@ -277,7 +189,7 @@ function installpkg(){
             fi
             ;;
         DEBIAN)
-            apt-get install -y $package >> /tmp/shinken.install.log 2>&1 
+            apt-get install -y $package  >> /tmp/shinken.install.log 2>&1 
             if [ $? -ne 0 ]
             then
                 return 2
@@ -287,6 +199,16 @@ function installpkg(){
     return 0
 }
 
+function debinstalled(){
+    package=$1
+    if [ -z $(dpkg -l $package | grep "^ii") ]
+    then
+        return 1
+    else
+        return 0
+    fi
+}
+
 function prerequisites(){
     cadre "Checking prerequisite" green
     # common prereq
@@ -340,7 +262,7 @@ function prerequisites(){
 
         DEBIAN)
             PACKAGES=$APTPKGS
-            QUERY="dpkg -l "
+            QUERY="debinstalled "
             ;;
     esac
     for p in $PACKAGES
@@ -399,7 +321,28 @@ function prerequisites(){
             fi
 
             
-        done    
+        done
+    elif [ "$CODE" == "DEBIAN" ]
+    then    
+        export PY="python"
+        export PYEI="easy_install"
+        PYLIBS=$PYLIBSDEB
+        for p in $PYLIBS
+        do
+            module=$(echo $p | awk -F: '{print $1'})
+            import=$(echo $p | awk -F: '{print $2'})
+
+            $PY $myscripts/tools/checkmodule.py -m $import  >> /tmp/shinken.install.log 2>&1 
+            if [ $? -eq 2 ]
+            then
+                cecho " > Module $module ($import) not found. Installing..." yellow
+                $PYEI $module >> /tmp/shinken.install.log 2>&1 
+            else
+                cecho " > Module $module found." green 
+            fi
+
+            
+        done
     fi
     
 }
@@ -593,86 +536,6 @@ function sinstall(){
     cecho "+------------------------------------------------------------------------------" green
 }
 
-######################
-### MISC FUNCTIONS ###
-######################
-
-function pythonver(){
-    versions="2.4 2.5 2.6 2.7"
-        LASTFOUND=""
-        # is there any python here ?
-        for v in $versions
-        do
-                which python$v >> /tmp/shinken.install.log 2>&1 
-                if [ $? -eq 0 ]
-                then
-                        LASTFOUND="python$v"
-                fi
-        done
-        if [ -z "$LASTFOUND" ]
-        then
-                # finaly try to find a default python
-                which python >> /tmp/shinken.install.log 2>&1 
-                if [ $? -ne 0 ]
-                then
-                        echo "No python interpreter found !"
-                        exit 2
-                else
-                        echo "python found"
-                        LASTFOUND=$(which python)
-                fi
-        fi
-        PY=$LASTFOUND
-    echo $PY
-}
-
-function rheldvd(){
-    # this is only for my personal needs
-    # dvd mounted ?
-    if [ "$CODE" != "REDHAT" ]
-    then
-        cecho " > Only for REDHAT" red
-        exit 2
-    fi
-    cadre "Setup rhel dvd for yum (this is only for my development purpose)" green
-    dvdm=$(cat /proc/mounts | grep "^\/dev\/cdrom")
-    if [ -z "$dvdm" ]
-    then
-        if [ ! -d "/media/cdrom" ]
-        then
-            mkdir -p "/media/cdrom"
-        fi
-        cecho " > Insert RHEL/CENTOS DVD and press ENTER" yellow
-        read -p " > ENTER when ready "
-        mount -t iso9660 -o ro /dev/cdrom /media/cdrom >> /tmp/shinken.install.log 2>&1 
-        if [ $? -eq 0 ]
-        then
-            dvdm=$(cat /proc/mounts | grep "^\/dev\/cdrom")
-            if [ -z "$dvdm" ]
-            then
-                cecho " > Unable to mount RHEL/CENTOS DVD !" red
-                exit 2
-            else
-                if [ ! -d "/media/cdrom/Server" ]
-                then
-                    cecho "Invalid DVD" red
-                    exit 2
-                else
-                    if [ ! -f "/etc/yum.repos.d/rheldvd.repo" ]
-                    then
-                        echo "[dvd]" > /etc/yum.repos.d/rheldvd.repo
-                        echo "name=rhel dvd" >> /etc/yum.repos.d/rheldvd.repo
-                        echo "baseurl=file:///media/cdrom/Server" >> /etc/yum.repos.d/rheldvd.repo
-                        echo "enabled=1" >> /etc/yum.repos.d/rheldvd.repo
-                        echo "gpgcheck=0" >> /etc/yum.repos.d/rheldvd.repo
-                    fi
-                fi
-            fi
-        else 
-            cecho " > Error while mounting DVD" red
-        fi    
-    fi    
-}
 
 ########################
 ### BACKUP FUNCTIONS ###

-- 
UNNAMED PROJECT



More information about the Pkg-nagios-changes mailing list