aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorAndré Erdmann <dywi@mailerd.de>2014-05-07 03:26:50 +0200
committerAndré Erdmann <dywi@mailerd.de>2014-05-07 03:26:50 +0200
commitb66b35e438437f20aeb2e0f24e2ec06654b33b8b (patch)
treee5ebb9964333914d0283d2e60dbe55b55f9b6e8d /bin
parentfix deprule (diff)
downloadR_overlay-b66b35e438437f20aeb2e0f24e2ec06654b33b8b.tar.gz
R_overlay-b66b35e438437f20aeb2e0f24e2ec06654b33b8b.tar.bz2
R_overlay-b66b35e438437f20aeb2e0f24e2ec06654b33b8b.zip
bin/: add roverlay-others
Runs roverlay with ROVERLAY_TARGET_TYPE=foreign
Diffstat (limited to 'bin')
-rwxr-xr-xbin/invoke_pyscript.bash39
l---------[-rwxr-xr-x]bin/roverlay25
l---------bin/roverlay.others1
3 files changed, 37 insertions, 28 deletions
diff --git a/bin/invoke_pyscript.bash b/bin/invoke_pyscript.bash
index 41af30d..574405e 100755
--- a/bin/invoke_pyscript.bash
+++ b/bin/invoke_pyscript.bash
@@ -1,10 +1,41 @@
#!/bin/bash
-readonly SCRIPT=$(readlink -f "${BASH_SOURCE[0]?}")
-readonly SCRIPT_NAME="${BASH_SOURCE[0]##*/}"
+readonly SCRIPT="$(readlink -f "${BASH_SOURCE[0]?}")"
+readonly SCRIPT_FILENAME="${BASH_SOURCE[0]##*/}"
readonly SCRIPT_DIR="${SCRIPT%/*}"
-
readonly PRJROOT="${SCRIPT_DIR%/*}"
-readonly PYSCRIPT="${SCRIPT_DIR}/py/${SCRIPT_NAME%.*}.py"
+
+extra_args=()
+
+SCRIPT_NAME="${SCRIPT_FILENAME%.py}"
+case "${SCRIPT_NAME}" in
+ *[-_.]others)
+ export ROVERLAY_TARGET_TYPE="foreign"
+ SCRIPT_NAME="${SCRIPT_NAME%[-_.]*}"
+ ;;
+ *)
+ : ${ROVERLAY_TARGET_TYPE:=gentoo}
+ SCRIPT_NAME="${SCRIPT_NAME}"
+ ;;
+esac
+
+case "${SCRIPT_NAME}" in
+ 'roverlay') SCRIPT_NAME="main" ;;
+esac
+readonly SCRIPT_NAME
+
+if [[ "${ROVERLAY_TARGET_TYPE}" == "foreign" ]]; then
+ case "${SCRIPT_NAME#roverlay[_-]}" in
+ 'setup')
+ extra_args+=( '--target-type' 'foreign' "$@" )
+ ;;
+ 'main'|'query'[-_]'config'|'status')
+ extra_args+=( '-c' "${PRJROOT}/R-overlay.conf.others" "$@" )
+ ;;
+ esac
+fi
+
+readonly PYSCRIPT="${SCRIPT_DIR}/py/${SCRIPT_NAME}.py"
+[ ${#extra_args[@]} -eq 0 ] || set -- "${extra_args[@]}" "$@"
export ROVERLAY_PRJROOT="${PRJROOT}"
export PYTHONPATH="${PRJROOT}${PYTHONPATH:+:}${PYTHONPATH}"
diff --git a/bin/roverlay b/bin/roverlay
index 3c385b8..3f5df48 100755..120000
--- a/bin/roverlay
+++ b/bin/roverlay
@@ -1,24 +1 @@
-#!/bin/bash
-# similar to invoke_pyscript.bash, but uses a fixed SCRIPT_NAME
-#
-readonly SCRIPT=$(readlink -f "${BASH_SOURCE[0]?}")
-readonly SCRIPT_NAME="main"
-readonly SCRIPT_DIR="${SCRIPT%/*}"
-
-readonly PRJROOT="${SCRIPT_DIR%/*}"
-readonly PYSCRIPT="${SCRIPT_DIR}/py/${SCRIPT_NAME%.*}.py"
-
-export ROVERLAY_PRJROOT="${PRJROOT}"
-export PYTHONPATH="${PRJROOT}${PYTHONPATH:+:}${PYTHONPATH}"
-
-
-cd "${PRJROOT}" || exit
-
-if [[ -z "${PYTHON-}" ]] && [[ -x "${PYSCRIPT}" ]]; then
- exec ${PYSCRIPT} "$@"
-elif [[ -f "${PYSCRIPT}" ]]; then
- exec ${PYTHON:-python} ${PYSCRIPT} "$@"
-else
- echo "script not found: ${PYSCRIPT}" 1>&2
- exit 9
-fi
+invoke_pyscript.bash \ No newline at end of file
diff --git a/bin/roverlay.others b/bin/roverlay.others
new file mode 120000
index 0000000..3f5df48
--- /dev/null
+++ b/bin/roverlay.others
@@ -0,0 +1 @@
+invoke_pyscript.bash \ No newline at end of file