clockwerk-tools – Diff between revs 44 and 45

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