|
|
@ -21,8 +21,16 @@ if [ -z "${TIMEZONE}" ]; then
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if ! timedatectl set-timezone "${TIMEZONE}" 2>/dev/null; then
|
|
|
|
if ! timedatectl set-timezone "${TIMEZONE}" 2>/dev/null; then
|
|
|
|
if [ -f "/usr/share/zoneinfo/${TIMEZONE}" ]; then
|
|
|
|
_tz_base='/usr/share/zoneinfo/'
|
|
|
|
ln -sf "/usr/share/zoneinfo/${TIMEZONE}" /etc/localtime
|
|
|
|
_tz_dest=$(realpath "${_tz_base}${TIMEZONE}" 2>/dev/null)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# if timezone file path is resolvable file and
|
|
|
|
|
|
|
|
# real path is inside the timezone directory
|
|
|
|
|
|
|
|
if [ -n "${_tz_dest}" ] &&
|
|
|
|
|
|
|
|
[ -f "${_tz_dest}" ] &&
|
|
|
|
|
|
|
|
[[ "${_tz_dest}" =~ ^${_tz_base} ]];
|
|
|
|
|
|
|
|
then
|
|
|
|
|
|
|
|
ln -sf "${_tz_dest}" /etc/localtime
|
|
|
|
else
|
|
|
|
else
|
|
|
|
echo "ERROR: Invalid timezone '${TIMEZONE}'" >&2
|
|
|
|
echo "ERROR: Invalid timezone '${TIMEZONE}'" >&2
|
|
|
|
exit 1
|
|
|
|
exit 1
|
|
|
|