blob: 336c26bf682e56445079b1448bbe14efd3d98a65 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/usr/bin/env bash
#
# Evaluate SLX_BIOS_CLOCK and SLX_NTP_SERVER and configure
# stage4's timesyncd accordingly.
. /etc/openslx
configure_newroot_timesyncd() {
if [ "$SLX_BIOS_CLOCK" = "local" ]; then
cat > "$NEWROOT/etc/adjtime" <<-EOF
0.0 0 0.0
0
LOCAL
EOF
elif [ "$SLX_BIOS_CLOCK" = "utc" ]; then
[ -e "$NEWROOT/etc/adjtime" ] && rm "$NEWROOT/etc/adjtime"
fi
# NTP servers
if [ -n "$SLX_NTP_SERVER" ]; then
local TIMESYNCD_DIR="$NEWROOT/etc/systemd/timesyncd.conf.d"
mkdir -p "$TIMESYNCD_DIR"
(
echo "[Time]"
echo "NTP=$SLX_NTP_SERVER"
) > "${TIMESYNCD_DIR}/00-slx.conf"
fi
}
configure_newroot_timesyncd
true
|