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
|
|
|
|
2016-08-25 13:32:20 +00:00
|
|
|
# Generate upper-constraints
|
|
|
|
$IPADIR/imagebuild/common/generate_upper_constraints.sh $IPADIR/upper-constraints.txt
|
|
|
|
|
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
|
2016-08-25 13:32:20 +00:00
|
|
|
$IPADIR/venv/bin/pip install -c $IPADIR/upper-constraints.txt $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
|
2016-03-21 06:45:27 +00:00
|
|
|
|
|
|
|
# Copying the self signed certificate for request library
|
2016-08-15 12:19:04 +00:00
|
|
|
if [ -f /tmp/in_target.d/ipa-trusted-cert.pem ]; then
|
|
|
|
cat /tmp/in_target.d/ipa-trusted-cert.pem >> $($IPADIR/venv/bin/python -c "import requests; print requests.certs.where()")
|
2016-03-21 06:45:27 +00:00
|
|
|
fi
|