So, i've tried dinit on real aarch64 board. Since it has no rtc, i have to sync time via ntp but this brings up two porblems:
1) ntpd must be started after system has internet connection
2) ntpdate must be run before ntpd
In order solve 1) i created service named dhcpc with following contents (maybe different will fir better):
type = internal
waits-for.d = dhcpc.d
Since i use dhclient on this board, i linked that service to dhcpc.d. Now any service which requires network connection can depend on dhcpc
For 2) i created scripted service ntpd-pre as follows:
type = scripted
command = /etc/dinit.d/scripts/ntpd-pre
restart = false
waits-for = setup
depends-on = dhcpc
I put here restart=false since, as i understand (which may be wrong) the script will be also restarted after successful termination. The script for it is:
#!/bin/sh
[ -r /etc/dinit.d/config/ntpd.conf ] && . /etc/dinit.d/config/ntpd.conf
# exit immediately if there are no configured ntpdate servers
[ -z ${NTPDATE_SERVERS} ] && exit 0
while [ /bin/true ]; do
[ ! -z ${NTPDATE_SERVERS} ] && ntpdate ${NTPDATE_SERVERS} && exit 0
sleep 1s
done
So, it should only exit if ntpdate is not needed or it has synced time. I made ntpd-pre a hard dependency for ntpd.
Although this approach works, it looks like boot process is stuck until this script exits. Could there be a better solution?