manila-image-elements/elements/manila-ssh/install.d/60-fetch-public-ssh-keys
Ben Swartzlander ffabcc1a59 Add systemd support to manila-ssh
Because we're using ubuntu-minimal there is no cloud init support and
we have manila-ssh as a substitute. Manila-ssh was only designed to
work with upstart. This patch adds systemd support.

Change-Id: Id43dc8effb846dcaf68b50eace68df8a076899a1
2017-09-26 14:14:20 -04:00

22 lines
655 B
Bash
Executable File

#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
SCRIPTDIR=$(dirname $0)
install -D -g root -o root -m 0755 ${SCRIPTDIR}/fetch-public-ssh-keys.sh /usr/local/sbin/fetch-public-ssh-keys.sh
DIB_INIT_SYSTEM=$(dib-init-system)
if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then
install -D -g root -o root -m 0755 ${SCRIPTDIR}/fetch-public-ssh-keys.conf /etc/init/fetch-public-ssh-keys.conf
elif [ "$DIB_INIT_SYSTEM" == "systemd" ] ; then
install -D -g root -o root -m 0755 ${SCRIPTDIR}/fetch-public-ssh-keys.service /etc/systemd/system
systemctl enable fetch-public-ssh-keys
else
echo "Not supported"
fi