X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 87E3B310CB1 for ; Tue, 1 Jul 2003 19:14:09 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 03411-07 for ; Tue, 1 Jul 2003 16:13:38 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [64.117.225.209]) by svr1.postgresql.org (Postfix) with ESMTP id F0887310C7D for ; Tue, 1 Jul 2003 16:12:45 -0300 (ADT) Received: from acenet-tech.org (12-255-3-223.client.attbi.com [12.255.3.223]) by www.postgresql.com (Postfix) with SMTP id 0AE20CF7499 for ; Tue, 1 Jul 2003 11:34:24 -0300 (ADT) Received: (qmail 18998 invoked from network); 1 Jul 2003 14:33:10 -0000 Received: from pc-00065 (HELO 127.0.0.1) (192.168.1.65) by sme-gateway.acenet-tech.org (192.168.1.1) with ESMTP; 01 Jul 2003 14:33:10 -0000 Date: Tue, 1 Jul 2003 08:17:49 -0600 From: Craig Jensen X-Mailer: The Bat! (v1.61) Business Reply-To: Ace Net-Tech Server Organization: Ace Net-Tech X-Priority: 3 (Normal) Message-ID: <197752183853.20030701081749@acenet-tech.org> To: pgsql-sql@postgresql.org Subject: help with rpm script MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200307/13 X-Sequence-Number: 14127 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.{{{