clockwerk-tools – Diff between revs 41 and 42

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 41 Rev 42
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 if [ -d clockwerk-opensim ]; then
47 svn co http://svn.was.fm 47 rm -rf clockwerk-opensim
48 fi 48 fi
-   49 svn co http://svn.was.fm/clockwerk-opensim
49 cd clockwerk-opensim 50 cd clockwerk-opensim
50 svn revert --recursive . -  
51 svn update --accept base -  
52 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 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
53 if [ $? == "0" ]; then 52 if [ $? == "0" ]; then
54 echo "[Clockwerk] Cleaning..." 53 echo "[Clockwerk] Cleaning..."
55 yes | ./runprebuild.sh clean 54 yes | ./runprebuild.sh clean
56 echo "[Clockwerk] Prebuild..." 55 echo "[Clockwerk] Prebuild..."
57 ./runprebuild.sh 56 ./runprebuild.sh
58 echo "[Clockwerk] Build..." 57 echo "[Clockwerk] Build..."
59 nant 58 nant
60 if [ ! -d /srv/opensim ]; then 59 if [ ! -d /srv/opensim ]; then
61 mkdir -p /srv/opensim 60 mkdir -p /srv/opensim
62 fi 61 fi
63 echo "[Clockwerk] Copying files..." 62 echo "[Clockwerk] Copying files..."
64 mkdir -p /srv/opensim 63 mkdir -p /srv/opensim
65 find bin/ -name \*.ini -o -name \*.config -o -name assets -o -name assetcache -exec rm -rf '{}' \; 64 find bin/ -name \*.ini -o -name \*.config -o -name assets -o -name assetcache -exec rm -rf '{}' \;
66 cp -Ra bin/* /srv/opensim/ 65 cp -Ra bin/* /srv/opensim/
67 echo "[Clockwerk] Changing ownership..." 66 echo "[Clockwerk] Changing ownership..."
68 chown -R opensim:opensim /srv/opensim/ 67 chown -R opensim:opensim /srv/opensim/
69 fi 68 fi
70 if [ -d ../clockwerk-opensim-config/ ]; then 69 if [ -d ../clockwerk-opensim-config/ ]; then
71 cd ../clockwerk-opensim-config/ 70 cd ../clockwerk-opensim-config/
72 svn update 71 svn update
73 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 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
74 if [ $? == "0" ]; then 73 if [ $? == "0" ]; then
75 if [ ! -d /srv/opensim ]; then 74 if [ ! -d /srv/opensim ]; then
76 mkdir -p /srv/opensim 75 mkdir -p /srv/opensim
77 fi 76 fi
78 echo "[Clockwerk] Updating configuration..." 77 echo "[Clockwerk] Updating configuration..."
79 cp -Ra * /srv/opensim/ 78 cp -Ra * /srv/opensim/
80 echo "[Clockwerk] Changing ownership..." 79 echo "[Clockwerk] Changing ownership..."
81 chown -R opensim:opensim /srv/opensim/ 80 chown -R opensim:opensim /srv/opensim/
82 mysql -u debian-sys-maint -pvu9VYfFIcb0qcRVC -D opensim -e "delete from assets where id='00000000-0000-1111-9999-000000000010'" 81 mysql -u debian-sys-maint -pvu9VYfFIcb0qcRVC -D opensim -e "delete from assets where id='00000000-0000-1111-9999-000000000010'"
83 mysql -u debian-sys-maint -pvu9VYfFIcb0qcRVC -D opensim -e "delete from assets where id='00000000-0000-1111-9999-000000000011'" 82 mysql -u debian-sys-maint -pvu9VYfFIcb0qcRVC -D opensim -e "delete from assets where id='00000000-0000-1111-9999-000000000011'"
84 mysql -u debian-sys-maint -pvu9VYfFIcb0qcRVC -D opensim -e "delete from assets where id='00000000-0000-1111-9999-000000000012'" 83 mysql -u debian-sys-maint -pvu9VYfFIcb0qcRVC -D opensim -e "delete from assets where id='00000000-0000-1111-9999-000000000012'"
85 fi 84 fi
86 fi 85 fi
87 if [ -d ../clockwerk-www/ ]; then 86 if [ -d ../clockwerk-www/ ]; then
88 cd ../clockwerk-www/ 87 cd ../clockwerk-www/
89 svn update 88 svn update
90 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 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
91 if [ $? == "0" ]; then 90 if [ $? == "0" ]; then
92 echo "[Clockwerk] Updating website..." 91 echo "[Clockwerk] Updating website..."
93 find /var/www/ -name \*.php -o -name \*.js -o -name \*.css -exec rm -rf '{}' \; 92 find /var/www/ -name \*.php -o -name \*.js -o -name \*.css -exec rm -rf '{}' \;
94 cp -R * /var/www/ 93 cp -R * /var/www/
95 echo "[Clockwerk] Changing permissions..." 94 echo "[Clockwerk] Changing permissions..."
96 chown -R www-data:www-data /var/www 95 chown -R www-data:www-data /var/www
97 service apache2 restart 96 service apache2 restart
98 fi 97 fi
99 fi 98 fi
100 if [ -d ../clockwerk-guacamole ]; then 99 if [ -d ../clockwerk-guacamole ]; then
101 cd ../clockwerk-guacamole/ 100 cd ../clockwerk-guacamole/
102 svn update 101 svn update
103 echo "[Clockwerk] Updating guacamole..." 102 echo "[Clockwerk] Updating guacamole..."
104 rm -rf /var/lib/tomcat6/webapps/guacamole/* 103 rm -rf /var/lib/tomcat6/webapps/guacamole/*
105 cp -R * /var/lib/tomcat6/webapps/guacamole/ 104 cp -R * /var/lib/tomcat6/webapps/guacamole/
106 chown -R tomcat6:tomcat6 /var/lib/tomcat6/webapps/guacamole 105 chown -R tomcat6:tomcat6 /var/lib/tomcat6/webapps/guacamole
107 service tomcat6 restart 106 service tomcat6 restart
108 fi 107 fi
109 popd 108 popd
110 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 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
111 if [ $? == "0" ]; then 110 if [ $? == "0" ]; then
112 echo "[Clockwerk] Deploying tools..." 111 echo "[Clockwerk] Deploying tools..."
113 if [ -x lib/osstrap ]; then 112 if [ -x lib/osstrap ]; then
114 cp lib/osstrap /etc/init.d/osstrap 113 cp lib/osstrap /etc/init.d/osstrap
115 fi 114 fi
116 if [ -x lib/iardumper ]; then 115 if [ -x lib/iardumper ]; then
117 cp lib/iardumper /etc/cron.daily/iardumper 116 cp lib/iardumper /etc/cron.daily/iardumper
118 fi 117 fi
119 fi 118 fi
120 if [ -x lib/firewall ]; then 119 if [ -x lib/firewall ]; then
121 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 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
122 if [ $? == "0" ]; then 121 if [ $? == "0" ]; then
123 echo "[Clockwerk] Applying firewall..." 122 echo "[Clockwerk] Applying firewall..."
124 lib/firewall 123 lib/firewall
125 fi 124 fi
126 fi 125 fi
127 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 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
128 if [ $? == "0" ]; then 127 if [ $? == "0" ]; then
129 echo "[Clockwerk] Restarting OpenSim." 128 echo "[Clockwerk] Restarting OpenSim."
130 kill -s HUP `pidof mono` 129 kill -s HUP `pidof mono`
131 fi 130 fi
132 echo "[Clockwerk] Done." 131 echo "[Clockwerk] Done."
133 dialog --msgbox "Upgrade process is now complete. Have a nice day." 10 70 132 dialog --msgbox "Upgrade process is now complete. Have a nice day." 10 70
134   133