Skip to content

Commit

Permalink
Merge pull request #32 from grml/jkirk/timezone
Browse files Browse the repository at this point in the history
Set timezone before timedatectl set-local-rtc 1
  • Loading branch information
zeha authored Jan 30, 2025
2 parents 9c19104 + d5a8453 commit c015ac9
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions autoconfig.functions
Original file line number Diff line number Diff line change
Expand Up @@ -355,25 +355,22 @@ config_timezone(){
local timezone
timezone="$(getbootparam 'tz' 2>>$DEBUG)"

if [ -n "${timezone}" ] ; then
if ! [ -e "/usr/share/zoneinfo/${timezone}" ] ; then
ewarn "Warning: unknown timezone ${timezone}, falling back to UTC" ; eend 1
timezone="UTC"
fi

einfo "Setting timezone to ${timezone}"
ln -sf /usr/share/zoneinfo/"${timezone}" /etc/localtime
eend $?
fi

if checkbootparam 'localtime' ; then
einfo "Bootoption localtime is set, configuring RTC to local time."
timedatectl set-local-rtc 1
eend $?
fi

# nothing further to do for us if boot option isn't set
if [ -z "${timezone:-}" ] ; then
return 0
fi

if ! [ -e "/usr/share/zoneinfo/${timezone}" ] ; then
ewarn "Warning: unknown timezone ${timezone}, falling back to UTC" ; eend 1
timezone="UTC"
fi

einfo "Setting timezone to ${timezone}"
ln -sf /usr/share/zoneinfo/"${timezone}" /etc/localtime
eend $?
}
# }}}

Expand Down

0 comments on commit c015ac9

Please sign in to comment.