From ded833d945b468aa0888ec9422d96623708b856c Mon Sep 17 00:00:00 2001 From: miker Date: Sun, 24 Jul 2005 20:49:07 +0000 Subject: [PATCH] initial bootstrapping "install dance" stuff git-svn-id: svn://svn.open-ils.org/ILS/trunk@1394 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/Makefile | 6 +++- Open-ILS/src/cgi-bin/circ-rules.cgi | 2 +- Open-ILS/src/cgi-bin/copy_statuses.cgi | 2 +- Open-ILS/src/cgi-bin/lib-setup.cgi | 2 +- Open-ILS/src/cgi-bin/org_unit_types.cgi | 2 +- Open-ILS/src/cgi-bin/perms-setup.cgi | 2 +- Open-ILS/src/cgi-bin/usr_group-setup.cgi | 2 +- config.sh | 42 ++++++++++++++++++++++++ install.conf.default | 14 ++++++++ install.sh | 6 ++++ 10 files changed, 73 insertions(+), 7 deletions(-) diff --git a/Open-ILS/src/Makefile b/Open-ILS/src/Makefile index eafd56d9ad..2d02e12841 100644 --- a/Open-ILS/src/Makefile +++ b/Open-ILS/src/Makefile @@ -1,6 +1,6 @@ all: -install: perl-install javascript-install web-templates-install string-templates-install +install: perl-install javascript-install web-templates-install string-templates-install storage-bootstrap marcdumper: make -C extras/marcdumper @@ -18,6 +18,10 @@ javascript-install: cp ../../$(OPENSRFDIR)/javascript/JSON.js $(WEBDIR)/util/ cp ../../$(OPENSRFDIR)/javascript/md5.js $(WEBDIR)/util/ +storage-bootstrap: + mkdir -p $(CGIDIR) + cp -r cgi-bin/* $(CGIDIR) + web-templates-install: mkdir -p $(TEMPLATEDIR) cp -r templates/opac $(TEMPLATEDIR) diff --git a/Open-ILS/src/cgi-bin/circ-rules.cgi b/Open-ILS/src/cgi-bin/circ-rules.cgi index 4e9738fba0..44d7799dc9 100755 --- a/Open-ILS/src/cgi-bin/circ-rules.cgi +++ b/Open-ILS/src/cgi-bin/circ-rules.cgi @@ -12,7 +12,7 @@ use CGI qw/:standard start_*/; our %config; do '../setup.pl'; -OpenILS::Application::Storage::CDBI->connection($config{dsn},$config{usr}); +OpenILS::Application::Storage::CDBI->connection($config{dsn},$config{usr},$config{pw}); OpenILS::Application::Storage::CDBI->db_Main->{ AutoCommit } = 1; my $cgi = new CGI; diff --git a/Open-ILS/src/cgi-bin/copy_statuses.cgi b/Open-ILS/src/cgi-bin/copy_statuses.cgi index bd5e926e98..eb31534d51 100755 --- a/Open-ILS/src/cgi-bin/copy_statuses.cgi +++ b/Open-ILS/src/cgi-bin/copy_statuses.cgi @@ -11,7 +11,7 @@ use CGI qw/:standard start_*/; our %config; do '../setup.pl'; -OpenILS::Application::Storage::CDBI->connection($config{dsn},$config{usr}); +OpenILS::Application::Storage::CDBI->connection($config{dsn},$config{usr},$config{pw}); OpenILS::Application::Storage::CDBI->db_Main->{ AutoCommit } = 1; my $cgi = new CGI; diff --git a/Open-ILS/src/cgi-bin/lib-setup.cgi b/Open-ILS/src/cgi-bin/lib-setup.cgi index 4b402cb903..ed3b187369 100755 --- a/Open-ILS/src/cgi-bin/lib-setup.cgi +++ b/Open-ILS/src/cgi-bin/lib-setup.cgi @@ -11,7 +11,7 @@ use CGI qw/:standard start_*/; our %config; do '../setup.pl'; -OpenILS::Application::Storage::CDBI->connection($config{dsn},$config{usr}); +OpenILS::Application::Storage::CDBI->connection($config{dsn},$config{usr},$config{pw}); OpenILS::Application::Storage::CDBI->db_Main->{ AutoCommit } = 1; my $cgi = new CGI; diff --git a/Open-ILS/src/cgi-bin/org_unit_types.cgi b/Open-ILS/src/cgi-bin/org_unit_types.cgi index 72ae4c8da7..d536852f60 100755 --- a/Open-ILS/src/cgi-bin/org_unit_types.cgi +++ b/Open-ILS/src/cgi-bin/org_unit_types.cgi @@ -12,7 +12,7 @@ use CGI qw/:standard start_*/; our %config; do '../setup.pl'; -OpenILS::Application::Storage::CDBI->connection($config{dsn},$config{usr}); +OpenILS::Application::Storage::CDBI->connection($config{dsn},$config{usr},$config{pw}); OpenILS::Application::Storage::CDBI->db_Main->{ AutoCommit } = 1; my $cgi = new CGI; diff --git a/Open-ILS/src/cgi-bin/perms-setup.cgi b/Open-ILS/src/cgi-bin/perms-setup.cgi index 0e58d69b9d..a91342b46a 100755 --- a/Open-ILS/src/cgi-bin/perms-setup.cgi +++ b/Open-ILS/src/cgi-bin/perms-setup.cgi @@ -12,7 +12,7 @@ use CGI qw/:standard start_*/; our %config; do '../setup.pl'; -OpenILS::Application::Storage::CDBI->connection($config{dsn},$config{usr}); +OpenILS::Application::Storage::CDBI->connection($config{dsn},$config{usr},$config{pw}); OpenILS::Application::Storage::CDBI->db_Main->{ AutoCommit } = 1; my $cgi = new CGI; diff --git a/Open-ILS/src/cgi-bin/usr_group-setup.cgi b/Open-ILS/src/cgi-bin/usr_group-setup.cgi index 6ec3759a6e..47332dcd70 100755 --- a/Open-ILS/src/cgi-bin/usr_group-setup.cgi +++ b/Open-ILS/src/cgi-bin/usr_group-setup.cgi @@ -12,7 +12,7 @@ use CGI qw/:standard start_*/; our %config; do '../setup.pl'; -OpenILS::Application::Storage::CDBI->connection($config{dsn},$config{usr}); +OpenILS::Application::Storage::CDBI->connection($config{dsn},$config{usr},$config{pw}); OpenILS::Application::Storage::CDBI->db_Main->{ AutoCommit } = 1; my $cgi = new CGI; diff --git a/config.sh b/config.sh index 522aeee4a3..935cdd531c 100755 --- a/config.sh +++ b/config.sh @@ -2,6 +2,7 @@ # -------------------------------------------------------------------- # Copyright (C) 2005 Georgia Public Library Service # Bill Erickson +# Mike Rylander # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -58,6 +59,7 @@ function buildConfig { PERLDIR="$LIBDIR/perl5/"; INCLUDEDIR="$PREFIX/include/"; WEBDIR="$PREFIX/web"; + CGIDIR="$PREFIX/cgi-bin"; ETCDIR="$PREFIX/etc"; TEMPLATEDIR="$PREFIX/templates"; fi @@ -80,6 +82,9 @@ function buildConfig { prompt "Web Root Directory [$WEBDIR] " read X; if [ ! -z "$X" ]; then WEBDIR="$X"; fi; + prompt "Web CGI Directory [$CGIDIR] " + read X; if [ ! -z "$X" ]; then CGIDIR="$X"; fi; + prompt "Templates directory [$TEMPLATEDIR] " read X; if [ ! -z "$X" ]; then TEMPLATEDIR="$X"; fi; @@ -95,6 +100,21 @@ function buildConfig { prompt "Build targets [${TARGETS[@]:0}] " read X; if [ ! -z "$X" ]; then TARGETS=("$X"); fi; + prompt "Bootstrapping Database Driver [$DBDRVR] " + read X; if [ ! -z "$X" ]; then DBDRVR="$X"; fi; + + prompt "Bootstrapping Database Host [$DBHOST] " + read X; if [ ! -z "$X" ]; then DBHOST="$X"; fi; + + prompt "Bootstrapping Database Name [$DBNAME] " + read X; if [ ! -z "$X" ]; then DBNAME="$X"; fi; + + prompt "Bootstrapping Database User [$DBUSER] " + read X; if [ ! -z "$X" ]; then DBUSER="$X"; fi; + + prompt "Bootstrapping Database Password [$DBPW] " + read X; if [ ! -z "$X" ]; then DBPW="$X"; fi; + writeConfig; } @@ -132,6 +152,28 @@ function writeConfig { _write "OPENILSDIR=\"Open-ILS/src/\""; _write "EVERGREENDIR=\"Evergreen/\""; + + # Now we'll write out the DB bootstrapping config + CONFIG_FILE='Open-ILS/src/cgi-bin/setup.pl'; + rm -f "$CONFIG_FILE"; + + STR='$main::config{dsn} ='; + STR="$STR 'dbi:${DBDRVR}:host="; + STR="${STR}${DBHOST};dbname="; + STR="${STR}${DBNAME}';"; + _write "$STR" + + STR='$main::config{usr} ='; + STR="$STR '$DBUSER';"; + _write "$STR" + + STR='$main::config{pw} ='; + STR="$STR '$DBPW';"; + _write "$STR" + + _write '$main::config{index} = "config.html";'; + + prompt "To write a new config, run 'make config'"; prompt ""; diff --git a/install.conf.default b/install.conf.default index d503b6431b..83ba8a5a8b 100644 --- a/install.conf.default +++ b/install.conf.default @@ -56,6 +56,7 @@ PERLDIR="$LIBDIR/perl5/"; INCLUDEDIR="$PREFIX/include/"; ETCDIR="$PREFIX/etc/"; WEBDIR="$PREFIX/web/"; +CGIDIR="$PREFIX/cgi-bin/"; TEMPLATEDIR="$PREFIX/templates"; @@ -98,3 +99,16 @@ OPENSRFDIR="OpenSRF/src/"; OPENILSDIR="Open-ILS/src/"; EVERGREENDIR="Evergreen/"; + + + +# -------------------------------------------------------------------- +# These are used to create the perl DBI DSN for the bootstrapping +# scripts. +# -------------------------------------------------------------------- +DBDRVR="Pg"; +DBHOST="127.0.0.1"; +DBNAME="demo-dev"; +DBUSER="postgres"; +DBPW=""; + diff --git a/install.sh b/install.sh index 08234d2608..e6bf5de16e 100755 --- a/install.sh +++ b/install.sh @@ -190,6 +190,12 @@ function runInstall { if installing; then $MAKE -C "$OPENILSDIR" "marcdumper-install"; fi; ;; + "openils_db" ) + if installing; then + $MAKE -C "$OPENILSDIR" "storage-bootstrap"; + fi; + ;; + # Evergreen --- -- 2.43.2