Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-11-05 16:22:43 +0000
committerGitHub <noreply@github.com>2021-11-05 16:22:43 +0000
commit3e53d45413a8a88ebea972a0d94edeb4b2445287 (patch)
tree0737a801d412657323c74f4d6c71176afd3ddb58
parent31a7a85e04e05f46208b026881ced5d9db190fe5 (diff)
parent37c40b8894d4e32209983e1b682dc345d851ba00 (diff)
Merge PR #684 - swap ntpd for systemd-timesyncd
Fix #682 - swap ntpd for systemd-timesyncd
-rw-r--r--archinstall/lib/installer.py19
-rw-r--r--examples/guided.py2
2 files changed, 16 insertions, 5 deletions
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index 47a26d6d..648ef50c 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -13,6 +13,7 @@ from .disk.helpers import get_mount_info
from .mirrors import use_mirrors
from .plugins import plugins
from .storage import storage
+from .systemd import Boot
# from .user_interaction import *
from .output import log
from .profiles import Profile
@@ -256,10 +257,20 @@ class Installer:
)
def activate_ntp(self):
- self.log('Installing and activating NTP.', level=logging.INFO)
- if self.pacstrap('ntp'):
- if self.enable_service('ntpd'):
- return True
+ log(f"activate_ntp() is deprecated, use activate_time_syncronization()", fg="yellow", level=logging.INFO)
+ self.activate_time_syncronization()
+
+ def activate_time_syncronization(self):
+ self.log('Activating systemd-timesyncd for time synchronization using Arch Linux and ntp.org NTP servers.', level=logging.INFO)
+ self.enable_service('systemd-timesyncd')
+
+ with open(f"{self.target}/etc/systemd/timesyncd.conf", "w") as fh:
+ fh.write("[Time]\n")
+ fh.write("NTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org\n")
+ fh.write("FallbackNTP=0.pool.ntp.org 1.pool.ntp.org 0.fr.pool.ntp.org\n")
+
+ with Boot(self) as session:
+ session.SysCommand(["timedatectl", "set-ntp", 'true'])
def enable_service(self, *services):
for service in services:
diff --git a/examples/guided.py b/examples/guided.py
index 45395add..19fff406 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -310,7 +310,7 @@ def perform_installation(mountpoint):
installation.set_timezone(timezone)
if archinstall.arguments.get('ntp', False):
- installation.activate_ntp()
+ installation.activate_time_syncronization()
if (root_pw := archinstall.arguments.get('!root-password', None)) and len(root_pw):
installation.user_set_pw('root', root_pw)