diff --git a/README.md b/README.md index d288de3..3582494 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ You check out this project on your local computer, modify the config to your nee * Copy `config_build.sh.example` to `config_build.sh` * Copy `config_live.sh.example` to `config_live.sh` * add Arch entry to your pxelinux config, see `ext/pxelinux_config` -* Update the variables to your needs (see[configuration](#configuration)) +* Update the variables to your needs (see [configuration](#configuration)) * install the archiso tools with: `pacman -Syu archiso` * run `rebuild_and_copy.sh` diff --git a/airootfs/root/.automated_script.sh b/airootfs/root/.automated_script.sh index 1154490..ebaec3d 100755 --- a/airootfs/root/.automated_script.sh +++ b/airootfs/root/.automated_script.sh @@ -31,6 +31,7 @@ automated_script () if [[ $(tty) == "/dev/tty1" ]]; then cmdline="$(cat /proc/cmdline)" + # shellcheck disable=SC2163 for i in $cmdline; do case "$i" in HASH=*) export "$i";; esac; done if [ -n "$HASH" ]; then grep -v "^root" /etc/shadow > /tmp/shadow.tmp diff --git a/airootfs/root/customize_airootfs.sh b/airootfs/root/customize_airootfs.sh index 5f87ce3..dbde6cd 100755 --- a/airootfs/root/customize_airootfs.sh +++ b/airootfs/root/customize_airootfs.sh @@ -9,6 +9,7 @@ config='/root/config_build.sh' if [ -n "$config" ] && [ -e "$config" ]; then # source and remove config, could contain sensitive information and we don't want to ship it in the ISO + # shellcheck disable=SC1090 . "${config}" rm "${config}" else @@ -39,7 +40,7 @@ sed -i 's/#\(HandleSuspendKey=\)suspend/\1ignore/' /etc/systemd/logind.conf sed -i 's/#\(HandleHibernateKey=\)hibernate/\1ignore/' /etc/systemd/logind.conf sed -i 's/#\(HandleLidSwitch=\)suspend/\1ignore/' /etc/systemd/logind.conf -systemctl enable pacman-init.service choose-mirror.service systemd-networkd.service systemd-resolved.service sshd.service +systemctl enable pacman-init.service choose-mirror.service systemd-networkd.service systemd-resolved.service systemd-timesyncd.service sshd.service systemctl set-default multi-user.target # they are broken and nobody needs them @@ -70,5 +71,17 @@ cat /tmp/shadow.tmp >> /etc/shadow rm /tmp/shadow.tmp # use the resolv.conf from systemd-resolved.service -umount /etc/resolv.conf ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf + +# check if we want NTP +if [ "$ISO_NTP" = "true" ]; then + if [ -n "$ISO_NTPSERVER" ]; then + mkdir /etc/systemd/timesyncd.conf.d/ + echo -e "[Time]\nNTP=\nNTP=$ISO_NTPSERVER" > /etc/systemd/timesyncd.conf.d/ntp.conf + fi + # this may break because we are in a chroot + timedatectl set-ntp on + + # set hardwareclock to UTC + timedatectl set-local-rtc 0 +fi diff --git a/config_build.sh.example b/config_build.sh.example index 1582842..3e0ac66 100755 --- a/config_build.sh.example +++ b/config_build.sh.example @@ -16,3 +16,5 @@ export DHCP_EXTRACT='/usr/local/bin/extract_archiso' export ISO_MIRROR='http://internal-mirror.local/$repo/os/$arch' export ISO_NFSSERVER='10.30.7.40' export ISO_ROOTHASH='*' +export ISO_NTP='true' +export ISO_NTPSERVER='0.pool.ntp.org europe.pool.ntp.org north-america.pool.ntp.org'