V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m0s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m0s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
54
lib/cdi_0060_traps/0090_clean_up.sh
Normal file
54
lib/cdi_0060_traps/0090_clean_up.sh
Normal file
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
# SPDX-Version: 3.0
|
||||
# SPDX-CreationInfo: 2025-05-05; WEIDNER, Marc S.; <msw@coresecret.dev>
|
||||
# SPDX-ExternalRef: GIT https://git.coresecret.dev/msw/CISS.debian.live.builder.git
|
||||
# SPDX-FileContributor: WEIDNER, Marc S.; Centurion Intelligence Consulting Agency
|
||||
# SPDX-FileCopyrightText: 2024-2025; WEIDNER, Marc S.; <msw@coresecret.dev>
|
||||
# SPDX-FileType: SOURCE
|
||||
# SPDX-License-Identifier: EUPL-1.2 OR LicenseRef-CCLA-1.0
|
||||
# SPDX-LicenseComment: This file is part of the CISS.debian.installer.secure framework.
|
||||
# SPDX-PackageName: CISS.debian.live.builder
|
||||
# SPDX-Security-Contact: security@coresecret.eu
|
||||
|
||||
guard_sourcing
|
||||
|
||||
#######################################
|
||||
# Clean Up Wrapper on Trap on 'EXIT'.
|
||||
# Globals:
|
||||
# LOG_ERR
|
||||
# VAR_KERNEL_INF
|
||||
# VAR_KERNEL_SRT
|
||||
# VAR_KERNEL_TMP
|
||||
# VAR_NOTES
|
||||
# Arguments:
|
||||
# 1: ${var_trap_on_exit_code} of trap_exit()
|
||||
# Returns:
|
||||
# 0: On success
|
||||
#######################################
|
||||
clean_up() {
|
||||
declare var_clean_exit_code="$1"
|
||||
|
||||
rm -f -- "${VAR_KERNEL_INF}"
|
||||
rm -f -- "${VAR_KERNEL_SRT}"
|
||||
rm -f -- "${VAR_KERNEL_TMP}"
|
||||
rm -f -- "${VAR_NOTES}"
|
||||
|
||||
if [[ "${VAR_CHROOT_ACTIVATED}" == "system" ]]; then
|
||||
exiting_chroot_system
|
||||
elif [[ "${VAR_CHROOT_ACTIVATED}" == "recovery" ]]; then
|
||||
exiting_chroot_recovery
|
||||
fi
|
||||
|
||||
### Release advisory lock on FD 127.
|
||||
flock -u 127
|
||||
|
||||
### Close file descriptor 127.
|
||||
exec 127>&-
|
||||
|
||||
### Remove the lockfile artifact.
|
||||
rm -f /run/lock/ciss_debian_installer.lock
|
||||
if (( var_clean_exit_code == 0 )); then rm -f -- "${LOG_ERR}"; fi
|
||||
|
||||
return 0
|
||||
}
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||
Reference in New Issue
Block a user