package.py 674 B

1234567891011121314151617
  1. #!/usr/bin/python
  2. import os
  3. def postInstall(fromVersion, fromRelease, toVersion, toRelease):
  4. os.system("/bin/chown -R postgres:postgres /var/lib/postgresql")
  5. os.system("/bin/chmod -R 0700 /var/lib/postgresql/data")
  6. os.system("/bin/chmod -R 0700 /var/lib/postgresql/backups")
  7. # On first install...
  8. if not os.path.exists("/var/lib/postgresql/data/base"):
  9. for i in ["LANG", "LANGUAGE", "LC_ALL"]:
  10. os.environ[i] = "en_US.UTF-8"
  11. os.system('/bin/su postgres -s /bin/sh -p -c "/usr/bin/initdb --pgdata /var/lib/postgresql/data"')
  12. os.system('/bin/su postgres -s /bin/sh -p -c "/usr/bin/pg_ctl --pgdata -l logfile start"')