opensim-tools – Rev 30

Subversion Repositories:
Rev:
#!/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.        ##
###########################################################################

dialog --msgbox "This tool will upgrade the Spectacled Owl machine." 10 70
pushd ./
if [ -d ../opensim-sources/ ]; then
        cd ../opensim-sources/
        echo "[SpectacledOwl] Updating sources..."
        svn update
        dialog --yesno "By slecting 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..."
                PKG_CONFIG_PATH=/opt/mono-4-0/lib/pkgconfig make clean
                echo "[SpectacledOwl] Build..."
                PKG_CONFIG_PATH=/opt/mono-4-0/lib/pkgconfig 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 '{}' \;
                        cp -Ra bin/* /home/opensim/os/
                        echo "[SpectacledOwl] Changing ownership..."
                        chown -R opensim:opensim /home/opensim/os/
                fi
        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 touched. 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?" 10 70
        if [ $? == "0" ]; then
                echo "[SpectacledOwl] Updating configuration..."
                cp -Ra * /home/opensim/os/
        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/opensim-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/opensim-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
echo "[SpectacledOwl] Restarting SpectacledOwl."
kill -s HUP `pidof mono`
echo "[SpectacledOwl] Done."