2 # Functions to handle the main Gforge configuration file
4 mainconffile=/etc/pkgname/pkgname.conf
5 # Update it for the variables received as parameters
6 create_mainconffile () {
7 if [ ! -e $mainconffile ] ; then
9 chmod 600 $mainconffile
12 update_mainconffile () {
14 db_get pkgname/shared/$key
16 update_onevar_mainconffile $key $val
19 update_onevar_mainconfile () {
22 if grep -q "^$key=" $mainconffile ; then
23 newval=$(echo $val | sed -e 's/@/\\@/g' -e 's/\$/\\$/g' -e 's/\//\\\//g')
24 perl -pi -e "s/^$key=.*/$key=$newval/" $mainconffile
26 echo "$key=$val" >> $mainconffile
29 add_onevar_mainconfile () {
32 if ! grep -q "^$key=" $mainconffile ; then
33 echo "$key=$val" >> $mainconffile