From 9305ea4b6db95af9aeb46ce75d5aa03bd636b28c Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Mon, 25 Jan 2016 11:59:44 +1100 Subject: [PATCH] Add systemd/fedora support to growroot Add systemd/fedora support to growroot element. This involves installing the correct packages, shipping the systemd service file and ensuring it is enabled. Note the required growfs/resize packages for Ubuntu/Debian are installed in other places. This is probably a bug in that path, but I have not addressed that here. I have tested this with a F23 build with all openstack-infra elements, uploaded to RAX, and it boots and resizes the main file-system. Change-Id: I5630dc638f85b1e80795826ef36a306632075460 --- .../init-scripts/systemd/growroot.service | 12 +++++++++++ elements/growroot/package-installs.yaml | 2 ++ elements/growroot/pkg-map | 12 +++++++++++ elements/growroot/post-install.d/80-growroot | 21 +++++++++++++++++++ 4 files changed, 47 insertions(+) create mode 100644 elements/growroot/init-scripts/systemd/growroot.service create mode 100644 elements/growroot/package-installs.yaml create mode 100644 elements/growroot/pkg-map create mode 100755 elements/growroot/post-install.d/80-growroot diff --git a/elements/growroot/init-scripts/systemd/growroot.service b/elements/growroot/init-scripts/systemd/growroot.service new file mode 100644 index 00000000..40093d99 --- /dev/null +++ b/elements/growroot/init-scripts/systemd/growroot.service @@ -0,0 +1,12 @@ +[Unit] +Description=Grow root partition +After=local-fs.target + +[Service] +Type=oneshot +User=root +ExecStart=/usr/local/sbin/growroot +RemainAfterExit=true + +[Install] +WantedBy=multi-user.target diff --git a/elements/growroot/package-installs.yaml b/elements/growroot/package-installs.yaml new file mode 100644 index 00000000..3482d8f6 --- /dev/null +++ b/elements/growroot/package-installs.yaml @@ -0,0 +1,2 @@ +growpart: +e2fsprogs: \ No newline at end of file diff --git a/elements/growroot/pkg-map b/elements/growroot/pkg-map new file mode 100644 index 00000000..1fa644d7 --- /dev/null +++ b/elements/growroot/pkg-map @@ -0,0 +1,12 @@ +{ + "family":{ + "redhat": { + "growpart": "cloud-utils-growpart", + "e2fsprogs": "e2fsprogs" + }, + "debian":{ + "growpart": "cloud-utils", + "e2fsprogs": "e2fsprogs" + } + } +} diff --git a/elements/growroot/post-install.d/80-growroot b/elements/growroot/post-install.d/80-growroot new file mode 100755 index 00000000..391fffdb --- /dev/null +++ b/elements/growroot/post-install.d/80-growroot @@ -0,0 +1,21 @@ +#!/bin/bash + +if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then + set -x +fi +set -eu +set -o pipefail + +case "$DIB_INIT_SYSTEM" in + upstart) + # nothing to do + exit 0 + ;; + systemd) + systemctl enable growroot.service + ;; + *) + echo "Unsupported init system" + exit 1 + ;; +esac