kumquat-buildroot/package/tzdata/tzdata.mk
Yann E. MORIN e7e526e910 system: require a timezone to be set
Even though no timezone implicitly means UTC, systemd is not all that
happy when it does not have a timezone set. This is all fine on a RW
filesystem because systemd will create a symlink on its own (to
Etc/UTC), but not so much on a RO filesystem, causing all kind of
issues at boot time (up to the point that the system is unusable).

We fix that by requiring that the timezone is actually set. The check is
done by verifying that the timezone file is an actual file; if not set,
the test would find a directory and would thus fail.

Update the help entry accordingly.

Also fix indentation in tzdata.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Richard Braun <rbraun@sceen.net>
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Martin Bark <martin@barkynet.com>
Cc: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-07-04 09:00:05 +02:00

64 lines
2.0 KiB
Makefile

################################################################################
#
# tzdata
#
################################################################################
TZDATA_VERSION = 2017b
TZDATA_SOURCE = tzdata$(TZDATA_VERSION).tar.gz
TZDATA_SITE = http://www.iana.org/time-zones/repository/releases
TZDATA_STRIP_COMPONENTS = 0
TZDATA_DEPENDENCIES = host-tzdata
HOST_TZDATA_DEPENDENCIES = host-zic
TZDATA_LICENSE = Public domain
# Take care when re-ordering this list since this might break zone
# dependencies
TZDATA_DEFAULT_ZONELIST = \
africa antarctica asia australasia europe northamerica \
southamerica pacificnew etcetera backward systemv factory
ifeq ($(call qstrip,$(BR2_TARGET_TZ_ZONELIST)),default)
TZDATA_ZONELIST = $(TZDATA_DEFAULT_ZONELIST)
else
TZDATA_ZONELIST = $(call qstrip,$(BR2_TARGET_TZ_ZONELIST))
endif
TZDATA_LOCALTIME = $(call qstrip,$(BR2_TARGET_LOCALTIME))
# No need to extract for target, we're using the host-installed files
TZDATA_EXTRACT_CMDS =
define TZDATA_INSTALL_TARGET_CMDS
$(INSTALL) -d -m 0755 $(TARGET_DIR)/usr/share/zoneinfo
cp -a $(HOST_DIR)/usr/share/zoneinfo/* $(TARGET_DIR)/usr/share/zoneinfo
cd $(TARGET_DIR)/usr/share/zoneinfo; \
for zone in posix/*; do \
ln -sfn "$${zone}" "$${zone##*/}"; \
done
if [ ! -f $(TARGET_DIR)/usr/share/zoneinfo/$(TZDATA_LOCALTIME) ]; then \
printf "Error: '%s' is not a valid timezone, check your BR2_TARGET_LOCALTIME setting\n" \
"$(TZDATA_LOCALTIME)"; \
exit 1; \
fi
ln -sf ../usr/share/zoneinfo/$(TZDATA_LOCALTIME) $(TARGET_DIR)/etc/localtime
echo "$(TZDATA_LOCALTIME)" >$(TARGET_DIR)/etc/timezone
endef
define HOST_TZDATA_BUILD_CMDS
(cd $(@D); \
for zone in $(TZDATA_ZONELIST); do \
$(ZIC) -d _output/posix -y yearistype.sh $$zone || exit 1; \
$(ZIC) -d _output/right -L leapseconds -y yearistype.sh $$zone || exit 1; \
done; \
)
endef
define HOST_TZDATA_INSTALL_CMDS
$(INSTALL) -d -m 0755 $(HOST_DIR)/usr/share/zoneinfo
cp -a $(@D)/_output/* $(@D)/*.tab $(HOST_DIR)/usr/share/zoneinfo
endef
$(eval $(generic-package))
$(eval $(host-generic-package))