V8.13.404.2025.11.10
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -30,9 +30,15 @@ guard_sourcing || return "${ERR_GUARD_SRCE}"
|
||||
# 0: on success
|
||||
#######################################
|
||||
clean_up() {
|
||||
declare clean_exit_code="$1" fs_type=""
|
||||
declare clean_exit_code="$1" fs_type="" _old_nullglob="" _old_dotglob="" _old_failglob=""
|
||||
|
||||
### Enable nullglob/dotglob, disable failglob for safe globbing.
|
||||
_old_nullglob="$(shopt -p nullglob || true)"
|
||||
_old_dotglob="$( shopt -p dotglob || true)"
|
||||
_old_failglob="$(shopt -p failglob || true)"
|
||||
|
||||
shopt -s nullglob dotglob
|
||||
shopt -u failglob
|
||||
|
||||
rm -f -- "${VAR_KERNEL_INF}"
|
||||
rm -f -- "${VAR_KERNEL_SRT}"
|
||||
@@ -90,7 +96,21 @@ clean_up() {
|
||||
find "${VAR_TMP_SECRET}" -xdev -type f -print0 | xargs -0 --no-run-if-empty shred -fzu -n 5 --
|
||||
find "${VAR_TMP_SECRET}" -xdev -depth -type d -empty -delete
|
||||
|
||||
shopt -u nullglob dotglob
|
||||
# TODO: Activate shred
|
||||
### Securely shred all regular files below ./includes.chroot, then remove empty dirs.
|
||||
#if [[ -d "${VAR_HANDLER_BUILD_DIR}/config/includes.chroot" ]]; then
|
||||
|
||||
# shellcheck disable=SC2312
|
||||
# find "${VAR_HANDLER_BUILD_DIR}/config/includes.chroot" -xdev -type f -print0 | xargs -0 --no-run-if-empty shred -fzu -n 5 --
|
||||
|
||||
### Remove empty directories (bottom-up).
|
||||
# find "${VAR_HANDLER_BUILD_DIR}/config/includes.chroot" -depth -xdev -type d -empty -delete
|
||||
|
||||
#fi
|
||||
|
||||
eval "${_old_nullglob}" 2>/dev/null || true
|
||||
eval "${_old_dotglob}" 2>/dev/null || true
|
||||
eval "${_old_failglob}" 2>/dev/null || true
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user