2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-04 20:17:55 +00:00

feat(postscripts): require package utility loading

This commit is contained in:
Vinícius Ferrão
2026-08-28 15:45:55 -03:00
parent b2ad18137b
commit c00ed7c181
4 changed files with 64 additions and 0 deletions
+16
View File
@@ -25,6 +25,22 @@
#set -x
XCATPKGUTILS_LOADER="$(dirname "$0")/xcatpkgutils-loader.sh"
if [ ! -r "$XCATPKGUTILS_LOADER" ]; then
printf 'Error: package utility loader is not readable: %s\n' "$XCATPKGUTILS_LOADER" >&2
unset XCATPKGUTILS_LOADER
exit 1
fi
# shellcheck source-path=SCRIPTDIR
# shellcheck source=xcatpkgutils-loader.sh
# shellcheck disable=SC1091
if ! . "$XCATPKGUTILS_LOADER"; then
printf 'Error: package utilities could not be loaded through: %s\n' "$XCATPKGUTILS_LOADER" >&2
unset XCATPKGUTILS_LOADER
exit 1
fi
unset XCATPKGUTILS_LOADER
if [ -n "$LOGLABEL" ]; then
log_label=$LOGLABEL
else
+17
View File
@@ -24,6 +24,23 @@
#enable debug
#set -x
XCATPKGUTILS_LOADER="$(dirname "$0")/xcatpkgutils-loader.sh"
if [ ! -r "$XCATPKGUTILS_LOADER" ]; then
printf 'Error: package utility loader is not readable: %s\n' "$XCATPKGUTILS_LOADER" >&2
unset XCATPKGUTILS_LOADER
exit 1
fi
# shellcheck source-path=SCRIPTDIR
# shellcheck source=xcatpkgutils-loader.sh
# shellcheck disable=SC1091
if ! . "$XCATPKGUTILS_LOADER"; then
printf 'Error: package utilities could not be loaded through: %s\n' "$XCATPKGUTILS_LOADER" >&2
unset XCATPKGUTILS_LOADER
exit 1
fi
unset XCATPKGUTILS_LOADER
if [ -n "$LOGLABEL" ]; then
log_label=$LOGLABEL
else
+24
View File
@@ -0,0 +1,24 @@
#!/bin/sh
# EPL license http://www.eclipse.org/legal/epl-v10.html
xcatpkgutils="$(dirname "$0")/xcatpkgutils.sh"
if [ ! -r "$xcatpkgutils" ]; then
printf 'Error: package utility library is not readable: %s\n' "$xcatpkgutils" >&2
unset xcatpkgutils
return 1
fi
unset XCATPKGUTILS_LOADED
# shellcheck source-path=SCRIPTDIR
# shellcheck source=xcatpkgutils.sh
if ! . "$xcatpkgutils"; then
printf 'Error: package utility library could not be loaded: %s\n' "$xcatpkgutils" >&2
unset XCATPKGUTILS_LOADED xcatpkgutils
return 1
fi
if [ "${XCATPKGUTILS_LOADED:-}" != "1" ]; then
printf 'Error: package utility library did not finish loading: %s\n' "$xcatpkgutils" >&2
unset XCATPKGUTILS_LOADED xcatpkgutils
return 1
fi
unset XCATPKGUTILS_LOADED xcatpkgutils
+7
View File
@@ -0,0 +1,7 @@
#!/bin/sh
# EPL license http://www.eclipse.org/legal/epl-v10.html
# Shared POSIX shell helpers for the ospkgs and otherpkgs postscripts.
# Keep the marker assignment last so callers know the whole library loaded.
# shellcheck disable=SC2034
XCATPKGUTILS_LOADED=1