Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP]Add ntp client #35

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
1 change: 1 addition & 0 deletions airootfs/root/.automated_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 15 additions & 2 deletions airootfs/root/customize_airootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 2 additions & 0 deletions config_build.sh.example
Original file line number Diff line number Diff line change
Expand Up @@ -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'