diff options
| author | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2026-01-04 17:21:15 +0000 |
|---|---|---|
| committer | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2026-01-04 21:32:20 +0000 |
| commit | 94fe5964a4c89834c010ef6822129d1084e2ac06 (patch) | |
| tree | d92a0344b2ebc3dc98851bcf4e61b43321a0e1d2 /perl-install/timezone.pm | |
| parent | bf9e1e4eb48e07bf9e36e165443a0ee68609dd0b (diff) | |
| download | drakx-94fe5964a4c89834c010ef6822129d1084e2ac06.tar drakx-94fe5964a4c89834c010ef6822129d1084e2ac06.tar.gz drakx-94fe5964a4c89834c010ef6822129d1084e2ac06.tar.bz2 drakx-94fe5964a4c89834c010ef6822129d1084e2ac06.tar.xz drakx-94fe5964a4c89834c010ef6822129d1084e2ac06.zip | |
drakclock: make sure we configure the currently installed ntp service.
drakclock can install chrony, so the ntpd and ntp_conf strings
provided by the imezone module should be dynamic, not static.
Diffstat (limited to 'perl-install/timezone.pm')
| -rw-r--r-- | perl-install/timezone.pm | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/perl-install/timezone.pm b/perl-install/timezone.pm index 1f4bbb419..fb4be35d3 100644 --- a/perl-install/timezone.pm +++ b/perl-install/timezone.pm @@ -26,26 +26,27 @@ sub read() { { timezone => $t{ZONE}, UTC => text2bool($t{UTC}) }; } -our $ntpd = 'chronyd'; -our $ntp_conf = '/etc/chrony.conf'; -unless (-f "$::prefix$ntp_conf") { - $ntpd = 'ntpd'; - $ntp_conf = '/etc/ntp.d/use-pool' +sub ntpd() { + -f "$::prefix/etc/chrony.conf" ? 'chronyd' : 'ntpd'; +} + +sub ntp_conf() { + -f "$::prefix/etc/chrony.conf" ? "$::prefix/etc/chrony.conf" : "$::prefix/etc/ntp.d/use-pool"; } sub ntp_pool() { - find { $_ ne '' } map { (/^\s*pool\s+(\S*)/, $1) } cat_("$::prefix$ntp_conf"); + find { $_ ne '' } map { (/^\s*pool\s+(\S*)/, $1) } cat_(ntp_conf()); } sub set_ntp_pool { my ($pool) = @_; - my $f = "$::prefix$ntp_conf"; + my $f = ntp_conf(); -f $f or return; substInFile { s/^#?\s*pool\s+.*/pool $pool iburst/ } $f if $pool; require services; - services::set_status($ntpd, to_bool($pool), $::isInstall); + services::set_status(ntpd(), to_bool($pool), $::isInstall); } sub write { |
