opensim-tools – Diff between revs 89 and 90

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