opensim-tools – Diff between revs 49 and 50

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 49 Rev 50
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 update 17 aptitude update
18 aptitude upgrade 18 aptitude 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 purge $p 23 aptitude 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 install $i 30 aptitude install $i
31 fi 31 fi
32 done 32 done
33 fi 33 fi
34 fi 34 fi
35   35  
36 # OpenSim upgrade 36 # OpenSim upgrade
37 pushd ./ 37 pushd ./
38 if [ -d ../opensim-sources/ ]; then 38 if [ -d ../opensim-sources/ ]; then
39 cd ../opensim-sources/ 39 cd ../opensim-sources/
40 echo "[SpectacledOwl] Updating sources..." 40 echo "[SpectacledOwl] Updating sources..."
41 svn update 41 svn update
42 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 42 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
43 if [ $? == "0" ]; then 43 if [ $? == "0" ]; then
44 echo "[SpectacledOwl] Cleaning..." 44 echo "[SpectacledOwl] Cleaning..."
45 PKG_CONFIG_PATH=/opt/mono-4-0/lib/pkgconfig make clean 45 PKG_CONFIG_PATH=/opt/mono-4-0/lib/pkgconfig make clean
46 echo "[SpectacledOwl] Build..." 46 echo "[SpectacledOwl] Build..."
47 PKG_CONFIG_PATH=/opt/mono-4-0/lib/pkgconfig make 47 PKG_CONFIG_PATH=/opt/mono-4-0/lib/pkgconfig make
48 if [ -d /home/opensim/os ]; then 48 if [ -d /home/opensim/os ]; then
49 echo "[SpectacledOwl] Copying files..." 49 echo "[SpectacledOwl] Copying files..."
50 mkdir -p /home/opensim/os 50 mkdir -p /home/opensim/os
51 find bin/ -name \*.ini -exec rm -rf '{}' \; 51 find bin/ -name \*.ini -exec rm -rf '{}' \;
52 find bin/ -name \*.config -exec rm -rf '{}' \; 52 find bin/ -name \*.config -exec rm -rf '{}' \;
53 cp -Ra bin/* /home/opensim/os/ 53 cp -Ra bin/* /home/opensim/os/
54 echo "[SpectacledOwl] Changing ownership..." 54 echo "[SpectacledOwl] Changing ownership..."
55 chown -R opensim:opensim /home/opensim/os/ 55 chown -R opensim:opensim /home/opensim/os/
56 fi 56 fi
57 fi 57 fi
58 fi 58 fi
59 if [ -d ../opensim-config/ ]; then 59 if [ -d ../opensim-config/ ]; then
60 cd ../opensim-config/ 60 cd ../opensim-config/
61 svn update 61 svn update
62 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 62 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
63 if [ $? == "0" ]; then 63 if [ $? == "0" ]; then
64 echo "[SpectacledOwl] Updating configuration..." 64 echo "[SpectacledOwl] Updating configuration..."
65 cp -Ra * /home/opensim/os/ 65 cp -Ra * /home/opensim/os/
66 fi 66 fi
67 fi 67 fi
68 if [ -d ../opensim-www/ ]; then 68 if [ -d ../opensim-www/ ]; then
69 cd ../opensim-www/ 69 cd ../opensim-www/
70 svn update 70 svn update
71 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 71 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
72 if [ $? == "0" ]; then 72 if [ $? == "0" ]; then
73 echo "[SpectacledOwl] Updating website..." 73 echo "[SpectacledOwl] Updating website..."
74 cp -R * /var/www/ 74 cp -R * /var/www/
75 chown -R www-data:www-data /var/www 75 chown -R www-data:www-data /var/www
76 service lighttpd restart 76 service lighttpd restart
77 fi 77 fi
78 fi 78 fi
79 popd 79 popd
80 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 80 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
81 if [ $? == "0" ]; then 81 if [ $? == "0" ]; then
82 echo "[SpectacledOwl] Deploying tools..." 82 echo "[SpectacledOwl] Deploying tools..."
83 if [ -x lib/osstrap ]; then 83 if [ -x lib/osstrap ]; then
84 cp lib/osstrap /etc/init.d/osstrap 84 cp lib/osstrap /etc/init.d/osstrap
85 fi 85 fi
86 if [ -x lib/iardumper ]; then 86 if [ -x lib/iardumper ]; then
87 cp lib/iardumper /etc/cron.daily/iardumper 87 cp lib/iardumper /etc/cron.daily/iardumper
88 fi 88 fi
89 fi 89 fi
90 if [ -x lib/firewall ]; then 90 if [ -x lib/firewall ]; then
91 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 91 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
92 if [ $? == "0" ]; then 92 if [ $? == "0" ]; then
93 echo "[SpectacledOwl] Applying firewall..." 93 echo "[SpectacledOwl] Applying firewall..."
94 lib/firewall 94 lib/firewall
95 fi 95 fi
96 fi 96 fi
97 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 97 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
98 if [ $? == "0" ]; then 98 if [ $? == "0" ]; then
99 echo "[SpectacledOwl] Restarting OpenSim." 99 echo "[SpectacledOwl] Restarting OpenSim."
100 kill -s HUP `pidof mono` 100 kill -s HUP `pidof mono`
101 fi 101 fi
102 echo "[SpectacledOwl] Done." 102 echo "[SpectacledOwl] Done."
103 dialog --msgbox "Upgrade process is now complete. Have a nice day." 10 70 103 dialog --msgbox "Upgrade process is now complete. Have a nice day." 10 70
104   104