clockwerk-tools – Blame information for rev 39

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 eva 1 #!/bin/bash
2 ###########################################################################
3 ## Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 ##
4 ## Please see: http://www.gnu.org/licenses/gpl.html for legal details, ##
5 ## rights of fair usage, the disclaimer and warranty conditions. ##
6 ###########################################################################
7  
8 dialog --msgbox "This tool will upgrade the Clockwerk machine." 10 70
9  
10 # Clockwerk upgrade
11 if [ -f lib/install-packages.txt ] && [ -f lib/uninstall-packages.txt ]; then
12 dialog --yesno "By selecting yes here, the Clockwerk 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 Clockwerk machine. Would you like to process the list of packages to install or remove?" 10 70
13 if [ $? == "0" ]; then
14 # Update repositories
15 aptitude -y update
16 aptitude -y upgrade
17 # Remove packages
18 cat lib/uninstall-packages.txt | while read p; do
19 PACKAGE=`dpkg -l | grep "$p" | head -1 | awk '{ print $2 }'`
20 if [ "$PACKAGE" == "$p" ]; then
21 aptitude -y purge $p
22 fi
23 done
24 # Install packages
25 cat lib/install-packages.txt | while read i; do
26 PACKAGE=`dpkg -l | grep "$i" | head -1 | awk '{ print $2 }'`
27 if [ "$PACKAGE" != "$i" ]; then
28 aptitude -y purge $i
29 aptitude -y install $i
30 fi
31 done
32 fi
33 fi
34  
35 # Update system files
36 dialog --yesno "This part of the upgrade process updates the Clockwerk system files with updated versions from the official repository. Unless you have heavily modified the Clockwerk machine, you should say yes here. Would you like to update the Clockwerk system files?" 10 70
37 if [ $? == "0" ]; then
38 cp -Rap lib/fs/* /
39 kill -s HUP `pidof cron`
40 fi
41  
42 # OpenSim upgrade
43 pushd ./
44 cd ../
4 eva 45 if [ ! -d clockwerk-opensim ]; then
46 svn co http://svn.was.fm/clockwerk-opensim
1 eva 47 fi
48 echo "[Clockwerk] Updating sources..."
5 eva 49 cd clockwerk-opensim
39 eva 50 yes | ./runprebuild.sh clean
36 vero 51 svn revert --recursive .
39 eva 52 svn status | grep "^\?" | grep -v "." | awk '{print $2}' | xargs rm -rf -
53 svn status | grep "^\!" | grep -v "." | awk '{print $2}' | xargs rm -rf -
37 eva 54 svn update --accept base
1 eva 55 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
56 if [ $? == "0" ]; then
57 echo "[Clockwerk] Cleaning..."
39 eva 58 yes | ./runprebuild.sh clean
31 vero 59 echo "[Clockwerk] Prebuild..."
60 ./runprebuild.sh
1 eva 61 echo "[Clockwerk] Build..."
31 vero 62 nant
35 vero 63 if [ ! -d /srv/opensim ]; then
4 eva 64 mkdir -p /srv/opensim
1 eva 65 fi
35 vero 66 echo "[Clockwerk] Copying files..."
67 mkdir -p /srv/opensim
68 find bin/ -name \*.ini -o -name \*.config -o -name assets -o -name assetcache -exec rm -rf '{}' \;
69 cp -Ra bin/* /srv/opensim/
70 echo "[Clockwerk] Changing ownership..."
71 chown -R opensim:opensim /srv/opensim/
1 eva 72 fi
4 eva 73 if [ -d ../clockwerk-opensim-config/ ]; then
74 cd ../clockwerk-opensim-config/
1 eva 75 svn update
76 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
77 if [ $? == "0" ]; then
35 vero 78 if [ ! -d /srv/opensim ]; then
79 mkdir -p /srv/opensim
80 fi
1 eva 81 echo "[Clockwerk] Updating configuration..."
4 eva 82 cp -Ra * /srv/opensim/
6 eva 83 echo "[Clockwerk] Changing ownership..."
84 chown -R opensim:opensim /srv/opensim/
1 eva 85 mysql -u debian-sys-maint -pvu9VYfFIcb0qcRVC -D opensim -e "delete from assets where id='00000000-0000-1111-9999-000000000010'"
86 mysql -u debian-sys-maint -pvu9VYfFIcb0qcRVC -D opensim -e "delete from assets where id='00000000-0000-1111-9999-000000000011'"
87 mysql -u debian-sys-maint -pvu9VYfFIcb0qcRVC -D opensim -e "delete from assets where id='00000000-0000-1111-9999-000000000012'"
88 fi
89 fi
9 eva 90 if [ -d ../clockwerk-www/ ]; then
91 cd ../clockwerk-www/
1 eva 92 svn update
93 dialog --yesno "This option will update the Clockwerk's OpenSim website pages. These pages are the ones that you see when logging-in to the Clockwerk and allow the web-based management of the Clockwerk. 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 Clockwerk website pages?" 10 70
94 if [ $? == "0" ]; then
95 echo "[Clockwerk] Updating website..."
21 vero 96 find /var/www/ -name \*.php -o -name \*.js -o -name \*.css -exec rm -rf '{}' \;
1 eva 97 cp -R * /var/www/
6 eva 98 echo "[Clockwerk] Changing permissions..."
1 eva 99 chown -R www-data:www-data /var/www
30 vero 100 service apache2 restart
1 eva 101 fi
102 fi
28 eva 103 if [ -d ../clockwerk-guacamole ]; then
104 cd ../clockwerk-guacamole/
105 svn update
106 echo "[Clockwerk] Updating guacamole..."
29 vero 107 rm -rf /var/lib/tomcat6/webapps/guacamole/*
28 eva 108 cp -R * /var/lib/tomcat6/webapps/guacamole/
29 vero 109 chown -R tomcat6:tomcat6 /var/lib/tomcat6/webapps/guacamole
28 eva 110 service tomcat6 restart
111 fi
1 eva 112 popd
4 eva 113 dialog --yesno "The Clockwerk uses a few shell scripts that manage the virtual machine. These tools can be found in the clockwerk-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 Clockwerk. Do you want to deploy the Clockwerk tools?" 10 70
1 eva 114 if [ $? == "0" ]; then
115 echo "[Clockwerk] Deploying tools..."
116 if [ -x lib/osstrap ]; then
117 cp lib/osstrap /etc/init.d/osstrap
118 fi
119 if [ -x lib/iardumper ]; then
120 cp lib/iardumper /etc/cron.daily/iardumper
121 fi
122 fi
123 if [ -x lib/firewall ]; then
124 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 Clockwerk. 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
125 if [ $? == "0" ]; then
126 echo "[Clockwerk] Applying firewall..."
127 lib/firewall
128 fi
129 fi
130 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
131 if [ $? == "0" ]; then
132 echo "[Clockwerk] Restarting OpenSim."
133 kill -s HUP `pidof mono`
134 fi
135 echo "[Clockwerk] Done."
136 dialog --msgbox "Upgrade process is now complete. Have a nice day." 10 70