V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m54s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m54s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -15,7 +15,9 @@ guard_sourcing
|
||||
#######################################
|
||||
# Configure the '/etc/timezone' | '/etc/localtime' files.
|
||||
# Globals:
|
||||
# RECOVERY
|
||||
# TARGET
|
||||
# VAR_RUN_RECOVERY
|
||||
# ntp_timezone
|
||||
# Arguments:
|
||||
# None
|
||||
@@ -23,17 +25,26 @@ guard_sourcing
|
||||
# 0: on success
|
||||
#######################################
|
||||
setup_timezone() {
|
||||
### Create '${TARGET}/etc/timezone' file.
|
||||
cat << EOF >| "${TARGET}/etc/timezone"
|
||||
### Declare Arrays, HashMaps, and Variables.
|
||||
declare var_target="${TARGET}"
|
||||
|
||||
### Check for TARGET / RECOVERY.
|
||||
[[ "${VAR_RUN_RECOVERY}" == "true" ]] && var_target="${RECOVERY}"
|
||||
|
||||
### Create the '$ {var_target}/etc / timezone' file.
|
||||
cat << EOF >| "${var_target}/etc/timezone"
|
||||
${ntp_timezone:-UTC}
|
||||
EOF
|
||||
chmod 0644 "${TARGET}/etc/timezone"
|
||||
do_log "info" "file_only" "4040() File generated: '${TARGET}/etc/timezone' | timezone '${ntp_timezone:-UTC}'."
|
||||
chmod 0644 "${var_target}/etc/timezone"
|
||||
do_log "info" "file_only" "4040() File generated: '${var_target}/etc/timezone' | timezone '${ntp_timezone:-UTC}'."
|
||||
|
||||
chroot_exec "${TARGET}" ln -sf "/usr/share/zoneinfo/${ntp_timezone}" /etc/localtime
|
||||
chroot_exec "${var_target}" ln -sf "/usr/share/zoneinfo/${ntp_timezone}" /etc/localtime
|
||||
|
||||
chroot_exec "${TARGET}" dpkg-reconfigure -f noninteractive tzdata
|
||||
chroot_exec "${var_target}" dpkg-reconfigure -f noninteractive tzdata
|
||||
|
||||
guard_dir && return 0
|
||||
}
|
||||
### Prevents accidental 'unset -f'.
|
||||
# shellcheck disable=SC2034
|
||||
readonly -f setup_timezone
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||
|
||||
Reference in New Issue
Block a user