Commit 142d7e63 by Eric Coissac

Adds a reload command to allow module reloading

parent 30ef5f77
......@@ -11,6 +11,7 @@
if [[ -z "${LECALIB_UTIL_SH}" ]]; then
LECALIB_UTIL_SH=1
LECABASHLIB_RELOADING=0
THIS_DIR="$(dirname ${BASH_SOURCE[0]})"
......@@ -39,12 +40,22 @@ if [[ -z "${LECALIB_UTIL_SH}" ]]; then
local MODULE=$(upper $1)
local LOADED_MODULE_VAR="LECALIB_${MODULE}_SH"
local LOADED_MODULE=$(indirect $LOADED_MODULE_VAR)
if [[ -z "${LOADED_MODULE}" ]]; then
if [[ -z "${LOADED_MODULE}" || "$LECABASHLIB_RELOADING" == 1 ]]; then
source "${LECALIB_DIR}/${1}.sh"
eval $LOADED_MODULE_VAR=1
if (( LECABASHLIB_RELOADING == 1 )) ; then
loginfo "Module $1 reloaded..."
fi
fi
}
function reload() {
LECABASHLIB_RELOADING=1
include "${1}"
LECABASHLIB_RELOADING=0
}
function onluke() {
[[ $(hostname | sed -E 's/^(....).*$/\1/') == "luke" ]]
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment