2014-06-27 11:54:29 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2014-09-04 04:56:29 +00:00
|
|
|
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
|
|
|
set -x
|
|
|
|
fi
|
2014-06-27 11:54:29 +00:00
|
|
|
set -eu
|
|
|
|
set -o pipefail
|
|
|
|
|
2015-07-06 15:14:54 +00:00
|
|
|
SCRIPTDIR=$(dirname $0)
|
2015-04-29 05:40:30 +00:00
|
|
|
|
|
|
|
# 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
|
2015-06-01 02:11:22 +00:00
|
|
|
rm -f /tmp/get-pip.py
|
2015-04-29 05:40:30 +00:00
|
|
|
pip install -U setuptools
|
2014-06-27 11:54:29 +00:00
|
|
|
|
|
|
|
pip install -r /tmp/ironic-python-agent/requirements.txt
|
|
|
|
pip install /tmp/ironic-python-agent
|
|
|
|
|
2015-07-06 15:14:54 +00:00
|
|
|
if [ ! -f /usr/bin/ironic-python-agent ]; then
|
|
|
|
ln -s /usr/local/bin/ironic-python-agent /usr/bin/ironic-python-agent
|
|
|
|
fi
|
2014-06-27 11:54:29 +00:00
|
|
|
|
2015-07-06 15:14:54 +00:00
|
|
|
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)
|
2015-08-31 14:27:44 +00:00
|
|
|
install -D -g root -o root -m 0755 ${SCRIPTDIR}/ironic-python-agent.service /usr/lib/systemd/system/$(svc-map ironic-python-agent).service
|
2015-07-06 15:14:54 +00:00
|
|
|
;;
|
|
|
|
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
|