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-10-16 10:46:13 +00:00
|
|
|
IPADIR=/usr/share/ironic-python-agent
|
2015-04-29 05:40:30 +00:00
|
|
|
|
2015-10-16 10:46:13 +00:00
|
|
|
# create the virtual environment
|
|
|
|
virtualenv $IPADIR/venv
|
2014-06-27 11:54:29 +00:00
|
|
|
|
2015-10-16 10:46:13 +00:00
|
|
|
# install IPA inside the virtual environment
|
|
|
|
$IPADIR/venv/bin/pip install $IPADIR
|
2014-06-27 11:54:29 +00:00
|
|
|
|
2015-10-16 10:46:13 +00:00
|
|
|
# FIXME(lucasagomes): Figure out how we can use the "--install-option"
|
|
|
|
# parameter for pip install so we don't have to manually create a symlink
|
|
|
|
# create the launcher link so services can use it
|
|
|
|
ln -s $IPADIR/venv/bin/ironic-python-agent /usr/local/bin/ironic-python-agent
|
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-10-16 10:46:13 +00:00
|
|
|
install -D -g root -o root -m 0755 ${SCRIPTDIR}/ironic-python-agent.service /usr/lib/systemd/system/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
|