瀏覽代碼

finally get the dump/restore and initdb steps right under PostgreSQL 8.0

Ralf S. Engelschall 21 年之前
父節點
當前提交
cd314623ec
共有 2 個文件被更改,包括 17 次插入12 次删除
  1. 7 4
      postgresql/pg_migrate
  2. 10 8
      postgresql/postgresql.spec

+ 7 - 4
postgresql/pg_migrate

@@ -145,10 +145,13 @@ case $cmd in
 
         su - ${l_rusr} -c \
             "LC_CTYPE=C; export LC_CTYPE; umask 022; \
-            (echo $l_pguser; echo $l_pgpass) |\
-            $l_prefix/bin/pg_initdb -U $l_pguser -W -D $l_prefix/var/postgresql/db" 2>&1 |\
-                $l_prefix/lib/openpkg/shtool prop \
-                    -p "++ creating new database data"
+            echo $l_pgpass >$l_prefix/var/postgresql/run/pw; \
+            $l_prefix/bin/pg_initdb \
+                -U $l_pguser --pwfile=$l_prefix/var/postgresql/run/pw \
+                -D $l_prefix/var/postgresql/db; \
+            rm -f $l_prefix/var/postgresql/run/pw" 2>&1 |\
+        $l_prefix/lib/openpkg/shtool prop \
+            -p "++ creating new database data"
 
         echo "++ restoring database configurations"
         for conf in pg_hba.conf pg_ident.conf postgresql.conf; do

+ 10 - 8
postgresql/postgresql.spec

@@ -43,7 +43,7 @@ Class:        BASE
 Group:        Database
 License:      GPL
 Version:      %{V_postgresql}
-Release:      20050118
+Release:      20050121
 
 #   package options
 %option       with_server   yes
@@ -543,11 +543,12 @@ AutoReqProv:  no
 %endif
         su - %{l_rusr} -c \
             "LC_CTYPE=C; export LC_CTYPE; umask 022; \
-            echo \"$l_pgpass\" >$RPM_INSTALL_PREFIX/var/postgresql/db/pw; \
+            rm -rf $RPM_INSTALL_PREFIX/var/postgresql/db/*; \
+            echo $l_pgpass >$RPM_INSTALL_PREFIX/var/postgresql/run/pw; \
             $RPM_INSTALL_PREFIX/bin/pg_initdb \
-                -U $l_pguser --pwfile=$RPM_INSTALL_PREFIX/var/postgresql/db/pw \
+                -U $l_pguser --pwfile=$RPM_INSTALL_PREFIX/var/postgresql/run/pw \
                 -D $RPM_INSTALL_PREFIX/var/postgresql/db; \
-            rm -f $RPM_INSTALL_PREFIX/var/postgresql/db/pw" 2>&1 |\
+            rm -f $RPM_INSTALL_PREFIX/var/postgresql/run/pw" 2>&1 |\
         $RPM_INSTALL_PREFIX/lib/openpkg/shtool prop \
             -p "Creating initial PostgreSQL DB in $RPM_INSTALL_PREFIX/var/postgresql/db"
 
@@ -568,10 +569,11 @@ AutoReqProv:  no
         ( echo "An initial PostgreSQL DB was created with the two standard"
           echo "databases 'template0' and 'template1'. The owner of both"
           echo "is the DB user '$l_pguser'. Its initial password is '$l_pgpass'."
-          echo "After starting PostgreSQL you should change this as soon as"
-          echo "possible with the following command:"
-          echo "\$ $RPM_INSTALL_PREFIX/bin/psql -U $l_pguser -d template1 \\"
-          echo "  -c \"ALTER USER $l_pguser WITH PASSWORD '<new-password>'\""
+          echo "After starting PostgreSQL with"
+          echo "    \$ $RPM_INSTALL_PREFIX/etc/rc postgresql start"
+          echo "you should immediately change this with the following command:"
+          echo "    \$ $RPM_INSTALL_PREFIX/bin/psql -U $l_pguser -d template1 \\"
+          echo "      -c \"ALTER USER $l_pguser WITH PASSWORD '<new-password>'\""
         ) | %{l_rpmtool} msg -b -t notice
 
         #   optionally link into unixODBC