bootstrap:

- add options to overwrite installation root and config file
This commit is contained in:
2017-05-17 12:57:25 +02:00
parent f5bf857cee
commit e48198af59
+31 -17
View File
@@ -1,6 +1,7 @@
#!/bin/bash
declare BOOTSTRAP_DIR=$(dirname "$0")
unset PMODULES_ROOT
unset PMODULES_HOME
unset PMODULES_VERSION
@@ -9,30 +10,43 @@ source "${BOOTSTRAP_DIR}/Pmodules/libstd.bash"
declare -r BOOTSTRAP_DIR=$(std::get_abspath "${BOOTSTRAP_DIR}")
declare -r SRC_DIR="${BOOTSTRAP_DIR}/Pmodules"
std::read_versions "${BOOTSTRAP_DIR}/config/versions.conf"
declare config_file="${BOOTSTRAP_DIR}/config/environment.bash"
declare opt_force='no'
while (( $# > 0 )); do
case $1 in
--install-root )
PMODULES_ROOT="$2"
shift 1
;;
--install-root=* )
PMODULES_ROOT="${1#*=}"
;;
-* )
echo "Unknown option: $1" 1>&2
exit 1
;;
* )
echo "Invalid argument: $1" 1>&2
exit 1
;;
--config )
config_file="$2"
shift 1
;;
--config=* )
config_file="${1#*=}"
;;
--install-root )
PMODULES_ROOT="$2"
shift 1
;;
--install-root=* )
PMODULES_ROOT="${1#*=}"
;;
-f | --force )
opt_force='yes'
;;
-* )
echo "Unknown option: $1" 1>&2
exit 1
;;
* )
echo "Invalid argument: $1" 1>&2
exit 1
;;
esac
shift 1
done
source "${BOOTSTRAP_DIR}/config/environment.bash"
std::read_versions "${BOOTSTRAP_DIR}/config/versions.conf"
source "${config_file}"
if [[ ! -d "${PMODULES_ROOT}" ]]; then
read -p "The requested root directory does not exist. Create it? [y|N] " -n 1 ans