From: Jason Etheridge Date: Tue, 9 Jul 2013 19:20:06 +0000 (-0400) Subject: adds arguments for full-auto install and run X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=16b981746ce9ca5e44c416fc05de8dab9e2a7e29;p=working%2Frandom.git adds arguments for full-auto install and run -y will supply yes or enter presses to every prompt the installer would otherwise ask for, and supply 'evergreen' as the default password for the evergreen database user, and also automate the editing of /etc/hosts -a will automatically start OpenSRF, modify some Apache settings, and restart Apache This commit also changes the default branch from collab/berick/debian-wheezy-install-target to collab/berick/per-distro-install-makefiles and makes shallow git clones Thanks to Bill and Lebbeous for help on this. Signed-off-by: Jason Etheridge --- diff --git a/installer/wheezy/eg_wheezy_installer.sh b/installer/wheezy/eg_wheezy_installer.sh index 37c75a943..91621dd0f 100755 --- a/installer/wheezy/eg_wheezy_installer.sh +++ b/installer/wheezy/eg_wheezy_installer.sh @@ -27,11 +27,34 @@ ADMIN_PASS='demo123'; # ----------------------------------------------------------------------- # ----------------------------------------------------------------------- +# Handling passed arguments to the script +# ----------------------------------------------------------------------- +while getopts ay option +do + case "${option}" + in + a) AUTOSTART=1;; + y) YES=1;; + esac +done + +# ----------------------------------------------------------------------- # force CPAN to load by installing something that should already be installed -cpan Fcntl +if [ $YES ]; then + yes | cpan Fcntl +else + cpan Fcntl +fi # CPAN follow pre-reqs? if [ ! "$(echo 'o conf prerequisites_policy' | cpan | grep follow)" ]; then +if [ $YES ]; then + + echo "setting cpan prerequisites_policy to follow" + echo -e "o conf prerequisites_policy follow\\n o conf commit" | cpan + +else + echo ' ----------------------------------------------------------------------- @@ -50,8 +73,9 @@ echo -e "o conf prerequisites_policy ask\n o conf commit" | cpan fi; done; fi; -# ----------------------------------------------------------------------- +fi; +# ----------------------------------------------------------------------- # And they're off... BASE_DIR=$PWD @@ -73,19 +97,29 @@ export LD_LIBRARY_PATH=/openils/lib:/usr/local/lib:/usr/local/lib/dbd:$LD_LIBRAR fi; # XXX for now, fetch the debian-wheezy install target working branches and merge in master -# XXX The git-config pieces are only necessary for merging the working branches -OSRF_COMMAND=' +# You can override these like so: EVERGREEN_BRANCH='master' ./eg_wheezy_installer.sh +OPENSRF_REPO='git://git.evergreen-ils.org/OpenSRF.git' +OPENSRF_BRANCH='master' +EVERGREEN_REPO='git://git.evergreen-ils.org/working/Evergreen.git' +EVERGREEN_BRANCH='collab/berick/per-distro-install-makefiles' +OSRF_COMMAND=" cd /home/opensrf; -git clone git://git.evergreen-ils.org/OpenSRF.git; -git clone git://git.evergreen-ils.org/Evergreen.git; -' +git clone --depth 0 --branch $OPENSRF_BRANCH $OPENSRF_REPO OpenSRF; +git clone --depth 0 --branch $EVERGREEN_BRANCH $EVERGREEN_REPO Evergreen; +" +rm -rf /home/opensrf/Evergreen /home/opensrf/OpenSRF su - opensrf sh -c "$OSRF_COMMAND"; # Install pre-reqs mkdir -p /usr/src/evergreen; cd /usr/src/evergreen; -make -f /home/opensrf/OpenSRF/src/extras/Makefile.install debian-wheezy -make -f /home/opensrf/Evergreen/Open-ILS/src/extras/Makefile.install debian-wheezy install_pgsql_server_debs_91 +if [ $YES ]; then + yes | make -f /home/opensrf/OpenSRF/src/extras/Makefile.install debian-wheezy + yes | make -f /home/opensrf/Evergreen/Open-ILS/src/extras/Makefile.install debian-wheezy postgres-server-debian-wheezy +else + make -f /home/opensrf/OpenSRF/src/extras/Makefile.install debian-wheezy + make -f /home/opensrf/Evergreen/Open-ILS/src/extras/Makefile.install debian-wheezy postgres-server-debian-wheezy +fi; # Configure rsyslog and restart cp /home/opensrf/Evergreen/Open-ILS/examples/evergreen-rsyslog.conf /etc/rsyslog.d/evergreen.conf @@ -140,7 +174,7 @@ cp /openils/conf/opensrf_core.xml.example /openils/conf/opensrf_core.xml # fetch and install Dojo cd /tmp; -wget "http://download.dojotoolkit.org/release-$DOJO_VERSION/dojo-release-$DOJO_VERSION.tar.gz"; +wget -N "http://download.dojotoolkit.org/release-$DOJO_VERSION/dojo-release-$DOJO_VERSION.tar.gz"; tar -zxf dojo-release-$DOJO_VERSION.tar.gz; cp -r dojo-release-$DOJO_VERSION/* /openils/var/web/js/dojo/; @@ -151,8 +185,13 @@ chown -R opensrf:opensrf /openils cp /openils/conf/srfsh.xml.example /home/opensrf/.srfsh.xml; chown opensrf:opensrf /home/opensrf/.srfsh.xml; -echo -e "\n\nPlease enter a password for the evergreen database user.\n If you do not want to edit configs, use \"evergreen\"\n" -su - postgres sh -c 'createuser -P -s evergreen;' +if [ $YES ]; then + echo "Using password evergreen for the evergreen database user." + echo -e "evergreen\nevergreen\n" | su - postgres sh -c 'createuser -P -s evergreen;' +else + echo -e "\n\nPlease enter a password for the evergreen database user.\n If you do not want to edit configs, use \"evergreen\"\n" + su - postgres sh -c 'createuser -P -s evergreen;' +fi; # Apply the DB schema cd /home/opensrf/Evergreen @@ -177,7 +216,11 @@ cp Open-ILS/examples/apache/eg_startup /etc/apache2/ mkdir -p /etc/apache2/ssl; if [ ! -f /etc/apache2/ssl/server.key ] ; then echo -e "\n\nConfiguring a new temporary SSL certificate....\n"; - openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/server.crt -keyout /etc/apache2/ssl/server.key + if [ $YES ]; then + yes "" | openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/server.crt -keyout /etc/apache2/ssl/server.key + else + openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/server.crt -keyout /etc/apache2/ssl/server.key + fi; else echo -e "\nkeeping existing ssl/server.key file\n"; fi @@ -188,8 +231,14 @@ a2enmod expires a2dissite 000-default a2ensite eg.conf - if [ ! "$(grep 'public.localhost' /etc/hosts)" ]; then + + if [ $YES ]; then + echo 'Adding public.localhost and private.localhost to /etc/hosts' + echo '127.0.1.2 public.localhost public' >> /etc/hosts + echo '127.0.1.3 private.localhost private' >> /etc/hosts + else + cat <