Author:   Lars Michelsen <[email protected]>
Date:     Mon Nov 21 13:45:32 2011 +0100
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Mon Nov 21 13:45:32 2011 +0100

Improved the installer a bit

---

 ChangeLog  |    2 ++
 TODO       |   24 ++++++++++++++++++++++++
 install.sh |   26 ++++++++++++++++++++------
 3 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1681764..4cc7752 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
 1.6
 Core
   * Implented conf.d/ directory to have an optional modular main configuration
+  * Improved the installer a bit: Better directory detections; Less questions
+    during update
 
 1.6rc4
 Core
diff --git a/TODO b/TODO
index 1fd569b..c17f0bb 100644
--- a/TODO
+++ b/TODO
@@ -87,6 +87,30 @@ Einige weitere Gedankenfetzen:
     - Das Konstrukt kann auch Objekte mit Eigenschaften enthalen, diese 
könnten dann von der Map Konfiguration überschrieben werden (?)
   2. Welche Eigenschaften haben die Objekte?
 
+*** Installer renovieren ***
+
+Der erste Punkt: Die Nutzer Einstellungen für eine Installation sollen 
gespeichert werden.
+Das kann z.B. in einer Datei im Home-Verzeichnis gespeichert werden. Der Pfad 
zu dieser
+Datei könnte beispielsweise auch über eine Umgebungsvariable oder einen 
Parameter verändert
+werden. Dann braucht man auch nicht mehr versuchen eine mögliche 
Kommandozeile für den
+nächsten Lauf zusammen zu bauen.
+
+Bei den Default-Einstellungen für die einzelnen Optionen gibt es folgende 
Möglichkeiten:
+
+1. Hart codierte Defaults
+2. Aufrufparameter
+3. In einem vorherigen Lauf eingegebene Optionen
+4. Automatisch ermittelte Optionen
+
+Alle Abfragen genau prüfen, ob diese wirklich abgefragt werden müssen.
+Beim Update eventuell einige Abfrage weglassen. Wie z.B. die Konfiguration der 
Backends.
+
+Beim automatischen Ermitteln von Pfaden/Nutzern könnte man auch alternativen 
anbieten, wenn
+mehrere Nagios Prozesse gefunden werden.
+
+Eventuell auf Python umstellen. Das macht die ganze Programmierung um einiges 
einfacher und
+das ganze Zeug auch wartbarer.
+
 *** Shortcuts einbauen ***
 
 Gerade der Edit-Modus im normalen Frontend sollte Hotkeys haben. Diese sollten
diff --git a/install.sh b/install.sh
index f3173bb..8cdccbf 100755
--- a/install.sh
+++ b/install.sh
@@ -414,6 +414,14 @@ detect_livestatus_socket() {
  
 # Check Backend module prerequisites
 check_backend() {
+    # Ask to configure the backends during update
+    if [ $INSTALLER_ACTION = "update" ]; then
+        confirm "Do you want to update the backend configuration?" "n"
+        if [ "$ANS" = "N" ]; then
+            return
+        fi
+    fi
+
     BACKENDS=""
     text "| Checking Backends. (Available: $NAGVIS_BACKENDS)" "|"
     if [ $INSTALLER_QUIET -ne 1 ]; then
@@ -1076,8 +1084,8 @@ if [ -z $WHICH ]; then
     log "'which' not found (maybe package missing). Aborting..."
     exit 1
 fi
-PKG=`find_bin rpm`
-[ -z "$PKG" ] && PKG=`find_bin dpkg`
+PKG=`find_bin dpkg`
+[ -z "$PKG" ] && PKG=`find_bin rpm`
 [ -z "$PKG" ] && PKG=`find_bin yum`
 [ -z "$PKG" ] && PKG=`find_bin pkginfo`
 if [ -z "$PKG" ]; then
@@ -1120,7 +1128,7 @@ if [ $FORCE -eq 0 ]; then
     # Maybe the user wants to update from NagVis 1.4x. The paths
     # have changed there. So try to get the old nagvis dir in nagios/share
     # path. When there is some, ask the user to update that installation.
-    if [ -d ${NAGIOS_PATH%/}/share/nagvis -a "$NAGVIS_PATH" != 
"${NAGIOS_PATH%/}/share/nagvis" ]; then
+    if [ ! -d "$NAGVIS_PATH_OLD" -a -d ${NAGIOS_PATH%/}/share/nagvis -a 
"$NAGVIS_PATH" != "${NAGIOS_PATH%/}/share/nagvis" ]; then
         # Found nagvis in nagios/share and this run wants to install NagVis 
somewhere else
         NAGVIS_PATH_OLD="${NAGIOS_PATH%/}/share/nagvis"
 
@@ -1140,6 +1148,12 @@ if [ $FORCE -eq 0 ]; then
         fi
         CALL="$CALL -O $NAGVIS_PATH_OLD"
     fi
+    
+fi
+
+# When the old directory exists this is an update run
+if [ -d "$NAGVIS_PATH_OLD" ]; then
+    INSTALLER_ACTION="update"
 fi
 
 text
@@ -1212,8 +1226,6 @@ text
 line "Checking for existing NagVis" "+"
 
 if [ -d $NAGVIS_PATH_OLD ]; then
-    INSTALLER_ACTION="update"
-    
     if [ -e $NAGVIS_PATH_OLD/nagvis/includes/defines/global.php ]; then
         NAGVIS_VER_OLD=`cat 
$NAGVIS_PATH_OLD/nagvis/includes/defines/global.php | grep CONST_VERSION | awk 
-F"'" '{ print $4 }'`
     elif [ -e $NAGVIS_PATH_OLD/share/nagvis/includes/defines/global.php ]; then
@@ -1474,7 +1486,9 @@ if [ "$INSTALLER_ACTION" = "update" -a "$NAGVIS_VER_OLD" 
!= "UNKNOWN" ]; then
         restore "etc/automaps/" "automap configuration files" "/__automap.cfg"
     
         LINE="Restoring user configuration files..."
-        restore "etc/profiles/" "user configuration files" ""
+        if [ -d $NAGVIS_PATH_BACKUP/etc/profiles ]; then
+            restore "etc/profiles/" "user configuration files" ""
+        fi
 
         if [ -d $NAGVIS_PATH_BACKUP/etc/conf.d ]; then
             LINE="Restoring conf.d/ configuration files..."


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to