summaryrefslogtreecommitdiff
path: root/net/sipxcommserverlib/files/patch-bin_pgpatch.sh
blob: 32eb0a4fd85968453fc220d02336a6a9ea2e4fd8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
--- bin/pgpatch.sh.orig	Wed Jan  3 14:07:38 2007
+++ bin/pgpatch.sh	Mon Jan  8 16:11:32 2007
@@ -8,7 +8,7 @@
 
 Action=RUN
 
-: ${ServiceDir:=/etc/init.d}
+: ${ServiceDir:=@PREFIX@/etc/rc.d}
 : ${Chown:=chown}
 
 # This function determines the correct service name for Postgres.
@@ -37,19 +37,12 @@
   Service=`postgresService`
 
   # May not by running, so eat up error (ENG-314)
-  ${ServiceDir}/${Service} stop 2>&1 1> /dev/null
+  ${ServiceDir}/postgresql stop 2>&1 1> /dev/null
 
   # Custom
   if test -z $PGDATA
   then
-      # Debian/Gentoo
-      if test -d /var/lib/postgresql/data
-      then
-          PGDATA=/var/lib/postgresql/data
-      else
-          # Redhat
-          PGDATA=/var/lib/pgsql/data
-      fi
+      PGDATA=~pgsql/data
   fi
 
   # Postgres db is initialized on startup on Redhat, but not on other
@@ -84,16 +77,16 @@
   fi
 
   # Open up TCP/IP connections
-  sed -i-sipx.bak -e 's/\#tcpip_socket\s=\sfalse/tcpip_socket = true/g' \
+  gsed -i-sipx.bak -e 's/\#tcpip_socket\s=\sfalse/tcpip_socket = true/g' \
           $PGDATA/postgresql.conf
-  ${Chown} postgres:postgres $PGDATA/postgresql.conf
+  ${Chown} pgsql:pgsql $PGDATA/postgresql.conf
 
   # Postmaster to allow connections
   echo "-i" > $PGDATA/postmaster.opts.default
   chmod 664 $PGDATA/postmaster.opts.default
-  ${Chown} postgres:postgres $PGDATA/postmaster.opts.default
+  ${Chown} pgsql:pgsql $PGDATA/postmaster.opts.default
 
-  ${ServiceDir}/$Service start
+  ${ServiceDir}/postgresql start
 }
 
 # Have postgres start automatically with system reboot
@@ -129,7 +122,6 @@
 if [ ${Action} = RUN ]
 then
   postgresSetup
-  setPostgresRunlevels
 elif [ ${Action} = HELP ]
 then
 cat <<USAGE