Skip to content

Commit

Permalink
Merge pull request #301 from grml/zeha/timezone
Browse files Browse the repository at this point in the history
Update /etc/timezone only if it exists
  • Loading branch information
zeha authored Jan 15, 2025
2 parents 12cce02 + 8b9d174 commit 9a29828
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
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

0 comments on commit 9a29828

Please sign in to comment.