# --------------------------------------------------------------------
function mkInstallDirs {
- mkdir -p "$PREFIX";
- if [ "$?" != "0" ]; then
- fail "Error creating $PREFIX";
- fi
+ if installing; then
- mkdir -p "$TMP";
- if [ "$?" != "0" ]; then
- fail "Error creating $TMP";
- fi
+ mkdir -p "$PREFIX";
+ if [ "$?" != "0" ]; then
+ fail "Error creating $PREFIX";
+ fi
+
+ if [ ! -w "$PREFIX" ]; then
+ fail "We don't have write access to $PREFIX";
+ fi
- if [ ! -w "$PREFIX" ]; then
- fail "We don't have write access to $PREFIX";
fi
- if [ ! -w "$TMP" ]; then
- fail "We don't have write access to $TMP";
+ if building; then
+
+ mkdir -p "$TMP";
+ if [ "$?" != "0" ]; then
+ fail "Error creating $TMP";
+ fi
+
+ if [ ! -w "$TMP" ]; then
+ fail "We don't have write access to $TMP";
+ fi
fi
+
+
+}
+
+function installing {
+ if [ -z "$INSTALLING" ]; then return 1; fi;
+ return 0;
+}
+
+function building {
+ if [ -z "$BUILDING" ]; then return 1; fi;
+ return 0;
}
+
+
# --------------------------------------------------------------------
# Loads the config file. If it can't fine CONFIG_FILE, it attempts to
# use DEFAULT_CONFIG_FILE. If it can't find that, it fails.
function loadConfig {
if [ ! -f "$CONFIG_FILE" ]; then
if [ -f "$DEFAULT_CONFIG_FILE" ]; then
+ echo "+ + + Copying $DEFAULT_CONFIG_FILE to $CONFIG_FILE and using its settings...";
cp "$DEFAULT_CONFIG_FILE" "$CONFIG_FILE";
else
fail "config file \"$CONFIG_FILE\" cannot be found";
case "$target" in
- "jserver" | "router" | "gateway" | "srfsh" ) $MAKE -C "$OPENSRF_DIR" "$target" "$target-install";;
+ "jserver" | "router" | "gateway" | "srfsh" )
+ if building; then $MAKE -C "$OPENSRF_DIR" "$target"; fi;
+ if installing; then $MAKE -C "$OPENSRF_DIR" "$target-install"; fi;
+ ;;
*) fail "Unknown target: $target";;
case "$arg" in
"clean")
- make -C OpenSRF/src clean
- make -C Open-ILS/src clean
- make -C Evergreen/src clean;;
+ cleanMe;;
"force")
FORCE="1";;
+ "build")
+ BUILDING="1";;
+
+ "install")
+ INSTALLING="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
+
+function cleanMe {
+ loadConfig;
+ make -C "$OPENSRF_DIR" clean;
+ make -C "$OPENILS_DIR" clean;
+ make -C "$EVERGREEN_DIR" clean;
+}
+
checkParams "$@";
+if installing; then echo "Installing..."; fi;
# Kick it off...
runInstall;