help with rpm script

From: Craig Jensen <cjensen(at)acenet-tech(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: help with rpm script
Date: 2003-07-02 05:20:57
Message-ID: 33806371711.20030701232057@acenet-tech.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

I am building an rpm for Mitle SME (a scaled down redhat 7.3) and have all functions working except:

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

But, I need these functions to be executed when someone installs my rpm. For Mysql, I have the following
in the %post of my spec file:

-------------------snippet-from-spec-file-------------------------
%post
# This section creates the database, dbuser, dbpasswd and # data after the package has been installed

pw=`/bin/cat /etc/openldap/ldap.pw`
/bin/echo exit | /usr/bin/mysql --password=$pw mydb 2>&1 &> /dev/null
if [ "$?" = "1" ; then
/bin/echo "Creating mydb database..."
/usr/bin/mysqladmin --password=$pw create mydb
/bin/echo "grant all on mydb.* to dude(at)localhost identified by 'dudepass';" | /usr/bin/mysql --password=$pw
/usr/bin/mysql --password=$pw mydb < /path/to/my.sql
/usr/bin/mysqladmin --password=$pw reload
fi

--------------end-of-snippet-from-spec--------------------------
What commands could I use to complete similar needs for
a postgresql database to be created by an rpm?

Thank you for any help.

--
Best regards,
Craig Jensen mailto:cjensen(at)acenet-tech(dot)org

Ace Net-Tech
http://www.acenet-tech.org/ My computer services site.
http://www.acenet-tech.org/phpBB2/ My forum, business and otherwise.

}}}All ouotgoing messages scanned and verified virus-free by Norton Antivirus
2003.{{{

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-07-02 05:58:57 Re: Setting locale per connection
Previous Message Bruce Momjian 2003-07-02 04:56:05 Re: cvs build failure