From 7f63d46e4ff07943ae5130395bcbb73a841148ec Mon Sep 17 00:00:00 2001 From: vanhofen Date: Sat, 19 Dec 2020 21:49:49 +0100 Subject: [PATCH] - change dummy date handling; fix camd_datefix script --- make/target-files.mk | 4 ++++ make/target-scripts.mk | 2 +- skel-root/general/files-etc/init.d/rcS-hd1 | 2 +- skel-root/general/files-etc/init.d/rcS-hd2 | 2 +- skel-root/general/files-etc/init.d/rcS-hd5x | 2 +- skel-root/general/files-etc/init.d/rcS-hd6x | 2 +- skel-root/general/files-etc/init.d/rcS-vuduo | 2 +- skel-root/general/files-etc/init.d/rcS-vuplus | 2 +- skel-root/general/scripts/camd_datefix.init | 7 ++++++- 9 files changed, 17 insertions(+), 8 deletions(-) diff --git a/make/target-files.mk b/make/target-files.mk index 7cb44e84..9375725f 100644 --- a/make/target-files.mk +++ b/make/target-files.mk @@ -6,6 +6,7 @@ files-etc: \ $(TARGET_sysconfdir)/default/rcS \ $(TARGET_sysconfdir)/network/interfaces \ + $(TARGET_sysconfdir)/date-dummy \ $(TARGET_sysconfdir)/exports \ $(TARGET_sysconfdir)/filesystems \ $(TARGET_sysconfdir)/fstab \ @@ -31,6 +32,9 @@ else $(INSTALL_DATA) -D $(TARGET_FILES)/files-etc/network/interfaces $(@) endif +$(TARGET_sysconfdir)/date-dummy: + echo "$(shell date +%Y)01010000" > $(@) + $(TARGET_sysconfdir)/exports: ifeq ($(PERSISTENT_VAR_PARTITION), yes) $(INSTALL_DATA) -D $(TARGET_FILES)/files-etc/exports-var $(TARGET_localstatedir)/etc/exports diff --git a/make/target-scripts.mk b/make/target-scripts.mk index 6948ab88..bf780f63 100644 --- a/make/target-scripts.mk +++ b/make/target-scripts.mk @@ -51,7 +51,7 @@ ifeq ($(BOXMODEL), $(filter $(BOXMODEL), vusolo4k vuduo4k vuduo4kse vuultimo4k v else $(INSTALL_EXEC) -D $(TARGET_FILES)/files-etc/init.d/rcS-$(BOXSERIES) $(@) endif - $(SED) "s|%(BOXMODEL)|$(BOXMODEL)|g; s|%(YEAR)|$(shell date +%Y)|g" $(@) + $(SED) "s|%(BOXMODEL)|$(BOXMODEL)|g" $(@) $(TARGET_sysconfdir)/init.d/rcK: $(INSTALL_EXEC) -D $(TARGET_FILES)/files-etc/init.d/rcK $(@) diff --git a/skel-root/general/files-etc/init.d/rcS-hd1 b/skel-root/general/files-etc/init.d/rcS-hd1 index 5dedcd07..ffdd1f90 100644 --- a/skel-root/general/files-etc/init.d/rcS-hd1 +++ b/skel-root/general/files-etc/init.d/rcS-hd1 @@ -48,7 +48,7 @@ mkdir -p /var/run/wpa_supplicant dmesg -n 1 # set dummy date -date -s "%(YEAR)-01-01 00:00" +test -e /etc/date-dummy && date -s "$(cat /etc/date-dummy)" # create nodes # diff --git a/skel-root/general/files-etc/init.d/rcS-hd2 b/skel-root/general/files-etc/init.d/rcS-hd2 index beea3290..79d33a93 100644 --- a/skel-root/general/files-etc/init.d/rcS-hd2 +++ b/skel-root/general/files-etc/init.d/rcS-hd2 @@ -56,7 +56,7 @@ mkdir -p /var/run/wpa_supplicant dmesg -n 1 # set dummy date -date -s "%(YEAR)-01-01 00:00" +test -e /etc/date-dummy && date -s "$(cat /etc/date-dummy)" # automatic restore if [ -e /var/backup_flash.tar.gz ]; then diff --git a/skel-root/general/files-etc/init.d/rcS-hd5x b/skel-root/general/files-etc/init.d/rcS-hd5x index 1d83b458..f82073fd 100644 --- a/skel-root/general/files-etc/init.d/rcS-hd5x +++ b/skel-root/general/files-etc/init.d/rcS-hd5x @@ -52,7 +52,7 @@ mkdir -p /var/run/wpa_supplicant dmesg -n 1 # set dummy date -date -s "%(YEAR)-01-01 00:00" +test -e /etc/date-dummy && date -s "$(cat /etc/date-dummy)" # automatic restore if [ -e /var/backup_flash.tar.gz ]; then diff --git a/skel-root/general/files-etc/init.d/rcS-hd6x b/skel-root/general/files-etc/init.d/rcS-hd6x index 1d83b458..f82073fd 100644 --- a/skel-root/general/files-etc/init.d/rcS-hd6x +++ b/skel-root/general/files-etc/init.d/rcS-hd6x @@ -52,7 +52,7 @@ mkdir -p /var/run/wpa_supplicant dmesg -n 1 # set dummy date -date -s "%(YEAR)-01-01 00:00" +test -e /etc/date-dummy && date -s "$(cat /etc/date-dummy)" # automatic restore if [ -e /var/backup_flash.tar.gz ]; then diff --git a/skel-root/general/files-etc/init.d/rcS-vuduo b/skel-root/general/files-etc/init.d/rcS-vuduo index 9efc8aa0..6ba4eee7 100644 --- a/skel-root/general/files-etc/init.d/rcS-vuduo +++ b/skel-root/general/files-etc/init.d/rcS-vuduo @@ -48,7 +48,7 @@ mkdir -p /var/run/wpa_supplicant dmesg -n 1 # set dummy date -date -s "%(YEAR)-01-01 00:00" +test -e /etc/date-dummy && date -s "$(cat /etc/date-dummy)" # automatic restore if [ -e /var/backup_flash.tar.gz ]; then diff --git a/skel-root/general/files-etc/init.d/rcS-vuplus b/skel-root/general/files-etc/init.d/rcS-vuplus index 9c8e93fc..158fd1a6 100644 --- a/skel-root/general/files-etc/init.d/rcS-vuplus +++ b/skel-root/general/files-etc/init.d/rcS-vuplus @@ -48,7 +48,7 @@ mkdir -p /var/run/wpa_supplicant dmesg -n 1 # set dummy date -date -s "%(YEAR)-01-01 00:00" +test -e /etc/date-dummy && date -s "$(cat /etc/date-dummy)" # automatic restore if [ -e /var/backup_flash.tar.gz ]; then diff --git a/skel-root/general/scripts/camd_datefix.init b/skel-root/general/scripts/camd_datefix.init index 4e4355e0..3bf8a23f 100644 --- a/skel-root/general/scripts/camd_datefix.init +++ b/skel-root/general/scripts/camd_datefix.init @@ -10,9 +10,14 @@ FLAGFILE="/var/etc/.$2" case "$1" in "start") + if [ ! -e /etc/date-dummy ]; then + SHOWINFO "can't work. /etc/date-dummy is missing" + exit 1 + fi + DATE_DUMMY=$(cat /etc/date-dummy) DATE_TODAY=$(date +%Y%m%d%H%M) # keep line below in sync with dummy time in rcS - if [ "${DATE_TODAY:0:8}" = "20170101" ]; then + if [ "${DATE_TODAY:0:8}" = "${DATE_DUMMY:0:8}" ]; then # try to read date from flagfile test -e $FLAGFILE && \ DATE_FLAG=$(date -r $FLAGFILE +%Y%m%d%H%M)