Sophie

Sophie

distrib > Mandriva > 7.1 > i586 > by-pkgid > bd8b81fa07a296fdab5f088c5b5036a4 > scriptlet

php-pgsql-4.0.6-3.1mdk.i586.rpm

PREUN

/bin/sh
if [ $1 = "0" ]; then
  if [ -f /etc/php.ini ]; then
    perl -pi -e 's|^extension\s*=\s*pgsql.so|;extension = pgsql.so|g' /etc/php.ini
  fi
  if [ -e /usr/sbin/AESctl ]; then /usr/sbin/AESctl update;fi 
fi

POSTIN

/bin/sh
if [ $1 = "1" ]; then
  if [ -f /etc/php.ini ]; then
    perl -pi -e 's|^;extension\s*=\s*pgsql.so|extension = pgsql.so|' /etc/php.ini
  fi
  if [ -e /var/lib/pgsql/data/postmaster.pid ]; then
    echo "Adding user 'apache' in postgresql"
    su -l postgres -c 'createuser -a -d apache' 1>/dev/null 2>/dev/null
  else 
    echo "Don't forget to add the 'apache' user in Postgresql: run"
    echo "su -l postgres -c 'createuser -a -d apache'"
  fi	
fi
if [ $1 -gt 1 ]; then
   #We're in *upgrade mode*. Since we can't be sure the configuration files
   #are sane, remove module from the conf files to clean them, re-add again
   #in a way that the older module we're replacing won't try to erase (the
   #post scripts were broken on some packages)
   #Also, there could be extra lines, so make sure we uncomment one
   #Finally, don't check for presence of php.ini, if it's not there,
   #we have a problem, so it should generate an error message.
   perl -pi -e 's|^extension\s*=\s*pgsql.so|;extension = pgsql.so|g' /etc/php.ini
   perl -pi -e 's|^;extension\s*=\s*pgsql.so|extension = pgsql.so|' /etc/php.ini
fi
if [ -e /usr/sbin/AESctl ]; then /usr/sbin/AESctl update;fi