diskimage-builder/elements/ironic-agent/install.d/ironic-agent-source-install/60-ironic-agent-install
John Trowbridge db713fdf2d Add ability to build ironic-python-agent ramdisk from packages
Splits the install.d into source-install and package-install in
order to allow building from a distro packaged version of
ironic-python-agent.

Change-Id: I17513c29efd8c199e07ac1ef20ea5d7456585413
2015-07-31 14:04:52 +00:00

43 lines
1.3 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/ironic-python-agent.service
systemctl enable 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