#! /bin/sh
# This script is executed on every host.
# install screen
apt-get install screen

# Create user odysseus
adduser --quiet --disabled-password --gecos GECOS odysseus

# stop odysseus if available
service stop odysseus
 
# download and install odysseus
cd ~odysseus
rm -rf ~odysseus/.odysseus
rm -rf odysseus.peer.gtk.linux.x86
rm *.zip
rm startOdysseus
wget http://odysseus.offis.uni-oldenburg.de/download/products/peer/lastBuild/odysseus.peer.gtk.linux.x86.zip
unzip -o odysseus.peer.gtk.linux.x86.zip
wget http://odysseus.informatik.uni-oldenburg.de/download/products/peer/startOdysseus
chmod +x startOdysseus
chown -R odysseus *
 
# Download start script
cd /etc/init.d
rm odysseus
wget http://odysseus.offis.uni-oldenburg.de/download/products/tools/odysseus
chmod +x odysseus
cd
rm open_odysseus_osgi_console.sh*
wget http://odysseus.offis.uni-oldenburg.de/download/products/tools/open_odysseus_osgi_console.sh
chmod +x open_odysseus_osgi_console.sh
 
# update runlevel links to odysseus start script
update-rc.d odysseus defaults
 
# start odysseus service
/etc/init.d/odysseus start
 
# restart odysseus service
/etc/init.d/odysseus restart
# check if screen is running
su -l odysseus -c "screen -ls"
 
# reboot
reboot

