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 EA69630DCAD for ; Fri, 13 Jun 2003 19:42:27 +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 93030-08 for ; Fri, 13 Jun 2003 16:42:17 -0300 (ADT) Received: from acenet-tech.org (12-255-3-223.client.attbi.com [12.255.3.223]) by svr1.postgresql.org (Postfix) with SMTP id D1A2930DBC0 for ; Fri, 13 Jun 2003 16:42:16 -0300 (ADT) Received: (qmail 10167 invoked from network); 13 Jun 2003 20:00:52 -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; 13 Jun 2003 20:00:52 -0000 Date: Fri, 13 Jun 2003 13:45:48 -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: <423848393.20030613134548@acenet-tech.org> To: pgsql-sql@postgresql.org Subject: rpm scripts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200306/128 X-Sequence-Number: 13886 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 commands are easy enough in general... # service postgresql start # su postgres # createdb account # psql account < Pg-tables.sql # psql account < US_General-chart.sql # exit But, I need these functions to be executed when one installs my rpm. For Mysql, I have the following in the %post: -------------------snippet-from-spec------------------------------------------------------------------------------------- %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 catalog 2>&1 &> /dev/null if [ "$?" = "1" ] ; then /bin/echo "Creating catalog database..." /usr/bin/mysqladmin --password=$pw create catalog /bin/echo "grant all on catalog.* to catalog@localhost identified by 'shopuser';" | /usr/bin/mysql --password=$pw /usr/bin/mysql --password=$pw catalog < /home/e-smith/files/primary/html/store/catalog/install/oscommerce.sql /usr/bin/mysqladmin --password=$pw reload fi --------------end-of-snippet-from-spec----------------------------------------------------------------------------------- This creates a database using the root pasword (Mitel SME keeps this in ldap.pw (which is probably not needed for postgresql). What commands would I use to complete similar needs for a postgresql database to be created? Thank you for the 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.{{{