diff options
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 { |
