iservchk: Test does not allow output, better use Shell; more exit codes in update...
authorRoland Hieber <devnull@localhost>
Sun, 7 Mar 2010 04:26:39 +0000 (05:26 +0100)
committerRoland Hieber <devnull@localhost>
Sun, 7 Mar 2010 04:26:39 +0000 (05:26 +0100)
iservchk/20base
maint/update-config-from-iserv1.sh
maint/update-config.sh

index cfe9937..1f59f88 100644 (file)
@@ -1,8 +1,11 @@
-Test 'import configuration from IServ 1' 
-  '[ ! -f /old/opt/iserv/idesk/inc/error-reporter/config.inc.rpmsave ]'
-  /usr/share/iserv/modules/error-reporter/update-config-from-iserv1.sh
-Test 'update old config'
-  '[ ! -f /usr/share/iserv/www/inc/mod_error-reporter/config.inc ]'
-  /usr/share/iserv/modules/error-reporter/update-config
-Shell 'update database' /usr/share/iserv/modules/error-reporter/update-database
+Shell 'import configuration from IServ 1' 
+  if [ -f /old/opt/iserv/idesk/inc/error-reporter/config.inc.rpmsave ]; then
+    /usr/share/iserv/modules/error-reporter/update-config-from-iserv1.sh
+  fi;
+Shell 'update old config'
+  if [ -f /usr/share/iserv/www/inc/mod_error-reporter/config.inc ]; then
+    /usr/share/iserv/modules/error-reporter/update-config.sh
+  fi;
+Shell 'update database'
+  /usr/share/iserv/modules/error-reporter/update-database.php
 
index 7779e76..467e17a 100755 (executable)
@@ -3,9 +3,9 @@
 OLDCFG=/old/opt/iserv/idesk/inc/error-reporter/config.inc.rpmsave
 NEWCFG=/usr/share/iserv/www/inc/mod_error-reporter/config.inc
 
-touch $NEWCFG || exit 1;
-chmod u+wr $NEWCFG || exit 1;
-chown www-data $NEWCFG || exit 1;
+touch $NEWCFG || (echo "FATAL: Could not create $NEWCFG!" && exit 255);
+chmod u+wr $NEWCFG || (echo "FATAL: Could not chmod +uwr $NEWCFG!" && exit 255);
+chown www-data $NEWCFG || (echo "FATAL: Could not chown www-data $NEWCFG!" && exit 255);
 
 # filter unused options
 cat $OLDCFG|grep -v setAdminGroups|grep -v setLog|grep -v @package > $NEWCFG
@@ -17,4 +17,5 @@ for i in $ADMGROUPS; do
   echo "added adminship for group '$i'"
 done;
 
-rm -f $OLDCFG || (echo "Error: Please remove the old config file by hand!" && exit 1);
+mv $OLDCFG $OLDCFG.converted
+[ -e $OLDCFG ] && echo "Done. Please remove the old config file ($OLDCFG) by hand!" && exit 255;
index 3cc0677..24d1a7e 100755 (executable)
@@ -10,13 +10,16 @@ rm -rf $TMPCFG
 # mail notify
 if [ -n "`grep 'setMailNotify(' $OLDCFG|grep false`" ]; then
   sed 's/^ErrorReporterMailNotify.\+/ErrorReporterMailNotify = false/' $NEWCFG > $TMPCFG
-  mv $TMPCFG $NEWCFG
+  mv $TMPCFG $NEWCFG || (echo "Could not save config!" && exit 255);
 fi;
 
 # mail notify address
 mailNotifyAddress=`grep setMailNotifyAddr $OLDCFG | sed -e 's/\$cfgErrors->setMailNotifyAddr//' | tr -d '();'|tr "'();" '"'`
 if [ -n "$mailNotifyAddress" ]; then
   sed "s/^ErrorReporterMailAddress.\+/ErrorReporterMailAddress = $mailNotifyAddress/" $NEWCFG > $TMPCFG
-  mv $TMPCFG $NEWCFG
+  mv $TMPCFG $NEWCFG || (echo "Could not save config!" && exit 255);
 fi;
 
+mv $OLDCFG $OLDCFG.converted
+[ -e "$OLDCFG" ] && echo "Done. Please remove the old config file ($OLDCFG) by hand!" && exit 255;
+
This page took 0.026977 seconds and 4 git commands to generate.