Severity: minor
In the past, it was possible to replace the contents of /etc/timezone, run dpkg-reconfigure tzdata and have the system update it's timezone without any user interaction. This is particularly handy when combined with DHCP servers that serve the timezone information.
However, since the move to the symlink instead of a file, this is no longer possible. This is caused by this snippet in tzdata's config file:
# If /etc/localtime is a link, update /etc/timezone
if [ -L /etc/localtime ] ; then
TIMEZONE="$(readlink /etc/localtime)"
TIMEZONE="${TIMEZONE#/usr/share/zoneinfo/}"
if [ -f "/usr/share/zoneinfo/$TIMEZONE" ] ; then
echo ${TIMEZONE} > /etc/timezone
fi
fi
# Read /etc/timezone
if [ -e /etc/timezone ]; then
TIMEZONE="$(head -n 1 /etc/timezone)"
TIMEZONE="${TIMEZONE%% *}"
TIMEZONE="${TIMEZONE##/}"
TIMEZONE="${TIMEZONE%%/}"
TIMEZONE="$(convert_timezone $TIMEZONE)"
if [ -f "/usr/share/zoneinfo/$TIMEZONE" ] ; then
AREA="${TIMEZONE%%/*}"
ZONE="${TIMEZONE#*/}"
else
rm -f /etc/timezone
fi
fi
Which means that the symlink takes precedence over the file. In the end, in order to make a programmatical change, I would need to re do what tzdata does regarding translating the string into a symlink (fixing the timezone along the way), which means unnecessary code duplication.
Some possibilities to change this:
A) Remove the symlink reading code from the config (or only use it if the /etc/timezone file is missing)
B) Provide a separate tool that takes a string and does what tzdata maint scripts do (convert the timezone, split it, update the symlink, etc).
For systemd systems, it's possible to do:
timedatectl set-timezone <timezone>
However, for non systemd systems, this is now impossible.