iservchk: Test does not allow output, better use Shell; more exit codes in update...
[iserv-mod-error-reporter.git] / maint / update-config.sh
1 #!/bin/bash
2 # called by iservchk
3 # convert the old, PHP based config file to /etc/iserv/config
4
5 OLDCFG=/usr/share/iserv/www/inc/mod_error-reporter/config.inc
6 NEWCFG=/etc/iserv/config
7 TMPCFG=`mktemp`
8 rm -rf $TMPCFG
9
10 # mail notify
11 if [ -n "`grep 'setMailNotify(' $OLDCFG|grep false`" ]; then
12 sed 's/^ErrorReporterMailNotify.\+/ErrorReporterMailNotify = false/' $NEWCFG > $TMPCFG
13 mv $TMPCFG $NEWCFG || (echo "Could not save config!" && exit 255);
14 fi;
15
16 # mail notify address
17 mailNotifyAddress=`grep setMailNotifyAddr $OLDCFG | sed -e 's/\$cfgErrors->setMailNotifyAddr//' | tr -d '();'|tr "'();" '"'`
18 if [ -n "$mailNotifyAddress" ]; then
19 sed "s/^ErrorReporterMailAddress.\+/ErrorReporterMailAddress = $mailNotifyAddress/" $NEWCFG > $TMPCFG
20 mv $TMPCFG $NEWCFG || (echo "Could not save config!" && exit 255);
21 fi;
22
23 mv $OLDCFG $OLDCFG.converted
24 [ -e "$OLDCFG" ] && echo "Done. Please remove the old config file ($OLDCFG) by hand!" && exit 255;
25
This page took 0.049074 seconds and 5 git commands to generate.