Subject: pkg/21133: pkg pgsql.sh rc.d script
To: None <gnats-bugs@gnats.netbsd.org>
From: None <tom@minnesota.com>
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
>Closed-Date:
>Last-Modified:
>Originator:     Thomas T. Thai
>Release:        NetBSD 1.6R
>Organization:

--
Thomas T. Thai
Minnesota.com, Inc.
>Environment:
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
>Description:
pgsql_precmd()
{
        if [ ! -f ${pgsql_home}/data/base/1/PG_VERSION ]; then
                $rcd_dir/pgsql initdb
        fi
}

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

>Release-Note:
>Audit-Trail:
>Unformatted:
 cvs src 20030412