From: | Lamar Owen <lamar(dot)owen(at)wgcr(dot)org> |
---|---|
To: | Ace Net-Tech Server <cjensen(at)acenet-tech(dot)org>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: help with rpm script |
Date: | 2003-07-02 12:33:51 |
Message-ID: | 200307020833.51368.lamar.owen@wgcr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wednesday 02 July 2003 01:20, Craig Jensen wrote:
> I need to have the rpm when installed create a database and a user with
> privilege to that database. These are the command functions I need to
> execute within the rpm...
> # service postgresql start
> # su postgres
> # createdb account
> # psql account < my1.sql
> # psql account < my2.sql
> # exit
It is an extremely bad idea to do this. Scriptlets in RPM run in a weird
mode.
Rather, in your spec file, do an initdb in the %install phase, and run a
restore of the precreated database (in %install, again, but this might be a
little tricky to do, since the postmaster as associated executables are in
the buildroot, not in a really runnable position). Then have this packaged
as, say, postgresql-data or somesuch. Add the precreated dump (if it's a
dumpall, it will have the database name and all users as part of the dump).
Or have the initscript in /etc/rc.d/init.d perform the restore immediately
after the initdb that the first initscript run will do.
But you really don't want to be doing this in %post. What if it's an upgrade?
RPM upgrades and installs are identical from the scriptlet's point of view
(except for the one parameter). I have a little experience in this regard,
having maintained the mainline PostgreSQL RPM's for four years.
--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Treat | 2003-07-02 13:27:53 | Re: 7.4 feature freeze is here |
Previous Message | Hannu Krosing | 2003-07-02 10:49:46 | Re: help needed with yacc/bison |