Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update /etc/timezone only if it exists #301

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions chroot-script
Original file line number Diff line number Diff line change
Expand Up @@ -471,9 +471,12 @@ timezone() {
echo "Adjusting /etc/localtime"
ln -sf "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime

echo "Setting /etc/timezone to $TIMEZONE"
printf '%s\n' "$TIMEZONE" > /etc/timezone

if [ -e /etc/timezone ] ; then
# not necessary for trixie or newer, see tzdata 2024b-6 changelog.
# https://salsa.debian.org/glibc-team/tzdata/-/commit/c071fbc167ad306394b576879d515e6ecbe5a734
echo "Setting /etc/timezone to $TIMEZONE"
printf '%s\n' "$TIMEZONE" > /etc/timezone
fi
fi
}
# }}}
Expand Down
2 changes: 1 addition & 1 deletion config
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
# Default: 'en_US:en'
# DEFAULT_LANGUAGE='en_US:en'

# Use /usr/share/zoneinfo/$TIMEZONE for /etc/localtime + set /etc/timezone.
# Use /usr/share/zoneinfo/$TIMEZONE for /etc/localtime.
# Default: 'Europe/Vienna'
# TIMEZONE='Europe/Vienna'

Expand Down
3 changes: 0 additions & 3 deletions tests/goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ process:
running: true

file:
/etc/timezone:
exists: true
contains: ["Europe/Vienna"]
/etc/localtime:
filetype: symlink
exists: true
Expand Down
Loading