Subject: pkg/21133: pkg rc.d script
To: None <>
From: None <>
List: netbsd-bugs
Date: 04/13/2003 18:32:35
>Number:         21133
>Category:       pkg
>Synopsis:       not a good way of detecting already initdb
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 13 11:33:00 PDT 2003
>Originator:     Thomas T. Thai
>Release:        NetBSD 1.6R

Thomas T. Thai, Inc.
System: NetBSD ns01 1.6R NetBSD 1.6R (ns01-1.6) #1: Sat Apr 12 05:13:32 CDT 2003 tom@ns01:/var/build/alpha-obj/sys/arch/alpha/compile/ns01-1.6 alpha
Architecture: alpha
Machine: alpha
        if [ ! -f ${pgsql_home}/data/base/1/PG_VERSION ]; then
                $rcd_dir/pgsql initdb

If you drop template1 and recreate it, you won't have .../base/1 directory. 
Just checking for ${pgsql_home}/data/base is enough.
drop template1;
just detect the existence of ${pgsql_home}/data/base should be enough.

 cvs src 20030412