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

SF.net SVN: ledger-smb:[2560] trunk/install-mycompany.sh



Revision: 2560
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2560&view=rev
Author:   jfkw
Date:     2009-04-14 00:44:38 +0000 (Tue, 14 Apr 2009)

Log Message:
-----------
Add transient script install-mycompany.sh to run through INSTALL quickly.

This script is a temporary development aid to run the INSTALL procedure
verbatim. That procedure is being developed and streamlined. This is not a
general purpose installer.

This script should be extended with all steps necessary to bootstrap the
LedgerSMB 1.3 code to a working instance.

Added Paths:
-----------
    trunk/install-mycompany.sh

Added: trunk/install-mycompany.sh
===================================================================
--- trunk/install-mycompany.sh	                        (rev 0)
+++ trunk/install-mycompany.sh	2009-04-14 00:44:38 UTC (rev 2560)
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+echo 'This script will create a mycompany dataset per INSTALL. Ctrl-C to cancel.'
+
+dropdb -i -U postgres mycompany ; 
+for role in `psql -U postgres -t -c "SELECT rolname FROM pg_roles WHERE rolname LIKE 'lsmb_mycompany%';"`; do dropuser -U postgres $role; done
+dropuser -U postgres myuser ; 
+createdb -U postgres -O ledgersmb mycompany ; 
+createlang plpgsql mycompany ; 
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/sql/Pg-database.sql ;
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/sql/modules/Drafts.sql ; 
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/sql/modules/chart.sql ; 
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/sql/modules/Account.sql ; 
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/sql/modules/Session.sql ; 
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/sql/modules/Business_type.sql ; 
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/sql/modules/Location.sql ; 
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/sql/modules/Company.sql ; 
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/sql/modules/Customer.sql ; 
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/sql/modules/Date.sql ; 
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/sql/modules/Defaults.sql ; 
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/sql/modules/Settings.sql ; 
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/sql/modules/Employee.sql ; 
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/sql/modules/Entity.sql ; 
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/sql/modules/Payment.sql ; 
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/sql/modules/Person.sql ; 
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/sql/modules/Report.sql ; 
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/sql/modules/Voucher.sql ; 
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/sql/modules/Reconciliation.sql ; 
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/sql/modules/Inventory.sql ; 
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/sql/modules/Vendor.sql ; 
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/sql/coa/us/chart/General.sql
+sed -e "s/<?lsmb dbname ?>/mycompany/g" /path/to/ledgersmb13/sql/modules/Roles.sql > /path/to/ledgersmb13/mycompany_roles.sql ; 
+psql -U postgres -d mycompany -f /path/to/ledgersmb13/mycompany_roles.sql ; 
+createuser --no-superuser --createdb --no-createrole -U postgres --pwprompt --encrypted myuser ; 
+psql -U postgres -d mycompany -t -c "INSERT INTO entity (name, entity_class, created) VALUES ('myuser', 3, NOW()) RETURNING name, entity_class, created;" ; 
+psql -U postgres -d mycompany -t -c "INSERT INTO person (entity_id, first_name, last_name, created) VALUES (2, 'Firstname', 'Lastname', NOW()) RETURNING entity_id, first_name, last_name, created;" ; 
+psql -U postgres -d mycompany -t -c "INSERT INTO entity_employee (person_id, entity_id, startdate, role) VALUES (1, 2, NOW(), 'myuser') RETURNING person_id, entity_id, startdate, role;" ; 
+psql -U postgres -d mycompany -t -c "INSERT INTO users (username, entity_id) VALUES ('myuser', 2) RETURNING username, entity_id;" ; 
+psql -U postgres -d mycompany -t -c "INSERT INTO user_preference (id) VALUES (1) RETURNING id;" ; 
+psql -U postgres -d mycompany -t -c "CREATE OR REPLACE FUNCTION grant_all_roles(in_login varchar) RETURNS INT as \$\$ DECLARE role_info RECORD; BEGIN FOR role_info IN select * from pg_roles WHERE rolname LIKE 'lsmb%' LOOP EXECUTE 'GRANT ' || role_info.rolname || ' TO ' || in_login; END LOOP; RETURN 1; END; \$\$ language plpgsql;" ; 
+psql -U postgres -d mycompany -t -c "SELECT grant_all_roles('myuser');" ; 


Property changes on: trunk/install-mycompany.sh
___________________________________________________________________
Added: svn:executable
   + *


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.