diff options
| author | Shulhan <ms@kilabit.info> | 2022-07-01 00:07:23 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2022-07-25 19:29:22 +0700 |
| commit | 6b425a2b2f35fb90b00583fbf503f30816d2ebb7 (patch) | |
| tree | 443f463cae982a254787702edd58c9e5d3cfd8fd /build-arch-gce | |
| parent | abf42e55f9ad473f2e7ef28d9aadb389cff7ecfa (diff) | |
| download | compute-archlinux-image-builder-6b425a2b2f35fb90b00583fbf503f30816d2ebb7.tar.xz | |
all: use drop-ins replacement to overwrite NTP configuration
Per manual page timesyncd.conf(5) [1]:
Initially, the main configuration file in /etc/systemd/ contains
commented out entries showing the defaults as a guide to the
administrator.
...
Using drop-ins for local configuration is recommended over
modifications to the main configuration file.
The reason why the filename is 00- describe below
It is recommended to prefix all filenames in those subdirectories with
a two-digit number and a dash, to simplify the ordering of the files.
Another reason is to prevent the system being littered with
/etc/systemd/timesyncd.conf.pacnew files when systemd updated.
[1] https://man.archlinux.org/man/timesyncd.conf.5
Diffstat (limited to 'build-arch-gce')
| -rwxr-xr-x | build-arch-gce | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/build-arch-gce b/build-arch-gce index eeefa31..e1caf27 100755 --- a/build-arch-gce +++ b/build-arch-gce @@ -97,15 +97,17 @@ print_fstab() { } echo '- Running additional setup in chroot.' + +echo '-- Configuring NTP.' +mkdir -p $mount_dir/etc/systemd/timesyncd.conf.d/ +cp ./sys/etc/systemd/timesyncd.conf.d/00-google.conf $mount_dir/etc/systemd/timesyncd.conf.d/ + arch-chroot -- "$mount_dir" /bin/bash -s <<-'EOS' set -eEuo pipefail trap 'echo "Error: \`$BASH_COMMAND\` exited with status $?"' ERR echo '-- Configuring time.' ln -sf /usr/share/zoneinfo/UTC /etc/localtime - gawk -i assert -i inplace ' - /^#NTP=/ { $0 = "NTP=metadata.google.internal"; ++f } - { print } END { assert(f == 1, "f == 1") }' /etc/systemd/timesyncd.conf systemctl --quiet enable systemd-timesyncd.service echo '-- Configuring locale.' |
