]> git.pld-linux.org Git - packages/postgresql.git/commitdiff
- added init to init.d script (needs checking!)
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Thu, 3 Oct 2002 11:52:13 +0000 (11:52 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    postgresql.init -> 1.38

postgresql.init

index cdc60bc1fa375374e7d3bc6856655b7d929afaff..9475942daafcc25c4d50af187eee4682ec3c32af 100644 (file)
@@ -82,15 +82,8 @@ case "$1" in
                        exit 1
                    fi
                else
-                   # Create sample database
-                   if [ ! -d $POSTGRES_DATA_DIR ]; then
-                       mkdir -p $POSTGRES_DATA_DIR
-                       chown postgres.postgres $POSTGRES_DATA_DIR
-                       chmod 700 $POSTGRES_DATA_DIR
-                   fi
-                   TMPDIR=/tmp su - postgres -c "LD_LIBRARY_PATH=/usr/lib \
-                       initdb --pgdata=$POSTGRES_DATA_DIR \
-                       -L /usr/share/postgresql -E $ENCODING"
+                   echo "Postgresql database not initialized. Try \"$0 init\" before start."
+                   exit 1
                fi
                
                msg_starting PostgreSQL 
@@ -178,6 +171,32 @@ case "$1" in
                exit 1
        fi
        ;;
+    init)
+       if [ -f "$POSTGRES_DATA_DIR/PG_VERSION" ]; then
+           echo "Seems that database is initialized now. Remove by hand $POSTGRES_DATA_DIR"
+           echo "before initialize database."
+           exit 1
+       fi
+
+       echo -n "Specify encoding for pgsql database (eg: LATIN1, KOI8) [$ENCODING]: "
+       read new_encoding
+       ENCODING=${new_encoding:-$ENCODING}
+
+       show "Creating initial postgresql database usinc $ENCODING encoding"
+       busy
+
+        # Create sample database
+       if [ ! -d $POSTGRES_DATA_DIR ]; then
+           mkdir -p $POSTGRES_DATA_DIR
+           chown postgres.postgres $POSTGRES_DATA_DIR
+           chmod 700 $POSTGRES_DATA_DIR
+       fi
+
+       
+       TMPDIR=/tmp su - postgres -c "LD_LIBRARY_PATH=/usr/lib \
+                       initdb --pgdata=$POSTGRES_DATA_DIR \
+                       -L /usr/share/postgresql -E $ENCODING"
+       ;;
   *)
        msg_usage "$0 {start|stop|status|restart|reload}"
        exit 1
This page took 0.04152 seconds and 4 git commands to generate.