monkey/monkey_island/deb-package/DEBIAN/postinst

37 lines
1.1 KiB
Plaintext
Raw Normal View History

2015-12-07 21:10:19 +08:00
#!/bin/bash
2015-12-07 22:11:31 +08:00
MONKEY_FOLDER=/var/monkey_island
2015-12-07 21:10:19 +08:00
INSTALLATION_FOLDER=/var/monkey_island/installation
2018-01-02 21:27:32 +08:00
PYTHON_FOLDER=/var/monkey_island/bin/python
2015-12-07 21:10:19 +08:00
2016-01-19 23:17:45 +08:00
cp -f ${MONKEY_FOLDER}/monkey.sh /usr/bin/monkey
2016-01-19 22:07:02 +08:00
chmod 755 /usr/bin/monkey
2018-01-02 21:27:32 +08:00
# Prepare python virtualenv
2018-01-02 23:53:28 +08:00
pip2 install virtualenv --no-index --find-links file://$INSTALLATION_FOLDER
virtualenv -p python2.7 ${PYTHON_FOLDER}
2017-08-13 22:13:39 +08:00
2015-12-07 21:10:19 +08:00
# install pip requirements
2018-01-02 21:58:47 +08:00
${PYTHON_FOLDER}/bin/python -m pip install -r $MONKEY_FOLDER/pip_requirements.txt --no-index --find-links file://$INSTALLATION_FOLDER
2017-08-13 22:13:39 +08:00
2015-12-07 22:11:31 +08:00
# remove installation folder and unnecessary files
2016-01-19 22:07:02 +08:00
rm -rf ${INSTALLATION_FOLDER}
rm -f ${MONKEY_FOLDER}/pip_requirements.txt
2015-12-07 22:11:31 +08:00
cp ${MONKEY_FOLDER}/ubuntu/* /etc/init/
if [ -d "/etc/systemd/network" ]; then
cp ${MONKEY_FOLDER}/ubuntu/systemd/*.service /lib/systemd/system/
chmod +x ${MONKEY_FOLDER}/ubuntu/systemd/start_server.sh
systemctl daemon-reload
systemctl enable monkey-mongo
systemctl enable monkey-island
fi
2015-12-07 22:11:31 +08:00
2016-01-19 22:07:02 +08:00
${MONKEY_FOLDER}/create_certificate.sh
2015-12-07 22:11:31 +08:00
service monkey-island start
service monkey-mongo start
2016-07-29 03:52:18 +08:00
echo Monkey Island installation ended
exit 0