changing user within a post install.

Dennis Veatch dveatch at woh.rr.com
Thu Apr 1 12:07:28 GMT 2004


I have a POST_INSTALL module for postgresql but can't get one part to work. It 
looks like this;

-----------------------------------------------------------------------------------------------------------------
# Check the default directory exists, if not create and set owner.

if [ ! -d "/var/lib/pgsql" ]; then
   mkdir -p /var/lib/pgsql
   chown postgres:postgres /var/lib/pgsql	
fi

# login as postgres and intitialize the database, if it does not exist.

su postgres &&
cd /var/lib/pgsql &&
/usr/bin/initdb -D /var/lib/pgsql/data

---------------------------------------------------------------------------------------------------------------------

It does create /var/lib/pgsql. It seems to be changing to the postgres user as 
the prompt changes from "root at driller" to "sh-2.05". But that's all it seems 
to do at this point. Doing the commands manually, works fine. No clue how to 
handle this within POST_INSTALL.

Side note: It will when complete 1st check for an existing database and if 
present will not re-initialize.

-- 
Registered Linux user 193414
http://counter.li.org


More information about the Lunar-dev mailing list