From b195f8ef6e9b3fd08ec9adc978571cb49fd72bd8 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Wed, 17 Aug 2016 15:46:13 -0500 Subject: [PATCH] Add glue to get initialize-urandom installed Here we are installing our python app, and setting up systemd. Our server should run after haveged and before unbound. Change-Id: I4f9b24f217f271b64f324c922948c54c46cb1110 Signed-off-by: Paul Belanger --- .../elements/initialize-urandom/element-deps | 2 ++ .../systemd/initialize-urandom.service | 13 +++++++++++++ .../post-install.d/80-initialize-urandom | 17 +++++++++++++++++ nodepool/nodepool.yaml | 1 + 4 files changed, 33 insertions(+) create mode 100644 nodepool/elements/initialize-urandom/element-deps create mode 100644 nodepool/elements/initialize-urandom/init-scripts/systemd/initialize-urandom.service create mode 100755 nodepool/elements/initialize-urandom/post-install.d/80-initialize-urandom diff --git a/nodepool/elements/initialize-urandom/element-deps b/nodepool/elements/initialize-urandom/element-deps new file mode 100644 index 0000000000..69a71fdedc --- /dev/null +++ b/nodepool/elements/initialize-urandom/element-deps @@ -0,0 +1,2 @@ +dib-init-system +install-static diff --git a/nodepool/elements/initialize-urandom/init-scripts/systemd/initialize-urandom.service b/nodepool/elements/initialize-urandom/init-scripts/systemd/initialize-urandom.service new file mode 100644 index 0000000000..cc4489e9b3 --- /dev/null +++ b/nodepool/elements/initialize-urandom/init-scripts/systemd/initialize-urandom.service @@ -0,0 +1,13 @@ +[Unit] +Description=Quickly initialize the nonblocking kernel random number generator at boot. +Before=network-pre.target +Wants=network-pre.target + +[Service] +Type=oneshot +User=root +ExecStart=/usr/local/bin/initialize-urandom.py +RemainAfterExit=true + +[Install] +WantedBy=multi-user.target diff --git a/nodepool/elements/initialize-urandom/post-install.d/80-initialize-urandom b/nodepool/elements/initialize-urandom/post-install.d/80-initialize-urandom new file mode 100755 index 0000000000..b9920ba4ca --- /dev/null +++ b/nodepool/elements/initialize-urandom/post-install.d/80-initialize-urandom @@ -0,0 +1,17 @@ +#!/bin/bash + +if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then + set -x +fi +set -eu +set -o pipefail + +case "$DIB_INIT_SYSTEM" in + systemd) + systemctl enable initialize-urandom.service + ;; + *) + echo "Unsupported init system" + exit 1 + ;; +esac diff --git a/nodepool/nodepool.yaml b/nodepool/nodepool.yaml index e8b0a03b25..f246ab52de 100644 --- a/nodepool/nodepool.yaml +++ b/nodepool/nodepool.yaml @@ -793,6 +793,7 @@ diskimages: - openstack-repos - nodepool-base - cache-devstack + - initialize-urandom - cache-bindep - growroot - infra-package-needs