aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAngelo Naselli <anaselli@linux.it>2015-03-27 16:02:24 +0100
committerAngelo Naselli <anaselli@linux.it>2015-03-27 16:05:19 +0100
commit5d98a03700189a20f707fd9dbb155adc7ddd7e24 (patch)
treed4ed9974e84aa35a015830bc5881e9c006716458 /lib
parentc5f7c9ee56a1f5baa036ac92ecb45d6574d79702 (diff)
downloadmanatools-5d98a03700189a20f707fd9dbb155adc7ddd7e24.tar
manatools-5d98a03700189a20f707fd9dbb155adc7ddd7e24.tar.gz
manatools-5d98a03700189a20f707fd9dbb155adc7ddd7e24.tar.bz2
manatools-5d98a03700189a20f707fd9dbb155adc7ddd7e24.tar.xz
manatools-5d98a03700189a20f707fd9dbb155adc7ddd7e24.zip
Fixed NTP server configuration and access from /etc/systemd/timesyncd.conf
Diffstat (limited to 'lib')
-rw-r--r--lib/ManaTools/Shared/TimeZone.pm11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/ManaTools/Shared/TimeZone.pm b/lib/ManaTools/Shared/TimeZone.pm
index e6b843fd..936515bb 100644
--- a/lib/ManaTools/Shared/TimeZone.pm
+++ b/lib/ManaTools/Shared/TimeZone.pm
@@ -848,7 +848,12 @@ sub ntpCurrentServer {
my $configFile = $self->ntp_configuration_file || $self->getNTPServiceConfig($self->ntp_program);
- MDK::Common::Func::find { $_ ne '127.127.1.0' } map { MDK::Common::Func::if_(/^\s*server\s+(\S*)/, $1) } MDK::Common::File::cat_($configFile);
+ if ($self->ntp_program eq "systemd-timesyncd") {
+ return MDK::Common::Func::find { $_ ne '127.127.1.0' } map { MDK::Common::Func::if_(/^\s*NTP=\s*(\S*)\s*(\S*)/, $1) } MDK::Common::File::cat_($configFile);
+ }
+ else {
+ return MDK::Common::Func::find { $_ ne '127.127.1.0' } map { MDK::Common::Func::if_(/^\s*server\s+(\S*)/, $1) } MDK::Common::File::cat_($configFile);
+ }
}
#=============================================================
@@ -936,8 +941,8 @@ sub setNTPConfiguration {
if ($self->ntp_program eq "systemd-timesyncd") {
my $added = 0;
MDK::Common::File::substInFile {
- if (/^#?\s*NTP=\s+(\S*)/ && $1 ne '127.127.1.0') {
- $_ = $added ? $_ =~ $pool_match ? undef : "#NTP=$1\n" : join('NTP= ', @servers, "\n");
+ if (/^#?\s*NTP=\s*(\S*)/ && $1 ne '127.127.1.0') {
+ $_ = $added ? $_ =~ $pool_match ? undef : "#NTP=$1\n" : join(' ', 'NTP=', @servers, "\n");
$added = 1;
}
} $f;