Sync network time when a connection comes up
This commit is contained in:
1 parent
38d54f10ff
commit
9ac39ce6bf
13 files changed
+365
-8
No files matched your search
@@ -110,6 +110,24 @@ mkdir -p "$TARGET_ROOTFS/home/user/.local/share/sxmo/modem" \
|
||||
chown -R 10000:10000 "$TARGET_ROOTFS/home/user" 2>/dev/null || true
|
||||
chown 0:0 "$TARGET_ROOTFS/etc/doas.d/50-sxmo.conf" 2>/dev/null || true
|
||||
chmod 640 "$TARGET_ROOTFS/etc/doas.d/50-sxmo.conf" 2>/dev/null || true
|
||||
# The time-sync helper uses chronyd's root-only Unix command socket, so keep
|
||||
# its scripts root-owned and executable, and let the chrony user write the
|
||||
# driftfile (rebuild-image.sh re-applies this after normalising all UIDs).
|
||||
chown 0:0 "$TARGET_ROOTFS/etc/chrony/chrony.conf" \
|
||||
"$TARGET_ROOTFS/usr/bin/bananarchy-time-sync.sh" \
|
||||
"$TARGET_ROOTFS/etc/init.d/bananarchy-time-sync" \
|
||||
"$TARGET_ROOTFS/etc/NetworkManager/dispatcher.d/20-bananarchy-time-sync.sh" \
|
||||
2>/dev/null || true
|
||||
chmod 0644 "$TARGET_ROOTFS/etc/chrony/chrony.conf" 2>/dev/null || true
|
||||
chmod 0755 "$TARGET_ROOTFS/usr/bin/bananarchy-time-sync.sh" \
|
||||
"$TARGET_ROOTFS/etc/init.d/bananarchy-time-sync" \
|
||||
"$TARGET_ROOTFS/etc/NetworkManager/dispatcher.d/20-bananarchy-time-sync.sh" \
|
||||
2>/dev/null || true
|
||||
CHRONY_UID="$(awk -F: '/^chrony:/ {print $3}' "$TARGET_ROOTFS/etc/passwd" 2>/dev/null || true)"
|
||||
CHRONY_GID="$(awk -F: '/^chrony:/ {print $4}' "$TARGET_ROOTFS/etc/passwd" 2>/dev/null || true)"
|
||||
mkdir -p "$TARGET_ROOTFS/var/lib/chrony"
|
||||
chown -R "${CHRONY_UID:-101}:${CHRONY_GID:-102}" "$TARGET_ROOTFS/var/lib/chrony" 2>/dev/null || true
|
||||
chmod 0750 "$TARGET_ROOTFS/var/lib/chrony" 2>/dev/null || true
|
||||
mkdir -p "$TARGET_ROOTFS/etc/bananarchy"
|
||||
chown 0:0 "$TARGET_ROOTFS/etc/bananarchy" 2>/dev/null || true
|
||||
chmod 0700 "$TARGET_ROOTFS/etc/bananarchy" 2>/dev/null || true
|
||||
@@ -304,6 +322,7 @@ rm -rf \
|
||||
"$TARGET_ROOTFS/var/log/logbookd.db"*
|
||||
ln -sf /etc/init.d/kill-plymouth "$TARGET_ROOTFS/etc/runlevels/default/kill-plymouth"
|
||||
ln -sf /etc/init.d/bananarchy-power-policy "$TARGET_ROOTFS/etc/runlevels/default/bananarchy-power-policy"
|
||||
ln -sf /etc/init.d/bananarchy-time-sync "$TARGET_ROOTFS/etc/runlevels/default/bananarchy-time-sync"
|
||||
mkdir -p "$TARGET_ROOTFS/var/lib/tinydm"
|
||||
ln -sf /usr/share/xsessions/sxmo.desktop "$TARGET_ROOTFS/var/lib/tinydm/default-session.desktop"
|
||||
|
||||
|
||||
@@ -179,6 +179,34 @@ if ! grep -q 'MODULES_INITFS' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh" ||
|
||||
fail "apply-bananarchy-overlay.sh no longer installs the device initramfs module list"
|
||||
fi
|
||||
|
||||
echo "[check] Network time synchronisation..."
|
||||
for f in overlay/rootfs/etc/chrony/chrony.conf \
|
||||
overlay/rootfs/usr/bin/bananarchy-time-sync.sh \
|
||||
overlay/rootfs/etc/init.d/bananarchy-time-sync \
|
||||
overlay/rootfs/etc/NetworkManager/dispatcher.d/20-bananarchy-time-sync.sh; do
|
||||
if [ ! -f "$BASE_DIR/$f" ]; then
|
||||
fail "missing $f"
|
||||
fi
|
||||
done
|
||||
for f in overlay/rootfs/usr/bin/bananarchy-time-sync.sh \
|
||||
overlay/rootfs/etc/init.d/bananarchy-time-sync \
|
||||
overlay/rootfs/etc/NetworkManager/dispatcher.d/20-bananarchy-time-sync.sh; do
|
||||
if [ -f "$BASE_DIR/$f" ] && ! sh -n "$BASE_DIR/$f" 2>/dev/null; then
|
||||
fail "shell syntax: $f"
|
||||
fi
|
||||
done
|
||||
if ! grep -q 'iburst' "$BASE_DIR/overlay/rootfs/etc/chrony/chrony.conf" || \
|
||||
! grep -q 'cmdport 0' "$BASE_DIR/overlay/rootfs/etc/chrony/chrony.conf"; then
|
||||
fail "chrony.conf must keep iburst and the closed UDP command port"
|
||||
fi
|
||||
if ! grep -q 'bananarchy-time-sync' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh" || \
|
||||
! grep -q 'var/lib/chrony' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then
|
||||
fail "overlay no longer enables the time-sync service and chrony driftfile owner"
|
||||
fi
|
||||
if ! grep -q 'var/lib/chrony' "$BASE_DIR/rebuild-image.sh"; then
|
||||
fail "rebuild-image.sh no longer fixes chrony driftfile ownership"
|
||||
fi
|
||||
|
||||
echo "[check] Docker availability..."
|
||||
if ! command -v docker >/dev/null 2>&1; then
|
||||
fail "docker is not installed"
|
||||
|
||||
Reference in new issue
Block a user