7779e764eabdf3b157cdb690d136883ed8364cf7
[iserv-mod-error-reporter.git] / maint / update-config-from-iserv1.sh
1 #!/bin/bash
2 # called from iservchk if old config exists
3 OLDCFG=/old/opt/iserv/idesk/inc/error-reporter/config.inc.rpmsave
4 NEWCFG=/usr/share/iserv/www/inc/mod_error-reporter/config.inc
5
6 touch $NEWCFG || exit 1;
7 chmod u+wr $NEWCFG || exit 1;
8 chown www-data $NEWCFG || exit 1;
9
10 # filter unused options
11 cat $OLDCFG|grep -v setAdminGroups|grep -v setLog|grep -v @package > $NEWCFG
12
13 # convert admin groups to group privileges
14 ADMGROUPS=$(grep setAdminGroups $OLDCFG|sed -e 's/,//g' -e "s/.*array[^(]*(\([^)]*\)).*/\1/" -e "s/[\"\']/ /g")
15 for i in $ADMGROUPS; do
16 psql -c "INSERT INTO privileges_assign (act,privilege) VALUES('$i','mod_errorreporter_admin');" > /dev/null || exit 1;
17 echo "added adminship for group '$i'"
18 done;
19
20 rm -f $OLDCFG || (echo "Error: Please remove the old config file by hand!" && exit 1);
This page took 0.047927 seconds and 3 git commands to generate.