diff options
author | 2013-09-06 15:34:05 +0200 | |
---|---|---|
committer | 2013-09-06 15:34:05 +0200 | |
commit | e412ce185f1e516d30373edf8e1f63292c418160 (patch) | |
tree | 591bb0e703c5d2a6c13a6c95a2822702e7ccbf85 /files | |
parent | not-installed: enable 'git-commit-overlay' hook by default (diff) | |
download | R_overlay-e412ce185f1e516d30373edf8e1f63292c418160.tar.gz R_overlay-e412ce185f1e516d30373edf8e1f63292c418160.tar.bz2 R_overlay-e412ce185f1e516d30373edf8e1f63292c418160.zip |
allow files/shlib/functions.sh to be used standalone
Setting FUNCTIONS_STANDALONE=y allows to use the functions file without
roverlay's hook env.
Diffstat (limited to 'files')
-rw-r--r-- | files/shlib/functions.sh | 60 |
1 files changed, 43 insertions, 17 deletions
diff --git a/files/shlib/functions.sh b/files/shlib/functions.sh index 405ed3a..ccf6d48 100644 --- a/files/shlib/functions.sh +++ b/files/shlib/functions.sh @@ -79,24 +79,50 @@ if [ -z "${__HAVE_CORE_FUNCTIONS__-}" ]; then readonly __HAVE_CORE_FUNCTIONS__=y -## make some env vars readonly - -readonly FUNCTIONS -[ -z "${SHLIB-}" ] || readonly SHLIB -[ -z "${DATADIR-}" ] || readonly DATADIR -[ -z "${ROVERLAY_HOOKRC-}" ] || readonly ROVERLAY_HOOKRC - -readonly DEBUG VERBOSE QUIET NO_COLOR - -readonly \ - ROVERLAY_PHASE \ - EBUILD ROVERLAY_EXE ROVERLAY_HELPER_EXE \ - OVERLAY S OVERLAY_NAME \ - DISTROOT \ - TMPDIR T \ - ADDITIONS_DIR FILESDIR WORKDIR \ - NOSYNC HAS_CHANGES +if [ "${FUNCTIONS_STANDALONE:-n}" = "y" ]; then + : ${DEBUG:=n} + : ${VERBOSE:=y} + : ${QUIET:=n} + : ${NO_COLOR:=n} + readonly DEBUG VERBOSE QUIET NO_COLOR + + : ${NOSYNC:=n} + + if \ + [ "${ROVERLAY_INSTALLED:-n}" = "y" ] || \ + { [ -z "${ROVERLAY_INSTALLED-}" ] && [ -d /usr/share/roverlay ]; } + then + : ${ROVERLAY_INSTALLED:=y} + readonly DATADIR="/usr/share/roverlay" + SHLIB="${DATADIR}/shlib${SHLIB:+:}${SHLIB-}" + FUNCTIONS="${SHLIB}/functions.sh" + else + : ${ROVERLAY_INSTALLED:=n} + [ -z "${FUNCTIONS-}" ] || \ + SHLIB="$(dirname "${FUNCTIONS}")${SHLIB:+:}${SHLIB-}" + fi +else + ## make some env vars readonly + : ${FUNCTIONS?} + + readonly FUNCTIONS + [ -z "${SHLIB-}" ] || readonly SHLIB + [ -z "${DATADIR-}" ] || readonly DATADIR + [ -z "${ROVERLAY_HOOKRC-}" ] || readonly ROVERLAY_HOOKRC + + readonly DEBUG VERBOSE QUIET NO_COLOR + + readonly \ + ROVERLAY_PHASE \ + EBUILD ROVERLAY_EXE ROVERLAY_HELPER_EXE \ + OVERLAY S OVERLAY_NAME \ + DISTROOT \ + TMPDIR T \ + ADDITIONS_DIR FILESDIR WORKDIR \ + NOSYNC HAS_CHANGES + +fi # FUNCTIONS_STANDALONE ## vars / constants |