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