summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Jardon <jjardon@gnome.org>2015-04-17 14:49:26 (GMT)
committerBaserock Gerrit <gerrit@baserock.org>2015-04-22 10:12:56 (GMT)
commit30f14e212cb62026b17b43cdda24587c570aff72 (patch)
treef8fa224cf318e9e4abbc631bb35eebd8ca6996a1
parent70cf0464cf7ff98b7f6c843ffd076e21b5be75f9 (diff)
downloaddefinitions-30f14e212cb62026b17b43cdda24587c570aff72.tar.gz
ntpd: Set default .service and conf file in the morphology file
So we can avoid an specific extension to introduce it in the system Change-Id: I57f446977e3e5fba5fe98be6fdd6a3f150623f14
-rw-r--r--ntpd.configure54
-rw-r--r--strata/ntpd/ntpd.morph41
-rw-r--r--swift/etc/ntp.conf4
-rw-r--r--swift/manifest2
-rw-r--r--systems/swift-system-x86_64.morph1
5 files changed, 46 insertions, 56 deletions
diff --git a/ntpd.configure b/ntpd.configure
deleted file mode 100644
index fd39d9e..0000000
--- a/ntpd.configure
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-#
-# Copyright © 2015 Codethink Limited
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-set -e
-
-ROOT="$1"
-
-# NTP conflicts with systemd-timesyncd,
-# so if we want to use NTP then we need to disable systemd-timesyncd
-rm "$ROOT/etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service"
-
-# On at least x86 64 the default rlimit
-# ntp sets (32kB) isn't enough, so increase it
-cat >> "$ROOT/etc/ntp.conf" << EOF
-
-# The default rlimit isn't enough in some cases
-# so we set a higher limit here
-rlimit memlock 256
-EOF
-
-NTPD_PIDFILE=/run/ntpd.pid
-cat > "$ROOT/usr/lib/systemd/system/ntpd.service" << EOF
-[Unit]
-Description=Network Time Service
-After=network.target nss-lookup.target
-Conflicts=systemd-timesyncd.service
-
-[Service]
-Type=forking
-PIDFile=$NTPD_PIDFILE
-ExecStart=/usr/bin/ntpd -u ntp:ntp -p $NTPD_PIDFILE
-PrivateTmp=True
-Restart=on-failure
-
-[Install]
-WantedBy=multi-user.target
-EOF
-
-ln -s "/usr/lib/systemd/system/ntpd.service" \
- "$ROOT/usr/lib/systemd/system/multi-user.target.wants/ntpd.service"
diff --git a/strata/ntpd/ntpd.morph b/strata/ntpd/ntpd.morph
index fd561de..49316c1 100644
--- a/strata/ntpd/ntpd.morph
+++ b/strata/ntpd/ntpd.morph
@@ -3,6 +3,47 @@ kind: chunk
build-system: autotools
configure-commands:
- ./configure --prefix="$PREFIX" --enable-linuxcaps
+post-install-commands:
+- |
+ cat > ntpd.service << EOF
+ [Unit]
+ Description=Network Time Service
+ After=network.target nss-lookup.target
+ Conflicts=systemd-timesyncd.service
+
+ [Service]
+ Type=forking
+ ExecStart=/usr/bin/ntpd -u ntp:ntp
+ PrivateTmp=True
+ Restart=on-failure
+
+ [Install]
+ WantedBy=multi-user.target
+ EOF
+- install -D -m 644 ntpd.service "$DESTDIR"/lib/systemd/system/ntpd.service
+- mkdir -p "$DESTDIR"/lib/systemd/system/multi-user.target.wants
+- ln -s /lib/systemd/system/ntpd.service "$DESTDIR"/lib/systemd/system/multi-user.target.wants/ntpd.service
+- |
+ cat > ntp.conf << EOF
+ # We use iburst here to reduce the potential initial delay to set the clock
+ server 0.pool.ntp.org iburst
+ server 1.pool.ntp.org iburst
+ server 2.pool.ntp.org iburst
+ server 3.pool.ntp.org iburst
+
+ # kod - notify client when packets are denied service,
+ # rather than just dropping the packets
+ #
+ # nomodify - deny queries which attempt to modify the state of the server
+ #
+ # notrap - decline to provide mode 6 control message trap service to
+ # matching hosts
+ #
+ # see ntp.conf(5) for more details
+ restrict -4 default kod notrap nomodify
+ restrict -6 default kod notrap nomodify
+ EOF
+- install -D -m 644 ntp.conf "$DESTDIR"/etc/ntp.conf
system-integration:
ntpd-misc:
00-add-ntpd-user:
diff --git a/swift/etc/ntp.conf b/swift/etc/ntp.conf
index b50886a..5452287 100644
--- a/swift/etc/ntp.conf
+++ b/swift/etc/ntp.conf
@@ -19,3 +19,7 @@ server 3.pool.ntp.org iburst
restrict -4 default kod notrap nomodify
restrict -6 default kod notrap nomodify
{% endif %}
+
+# The default rlimit isn't enough in some cases
+# so we set a higher limit here
+rlimit memlock 256
diff --git a/swift/manifest b/swift/manifest
index 63ea2c2..7fd7620 100644
--- a/swift/manifest
+++ b/swift/manifest
@@ -11,5 +11,5 @@
0100644 0 0 /usr/share/swift/etc/rsyncd.j2
0100644 0 0 /usr/lib/systemd/system/swift-storage-setup.service
0100644 0 0 /usr/lib/systemd/system/swift-storage.service
-template 0100644 0 0 /etc/ntp.conf
+template overwrite 0100644 0 0 /etc/ntp.conf
overwrite 0100644 0 0 /usr/lib/systemd/system/rsync.service
diff --git a/systems/swift-system-x86_64.morph b/systems/swift-system-x86_64.morph
index 385f9cd..442c260 100644
--- a/systems/swift-system-x86_64.morph
+++ b/systems/swift-system-x86_64.morph
@@ -31,4 +31,3 @@ configuration-extensions:
- install-files
- fstab
- swift-storage
-- ntpd