monkey/monkey_island/deb-package/DEBIAN/postinst

34 lines
860 B
Bash

#!/bin/bash
MONKEY_FOLDER=/var/monkey_island
INSTALLATION_FOLDER=/var/monkey_island/installation
cp -f ${MONKEY_FOLDER}/monkey.sh /usr/bin/monkey
chmod 755 /usr/bin/monkey
# Fix dependency bug
pip uninstall -y bson
# install pip requirements
pip install -r $MONKEY_FOLDER/pip_requirements.txt --no-index --find-links file://$INSTALLATION_FOLDER
# remove installation folder and unnecessary files
rm -rf ${INSTALLATION_FOLDER}
rm -f ${MONKEY_FOLDER}/pip_requirements.txt
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
fi
${MONKEY_FOLDER}/create_certificate.sh
service monkey-island start
service monkey-mongo start
echo Monkey Island installation ended
exit 0