pdksh hack for sourcing include files
This commit is contained in:
parent
976f1f8b84
commit
bab155e752
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
# ------------------------- CONFIGURATION starts here -------------------------
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
# define the version (YYYY-MM-DD)
|
# define the version (YYYY-MM-DD)
|
||||||
typeset -r SCRIPT_VERSION="2019-06-18"
|
typeset -r SCRIPT_VERSION="2019-07-16"
|
||||||
# location of parent directory containing KSH functions/HC plugins
|
# location of parent directory containing KSH functions/HC plugins
|
||||||
typeset -r FPATH_PARENT="/opt/hc/lib"
|
typeset -r FPATH_PARENT="/opt/hc/lib"
|
||||||
# location of custom HC configuration files
|
# location of custom HC configuration files
|
||||||
@ -244,20 +244,47 @@ then
|
|||||||
print -u2 "ERROR: library file ${FPATH_PARENT}/core/include_core(.sh) is not present (tip: run --fix-symlinks)"
|
print -u2 "ERROR: library file ${FPATH_PARENT}/core/include_core(.sh) is not present (tip: run --fix-symlinks)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# include include_*
|
|
||||||
find ${FPATH_PARENT}/core -name "include_*.sh" -type f -print 2>/dev/null | while read INCLUDE_FILE
|
# PDKSH hack (IS_PDKSH is not yet set here)
|
||||||
do
|
case "${KSH_VERSION}" in
|
||||||
if [[ -h ${INCLUDE_FILE%%.sh} ]]
|
*MIRBSD*|*PD*|*LEGACY*)
|
||||||
then
|
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
(( ARG_DEBUG > 0 )) && print -u2 "DEBUG: including ${INCLUDE_FILE}"
|
. ${FPATH_PARENT}/core/include_core.sh
|
||||||
# shellcheck source=/dev/null
|
if [[ -r ${FPATH_PARENT}/core/include_data.sh && -h ${FPATH_PARENT}/core/include_data ]]
|
||||||
. ${INCLUDE_FILE}
|
then
|
||||||
else
|
# shellcheck source=/dev/null
|
||||||
print -u2 "ERROR: library file ${INCLUDE_FILE} exists but has no symlink. Run --fix-symlinks"
|
(( ARG_DEBUG > 0 )) && print -u2 "DEBUG: including ${FPATH_PARENT}/core/include_data.sh"
|
||||||
exit 1
|
. ${FPATH_PARENT}/core/include_data.sh
|
||||||
fi
|
else
|
||||||
done
|
print -u2 "ERROR: library file ${FPATH_PARENT}/core/include_data.sh is not present (tip: run --fix-symlinks)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ -r ${FPATH_PARENT}/core/include_os.sh && -h ${FPATH_PARENT}/core/include_os ]]
|
||||||
|
then
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
(( ARG_DEBUG > 0 )) && print -u2 "DEBUG: including ${FPATH_PARENT}/core/include_os.sh"
|
||||||
|
. ${FPATH_PARENT}/core/include_os.sh
|
||||||
|
else
|
||||||
|
print -u2 "ERROR: library file ${FPATH_PARENT}/core/include_os.sh is not present (tip: run --fix-symlinks)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# include include_*
|
||||||
|
find ${FPATH_PARENT}/core -name "include_*.sh" -type f -print 2>/dev/null | while read INCLUDE_FILE
|
||||||
|
do
|
||||||
|
if [[ -h ${INCLUDE_FILE%%.sh} ]]
|
||||||
|
then
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
(( ARG_DEBUG > 0 )) && print -u2 "DEBUG: including ${INCLUDE_FILE}"
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
. ${INCLUDE_FILE}
|
||||||
|
else
|
||||||
|
print -u2 "ERROR: library file ${INCLUDE_FILE} exists but has no symlink. Run --fix-symlinks"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
esac
|
||||||
|
|
||||||
# check for core directories
|
# check for core directories
|
||||||
[[ -d ${ARCHIVE_DIR} ]] || mkdir -p "${ARCHIVE_DIR}" >/dev/null 2>&1
|
[[ -d ${ARCHIVE_DIR} ]] || mkdir -p "${ARCHIVE_DIR}" >/dev/null 2>&1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user