mirror of
https://github.com/Pmodules/Pmodules.git
synced 2026-06-28 02:19:39 +02:00
bootstrap:
- add options to overwrite installation root and config file
This commit is contained in:
+31
-17
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user