Skip to content

Commit

Permalink
inject-cmdline-to-template.sh: add checking /dev/rtc0 to script
Browse files Browse the repository at this point in the history
Signed-off-by: Norio Nomura <[email protected]>
  • Loading branch information
norio-nomura committed Nov 8, 2024
1 parent 37ebc42 commit 8d4cd24
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions hack/inject-cmdline-to-template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,15 @@ done
# provision:
# - mode: boot
# # Booting with a kernel image lacks an RTC, so time synchronization is needed to prevent network errors.
# script: systemctl enable systemd-time-wait-sync.service
if ! yq --exit-status eval '.provision[] | select(.script == "systemctl enable systemd-time-wait-sync.service")' "${template}" &>/dev/null; then
echo "Injecting provision[0].script 'systemctl enable systemd-time-wait-sync.service' to ${template}"
# script: test -c /dev/rtc0 || systemctl enable systemd-time-wait-sync.service
readonly enable_wait_sync="test -c /dev/rtc0 || systemctl enable systemd-time-wait-sync.service"
if ! yq --exit-status eval '.provision[] | select(.script == "'"${enable_wait_sync}"'")' "${template}" &>/dev/null; then
echo "Injecting provision[0].script '${enable_wait_sync}' to ${template}"
limactl edit --log-level error --set '
.provision = [
{
"mode": "boot",
"script": "systemctl enable systemd-time-wait-sync.service"
"script": "'"${enable_wait_sync}"'"
}| .mode head_comment="Booting with a kernel image lacks an RTC, so time synchronization is needed to prevent network errors."
] + (.provision // [])
' "${template}"
Expand Down

0 comments on commit 8d4cd24

Please sign in to comment.