diff --git a/pkg/init/build b/pkg/init/build index ac0d4c4..be86002 100755 --- a/pkg/init/build +++ b/pkg/init/build @@ -1,8 +1,8 @@ -VERSION="0.6" +VERSION="0.7" SRCDIR="init-${VERSION}" TARBALL="${SRCDIR}.tar.xz" URL="http://infraroot.at/pygos" -SHA256SUM="0a47cdeaf72a71a7cbc7440c42ff7db719ed92b4d39e99abe5af828a4d9fb664" +SHA256SUM="68759e2096dbf20e795e8c16c5e8b55ec6935c1020b12896a22abf6325b14370" DEPENDS="toolchain" prepare() { @@ -33,12 +33,21 @@ deploy() { ln -s "/share/init/swclocksave" "$DEPLOY/etc/init.d/swclocksave@shutdown" ln -s "/share/init/swclocksave" "$DEPLOY/etc/init.d/swclocksave@reboot" + ln -s "/share/init/swclocksave.gcron" "$DEPLOY/etc/gcron.d/swclocksave" echo "etc/init.d/swclocksave@shutdown m 777 0 0" >> "$DEPLOY/rootfs_files.txt" echo "etc/init.d/swclocksave@reboot m 777 0 0" >> "$DEPLOY/rootfs_files.txt" + echo "etc/gcron.d/swclocksave m 777 0 0" >> "$DEPLOY/rootfs_files.txt" mkdir -p "$DEPLOY/var/lib" date --utc +%m%d%H%M%Y.%S > "$DEPLOY/var/lib/swclock" echo "var/lib/swclock m 644 0 0" >> "$DEPLOY/rootfs_files.txt" + + if [ -z "$DHCP_PORTS" ]; then + ln -s "/share/init/ntpsetdate.gcron" "$DEPLOY/etc/gcron.d/ntpsetdate" + echo "etc/gcron.d/ntpsetdate m 777 0 0" >> "$DEPLOY/rootfs_files.txt" + else + echo "lib/libexec/dhcpcd-hooks/40-ntpsetdate m 555 0 0" >> "$DEPLOY/rootfs_files.txt" + fi fi svc=$(file_path_override "ifrename") diff --git a/pkg/init/lib/libexec/dhcpcd-hooks/40-ntpsetdate b/pkg/init/lib/libexec/dhcpcd-hooks/40-ntpsetdate new file mode 100644 index 0000000..be088c5 --- /dev/null +++ b/pkg/init/lib/libexec/dhcpcd-hooks/40-ntpsetdate @@ -0,0 +1,7 @@ +case "$reason" in +BOUND*) + /lib/libexec/init/setntpdate.sh + ;; +*) + ;; +esac diff --git a/pkg/init/rootfs_files.txt b/pkg/init/rootfs_files.txt index 11a4979..c2623e6 100644 --- a/pkg/init/rootfs_files.txt +++ b/pkg/init/rootfs_files.txt @@ -5,6 +5,7 @@ bin/shutdown m 555 0 0 bin/init m 555 0 0 bin/usyslogd m 555 0 0 bin/klogd m 555 0 0 +bin/gcrond m 555 0 0 lib/libexec/init m 555 0 0 lib/libexec/init/killall5 m 555 0 0 lib/libexec/init/runsvc m 555 0 0 @@ -15,6 +16,7 @@ lib/libexec/init/ifcfg.sh m 555 0 0 lib/libexec/init/ifdown.sh m 555 0 0 lib/libexec/init/modules_load.sh m 555 0 0 lib/libexec/init/overlay.sh m 555 0 0 +lib/libexec/init/setntpdate.sh m 555 0 0 share/init m 555 0 0 share/init/agetty m 444 0 0 share/init/hostname m 444 0 0 @@ -50,10 +52,15 @@ share/init/swclocksave m 444 0 0 share/init/nft m 444 0 0 share/init/sshd m 444 0 0 share/init/sshd_keygen m 444 0 0 +share/init/gcrond m 444 0 0 +share/init/consolefont m 444 0 0 +share/init/ntpsetdate.gcron m 444 0 0 +share/init/swclocksave.gcron m 444 0 0 etc/netcfg m 755 0 0 etc/modules m 644 0 0 etc/initd.env m 644 0 0 etc/init.d m 755 0 0 +etc/init.d/gcrond m 777 0 0 etc/init.d/loopback m 777 0 0 etc/init.d/hostname m 777 0 0 etc/init.d/sysctl m 777 0 0 @@ -78,3 +85,4 @@ etc/init.d/modules m 777 0 0 etc/init.d/network m 777 0 0 etc/init.d/ifdown@shutdown m 777 0 0 etc/init.d/ifdown@reboot m 777 0 0 +etc/gcron.d m 755 0 0 diff --git a/pkg/init/share/init/ntpsetdate.gcron b/pkg/init/share/init/ntpsetdate.gcron new file mode 100644 index 0000000..aa1f937 --- /dev/null +++ b/pkg/init/share/init/ntpsetdate.gcron @@ -0,0 +1,7 @@ +hour */4 +minute 5 +dayofmonth * +dayofweek * +month * +tty /dev/null +exec "/lib/libexec/init/setntpdate.sh"