[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: in-progress install script



The line which says:

cat <<CREATE_USER | $pgslq_cmd

Should be:

cat <<CREATE_USER | $pgsql_cmd

Also, would it be more correct for the line which is:

for i in `grep -v -E '^#' sql/modules/LOADORDER`

To be?:

for i in `grep -v -E '^[[:space:]]*#' sql/modules/LOADORDER`

Luke


On Wed, 25 May 2011, Erik Huelsmann wrote:

Hi Chris,


The script below is an in-progress install script that should reduce
the amount of knowledge required to get LSMB installed.

This is really only the first bits, but I'm posting here for review
and general comments.

I want to extend the script with 'getopt' functionality for parsing
command line arguments and a description/usage screen describing the
arguments which can be used. The sed-transformation of the
ledgersmb-httpd.conf should also be added to the script.

Since we depend on Perl, I imagine it would be best to rewrite the
script in Perl: that way it becomes independent from the OS and might
/ will benefit Windows users just as well.

Please note: the script is currently meant to be run as root and untested.

Bye,

Erik.

================================
#!/bin/sh

PASS=LEDGERSMBINITIALPASS
HOST=localhost
SRCDIR=$PWD
DSTDIR=$PWD
COA=us/General.sql
GIFI=us/whatever.sql
ADMIN_FIRSTNAME='Default'
ADMIN_MIDDLENAME=NULL
ADMIN_LASTNAME='Admin'
ADMIN_USERNAME='admin'
ADMIN_PASSWORD='admin'

set -x

psql_args=-h $HOST --password $PASS -U ledgersmb
psql_cmd=psql $psql_args -d $company_name

su -c "createuser -h $HOST --superuser -U postgres --password $PASS
--no-inherit --encrypted ledgersmb" postgres

createdb $psql_args -O ledgersmb -E UNICODE $company_name
createlang $psql_args plpgsql $company_name

cat $SRCDIR/sql/Pg-database.sql | psql -h $HOST -U ledgersmb \
 --password $PASS -d $company_name


for i in `grep -v -E '^#' sql/modules/LOADORDER`
do
 cat $SRCDIR/sql/modules/$i | $psql_cmd
done

cat $SRCDIR/sql/$COA | $psql_cmd

if test -n "$GIFI" ; then
 cat $SRCDIR/sql/$GIFI | $psql_cmd
fi

sed -e "s/<\?lsmb dbname \?>/$company_name/g" $SRCDIR/sql/modules/Roles.sql \
 | $psql_cmd

cat <<CREATE_USER | $pgslq_cmd
SELECT admin__save_user(NULL,
                       person__save(NULL,
                                    3,
                                    $ADMIN_FIRSTNAME,
                                    $ADMIN_MIDDLENAME,
                                    $ADMIN_LASTNAME,
                                    (SELECT id FROM country
                                     WHERE short_name = 'US')),
                       $ADMIN_USERNAME,
                       $ADMIN_PASSWORD);

SELECT admin__add_user_to_role($ADMIN_USERNAME, rolname)
FROM pg_roles
WHERE rolname like 'lsmb_$company_name%';

CREATE_USER
=======================================

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery,
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now.
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Ledger-smb-devel mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel