pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Jensen <cjensen@acenet-tech.org>
To: pgsql-sql@postgresql.org
Subject: help with rpm script
Date: Tue, 1 Jul 2003 08:17:49 -0600
Message-ID: <197752183853.20030701081749@acenet-tech.org> (raw)

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@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@acenet-tech.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.{{{





Message-ID: <197752183853.20030701081749@acenet-tech.org>
Permalink:  ../197752183853.20030701081749@acenet-tech.org/
Also on:    postgresql.org/message-id/197752183853.20030701081749@acenet-tech.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: cjensen@acenet-tech.org
  Subject: Re: help with rpm script
  In-Reply-To: <197752183853.20030701081749@acenet-tech.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox