From: Roland Hieber Date: Sun, 7 Mar 2010 04:26:39 +0000 (+0100) Subject: iservchk: Test does not allow output, better use Shell; more exit codes in update... X-Git-Tag: REL_10.03.08~8 X-Git-Url: https://git.rohieb.name/iserv-mod-error-reporter.git/commitdiff_plain/53f4eedd6e44bd954a22723f70b8c8d453d03847?ds=sidebyside iservchk: Test does not allow output, better use Shell; more exit codes in update scripts --- diff --git a/iservchk/20base b/iservchk/20base index cfe9937..1f59f88 100644 --- a/iservchk/20base +++ b/iservchk/20base @@ -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 diff --git a/maint/update-config-from-iserv1.sh b/maint/update-config-from-iserv1.sh index 7779e76..467e17a 100755 --- a/maint/update-config-from-iserv1.sh +++ b/maint/update-config-from-iserv1.sh @@ -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; diff --git a/maint/update-config.sh b/maint/update-config.sh index 3cc0677..24d1a7e 100755 --- a/maint/update-config.sh +++ b/maint/update-config.sh @@ -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; +