109e02b1ce
Switch to using svc-map element for systemd based agent. This allows both .deb and .rpm installs to share the element for systemd based installs. There are not any plans to package a .rpm package for upstart or sysv, so these are left as is. Change-Id: Idca7ad97355cae785162989774a7e6dea6fdc5b5 Closes-Bug: #1490584
42 lines
1.2 KiB
Bash
Executable File
42 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
|
set -x
|
|
fi
|
|
set -eu
|
|
set -o pipefail
|
|
|
|
SCRIPTDIR=$(dirname $0)
|
|
install-packages python-dev qemu-utils parted hdparm util-linux genisoimage gcc
|
|
|
|
# Install the latest version of pip and setuptools which has some
|
|
# fixes for building behind proxy.
|
|
curl -o /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py
|
|
python /tmp/get-pip.py
|
|
rm -f /tmp/get-pip.py
|
|
pip install -U setuptools
|
|
|
|
pip install -r /tmp/ironic-python-agent/requirements.txt
|
|
pip install /tmp/ironic-python-agent
|
|
|
|
if [ ! -f /usr/bin/ironic-python-agent ]; then
|
|
ln -s /usr/local/bin/ironic-python-agent /usr/bin/ironic-python-agent
|
|
fi
|
|
|
|
case "$DIB_INIT_SYSTEM" in
|
|
upstart)
|
|
install -D -g root -o root -m 0755 ${SCRIPTDIR}/ironic-python-agent.conf /etc/init/ironic-python-agent.conf
|
|
;;
|
|
systemd)
|
|
install -D -g root -o root -m 0755 ${SCRIPTDIR}/ironic-python-agent.service /usr/lib/systemd/system/$(svc-map ironic-python-agent).service
|
|
;;
|
|
sysv)
|
|
install -D -g root -o root -m 0755 ${SCRIPTDIR}/ironic-python-agent.init /etc/init.d/ironic-python-agent.init
|
|
update-rc.d ironic-python-agent.init defaults
|
|
;;
|
|
*)
|
|
echo "Unsupported init system"
|
|
exit 1
|
|
;;
|
|
esac
|