From 3a3115650780a216ff46425b3861ec7ac3f644ad Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 6 Jul 2005 14:45:37 +0000 Subject: [PATCH] more install goodness now 'make' runs config.sh and install.sh make config runs config.sh make install runs install.sh make clean runs install.sh clean git-svn-id: svn://svn.open-ils.org/ILS/trunk@1075 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Makefile | 27 ++++++++++ config.sh | 117 +++++++++++++++++++++++++++++++++++++++++++ install.conf.default | 23 ++++++++- install.sh | 20 +++++--- 4 files changed, 177 insertions(+), 10 deletions(-) create mode 100644 Makefile create mode 100755 config.sh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..0447919c1a --- /dev/null +++ b/Makefile @@ -0,0 +1,27 @@ +#!/bin/bash +# -------------------------------------------------------------------- +# Copyright (C) 2005 Georgia Public Library Service +# Bill Erickson +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# -------------------------------------------------------------------- + +all: config install + +config: + ./config.sh + +install: + ./install.sh + +clean: + ./install.sh clean + diff --git a/config.sh b/config.sh new file mode 100755 index 0000000000..6b4cdfe9cb --- /dev/null +++ b/config.sh @@ -0,0 +1,117 @@ +#!/bin/bash +# -------------------------------------------------------------------- +# Copyright (C) 2005 Georgia Public Library Service +# Bill Erickson +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# -------------------------------------------------------------------- + + +CONFIG_FILE="install.conf"; +DEFAULT_CONFIG_FILE="install.conf.default"; + +function buildConfig { + + if [ -f "$DEFAULT_CONFIG_FILE" ]; then + source "$DEFAULT_CONFIG_FILE"; + fi; + + + echo ""; + echo "-----------------------------------------------------------------------"; + echo "Type Enter to select the default" + echo "-----------------------------------------------------------------------"; + + prompt "Install prefix [$PREFIX] "; + read X; + if [ ! -z "$X" ]; then PREFIX="$X"; fi; + + prompt "Temporary files directory [$TMP] " + read X; + if [ ! -z "$X" ]; then TMP="$X"; fi; + + prompt "Apache2 apxs binary [$APXS2] " + read X; + if [ ! -z "$X" ]; then APXS2="$X"; fi; + + prompt "Apache2 headers directory [$APACHE2_HEADERS] " + read X; + if [ ! -z "$X" ]; then APACHE2_HEADERS="$X"; fi; + + prompt "Libxml2 headers directory [$LIBXML2_HEADERS] " + read X; + if [ ! -z "$X" ]; then LIBXML2_HEADERS="$X"; fi; + + prompt "Build targets [${TARGETS[@]:0}] " + read X; + if [ ! -z "$X" ]; then TARGETS=("$X"); fi; + + + cat <<-WORDS + + ----------------------------------------------------------------------- + Verify the following install directories are sane. + Note: * indicates that you must have write privelages for the location + ----------------------------------------------------------------------- + + ----------------------------------------------------------------------- + Install prefix [$PREFIX]* + Temporary files directory [$TMP]* + Apache2 apxs binary [$APXS2] + Apache2 headers directory [$APACHE2_HEADERS] + Libxml2 headers directory [$LIBXML2_HEADERS] + Build targets [${TARGETS[@]:0}] + ----------------------------------------------------------------------- + + If these are not OK, use control-c to break out rerun this script. + Otherwise, type enter. + + WORDS + + read OK; + + writeConfig; +} + +function prompt { echo ""; echo -n "$*"; } + +function writeConfig { + + rm -f "$CONFIG_FILE"; + echo "Writing config to $CONFIG_FILE..."; + + _write "PREFIX=\"$PREFIX\""; + _write "TMP=\"$TMP\""; + _write "APXS2=\"$APXS2\""; + _write "APACHE2_HEADERS=\"$APACHE2_HEADERS\""; + _write "LIBXML2_HEADERS=\"$LIBXML2_HEADERS\""; + + # print out the targets + STR="TARGETS=("; + for target in ${TARGETS[@]:0}; do + STR="$STR \"$target\""; + done; + STR="$STR)"; + _write "$STR"; + + _write "OPENSRF_DIR=\"OpenSRF/src/\""; + _write "OPENILS_DIR=\"Open-ILS/src/\""; + _write "EVERGREEN_DIR=\"Evergreen/\""; + +} + +function _write { + echo "$*" >> "$CONFIG_FILE"; +} + + + +buildConfig; diff --git a/install.conf.default b/install.conf.default index a16f36a4dd..83c34d180c 100644 --- a/install.conf.default +++ b/install.conf.default @@ -1,3 +1,21 @@ +#!/bin/bash +# -------------------------------------------------------------------- +# Copyright (C) 2005 Georgia Public Library Service +# Bill Erickson +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# -------------------------------------------------------------------- + + + # -------------------------------------------------------------------- # Build targets. Options include: # @@ -25,14 +43,14 @@ TARGETS=("router" "gateway" "jserver" "srfsh"); # running install.sh must have write permissions to PREFIX # -------------------------------------------------------------------- #PREFIX="/tmp/testinstall/"; -PREFIX="/pines/"; +PREFIX="/tmp/ilsinstall/"; # -------------------------------------------------------------------- # Temporary build files go here. The User running install.sh must # have write permissions to TMP # -------------------------------------------------------------------- -TMP="/tmp/ilsinstall/"; +TMP="/tmp/ilstmp/"; # -------------------------------------------------------------------- @@ -66,3 +84,4 @@ LIBXML2_HEADERS="/usr/include/libxml2/"; OPENSRF_DIR="OpenSRF/src/"; OPENILS_DIR="Open-ILS/src/"; EVERGREEN_DIR="Evergreen/"; + diff --git a/install.sh b/install.sh index 219e43daa0..3513170d9a 100755 --- a/install.sh +++ b/install.sh @@ -100,10 +100,11 @@ function mkInstallDirs { # -------------------------------------------------------------------- function loadConfig { if [ ! -f "$CONFIG_FILE" ]; then - if [ -f "$DEFAULT_CONFIG_FILE" ]; - $CONFIG_FILE="$DEFAULT_CONFIG_FILE"; + if [ -f "$DEFAULT_CONFIG_FILE" ]; then + cp "$DEFAULT_CONFIG_FILE" "$CONFIG_FILE"; else fail "config file \"$CONFIG_FILE\" cannot be found"; + fi fi source "$CONFIG_FILE"; } @@ -113,7 +114,7 @@ function runInstall { loadConfig; - [ ! -z "$NOFORCE" ] && verifyInstallPaths; + #[ -z "$FORCE" ] && verifyInstallPaths; mkInstallDirs; # pass the collected variables to make @@ -153,27 +154,30 @@ function checkParams { if [ -z "$1" ]; then return; fi; - for arg in "$*"; do + for arg in "$@"; do + + lastArg="$arg"; case "$arg" in "clean") make -C OpenSRF/src clean make -C Open-ILS/src clean - make -C Evergreen/src clean - exit 0;; + make -C Evergreen/src clean;; "force") FORCE="1";; *) fail "Unknown command line argument: $arg";; esac - done + + echo "LAST $lastArg"; + if [ "$lastArg" = "clean" ]; then exit 0; fi; } # if user passes in the word 'clean' as the first shell arg, clean all -checkParams "$*"; +checkParams "$@"; # Kick it off... -- 2.43.2