replace opttargetdir with _TARGET_DIR

This commit is contained in:
Tobias Powalowski 2023-10-12 09:10:33 +02:00
parent 0622a98494
commit afc81afd48

View file

@ -14,7 +14,7 @@ _CONFIG=""
_INITCPIO=/lib/initcpio/install _INITCPIO=/lib/initcpio/install
# options and runtime data # options and runtime data
_GENERATE_IMAGE="" _GENERATE_IMAGE=""
_opttargetdir='' _TARGET_DIR=""
declare -A _addedmodules _modpaths declare -A _addedmodules _modpaths
# Sanitize environment further # Sanitize environment further
# GREP_OPTIONS="--color=always" will break everything # GREP_OPTIONS="--color=always" will break everything
@ -144,7 +144,7 @@ while :; do
;; ;;
-d) -d)
shift shift
_opttargetdir="$1" ${_TARGET_DIR}="$1"
;; ;;
-g) -g)
shift shift
@ -182,8 +182,8 @@ fi
_KERNELVERSION="$(_kver "${KERNEL}")" _KERNELVERSION="$(_kver "${KERNEL}")"
_d_kmoduledir="/lib/modules/${_KERNELVERSION}" _d_kmoduledir="/lib/modules/${_KERNELVERSION}"
[[ -d "$_d_kmoduledir" ]] || die "'$_d_kmoduledir' is not a valid kernel module directory" [[ -d "$_d_kmoduledir" ]] || die "'$_d_kmoduledir' is not a valid kernel module directory"
_d_workdir="$(initialize_buildroot "${_KERNELVERSION}" "$_opttargetdir")" || exit 1 _d_workdir="$(initialize_buildroot "${_KERNELVERSION}" "${_TARGET_DIR}")" || exit 1
BUILDROOT="${_opttargetdir:-$_d_workdir/root}" BUILDROOT="${_TARGET_DIR}:-$_d_workdir/root}"
_hooks=("${HOOKS[@]}") _hooks=("${HOOKS[@]}")
if (( ${#_hooks[*]} == 0 )); then if (( ${#_hooks[*]} == 0 )); then
die "Invalid config: No hooks found" die "Invalid config: No hooks found"
@ -196,7 +196,7 @@ if [[ -n "${_GENERATE_IMAGE}" ]]; then
die "Unable to write to '%s'" "${_GENERATE_IMAGE}" die "Unable to write to '%s'" "${_GENERATE_IMAGE}"
fi fi
msg "Starting build: '%s'" "${_KERNELVERSION}" msg "Starting build: '%s'" "${_KERNELVERSION}"
elif [[ -n "$_opttargetdir" ]]; then elif [[ -n "${_TARGET_DIR}" ]]; then
msg "Starting build: '%s'" "${_KERNELVERSION}" msg "Starting build: '%s'" "${_KERNELVERSION}"
else else
msg "Starting dry run: '%s'" "${_KERNELVERSION}" msg "Starting dry run: '%s'" "${_KERNELVERSION}"
@ -214,7 +214,7 @@ rm -f -- "$BUILDROOT/var/cache/ldconfig/aux-cache"
umask 077 umask 077
if [[ -n "${_GENERATE_IMAGE}" ]]; then if [[ -n "${_GENERATE_IMAGE}" ]]; then
build_image "${_GENERATE_IMAGE}" "${COMPRESSION}" || exit 1 build_image "${_GENERATE_IMAGE}" "${COMPRESSION}" || exit 1
elif [[ -n "$_opttargetdir" ]]; then elif [[ -n "${_TARGET_DIR}" ]]; then
msg "Build complete." msg "Build complete."
else else
msg "Dry run complete, use -g IMAGE to generate a real image" msg "Dry run complete, use -g IMAGE to generate a real image"