#!/bin/bash ########################################################################### ## Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3 ## ## Please see: http://www.gnu.org/licenses/gpl.html for legal details, ## ## rights of fair usage, the disclaimer and warranty conditions. ## ########################################################################### PATH=/opt/mono-4-0/bin:$PATH dialog --msgbox "This tool will upgrade the Spectacled Owl machine." 10 70 # Spectaced Owl upgrade if [ -f lib/install-packages.txt ] && [ -f lib/uninstall-packages.txt ]; then dialog --yesno "By selecting yes here, the Spectacled Owl will install or remove packages essential for OpenSim from the virtual machine. You should say yes here unless you have made major changes to the Spectacled Owl machine. Would you like to process the list of packages to install or remove?" 10 70 if [ $? == "0" ]; then # Update repositories aptitude -y update aptitude -y upgrade # Remove packages cat lib/uninstall-packages.txt | while read p; do PACKAGE=`dpkg -l | grep "$p" | head -1 | awk '{ print $2 }'` if [ "$PACKAGE" == "$p" ]; then aptitude -y purge $p fi done # Install packages cat lib/install-packages.txt | while read i; do PACKAGE=`dpkg -l | grep "$i" | head -1 | awk '{ print $2 }'` if [ "$PACKAGE" != "$i" ]; then aptitude -y purge $i aptitude -y install $i fi done fi fi # Update system files dialog --yesno "This part of the upgrade process updates the Spectacled Owl system files with updated versions from the official repository. Unless you have heavily modified the Spectacled Owl machine, you should say yes here. Would you like to update the Spectacled Owl system files?" 10 70 if [ $? == "0" ]; then cp -Rap lib/fs/* / kill -s HUP `pidof cron` fi # OpenSim upgrade pushd ./ cd ../ if [ ! -d opensim-sources ]; then svn co http://svn.was.fm/opensim opensim-sources fi echo "[SpectacledOwl] Updating sources..." cd opensim-sources svn update dialog --yesno "By selecting yes here, the OpenSim sources will be updated from the development repository, compiled and added to the current OpenSim working directory. Selecting yes here will not affect any modifications you may have done to OpenSim's ini files. Upgrade the OpenSim binaries to the lastest development version?" 10 70 if [ $? == "0" ]; then echo "[SpectacledOwl] Cleaning..." make clean echo "[SpectacledOwl] Build..." make if [ -d /home/opensim/os ]; then echo "[SpectacledOwl] Copying files..." mkdir -p /home/opensim/os find bin/ -name \*.ini -exec rm -rf '{}' \; find bin/ -name \*.config -exec rm -rf '{}' \; find bin/ -name assets -exec rm -rf '{}' \; find bin/ -name assetcache -exec -rm -rf '{}' \; cp -Ra bin/* /home/opensim/os/ echo "[SpectacledOwl] Changing ownership..." chown -R opensim:opensim /home/opensim/os/ fi fi if [ -d ../opensim-config/ ]; then cd ../opensim-config/ svn update dialog --yesno "This option will update OpenSim's configuration files EXCEPT Regions.ini which will not be overwritten. It is useful to synchronize OpenSim's configuration files with new options from the development branch. If you have made changes to OpenSim's ini files, a resonable answer will be no. However, at some point you should make a backup and sync with the development version. Update the configuration files now?" 12 70 if [ $? == "0" ]; then echo "[SpectacledOwl] Updating configuration..." cp -Ra * /home/opensim/os/ mysql -u debian-sys-maint -pvu9VYfFIcb0qcRVC -D opensim -e "delete from assets where id='00000000-0000-1111-9999-000000000010'" mysql -u debian-sys-maint -pvu9VYfFIcb0qcRVC -D opensim -e "delete from assets where id='00000000-0000-1111-9999-000000000011'" mysql -u debian-sys-maint -pvu9VYfFIcb0qcRVC -D opensim -e "delete from assets where id='00000000-0000-1111-9999-000000000012'" fi fi if [ -d ../opensim-www/ ]; then cd ../opensim-www/ svn update dialog --yesno "This option will update the Spectacled Owl's OpenSim website pages. These pages are the ones that you see when logging-in to the Spectacled Owl and allow the web-based management of the Spectacled Owl. If you have made changes to the pages located in /var/www, you should make a backup and say yes. Do you want to upgrade the Spectacled Owl website pages?" 10 70 if [ $? == "0" ]; then echo "[SpectacledOwl] Updating website..." cp -R * /var/www/ chown -R www-data:www-data /var/www service lighttpd restart fi fi popd dialog --yesno "The Spectacled Owl uses a few shell scripts that manage the virtual machine. These tools can be found in the opensim-tools/lib directory and when you run this script they are updated and copied into the filesystem. A safe answer would be yes since they make-up for the core functionality of the Spectacled Owl. Do you want to deploy the Spectacled Owl tools?" 10 70 if [ $? == "0" ]; then echo "[SpectacledOwl] Deploying tools..." if [ -x lib/osstrap ]; then cp lib/osstrap /etc/init.d/osstrap fi if [ -x lib/iardumper ]; then cp lib/iardumper /etc/cron.daily/iardumper fi fi if [ -x lib/firewall ]; then dialog --yesno "Apply the latest firewall changes? The firewall rules can be found in the opensim-tools/lib/firewall file and consist of a rudiementary set of protections for the Spectacled Owl. If you have made changes to ports and are now managing the firewall by yourself, the safe choice is no. Otherwise, please select yes." 10 70 if [ $? == "0" ]; then echo "[SpectacledOwl] Applying firewall..." lib/firewall fi fi dialog --yesno "It is recommended to restart the OpenSim instance now. You can switch to the first console using CTRL+ALT+F1 and restart OpenSim yourself, or answer yes here. Restart OpenSim?" 10 70 if [ $? == "0" ]; then echo "[SpectacledOwl] Restarting OpenSim." kill -s HUP `pidof mono` fi echo "[SpectacledOwl] Done." dialog --msgbox "Upgrade process is now complete. Have a nice day." 10 70