[SQL] rpm scripts

2003-06-13 Thread Craig Jensen
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 [EMAIL PROTECTED] 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 Jensenmailto:[EMAIL PROTECTED]


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.{{{



---(end of broadcast)---
TIP 9: most folks find a random_page_cost between 1 or 2 is ideal


[SQL] help with rpm script

2003-07-01 Thread Craig Jensen
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 [EMAIL PROTECTED] 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 Jensenmailto:[EMAIL PROTECTED]


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.{{{



---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster