Added HotFix-Scripts (not yet finished) for easier editing on multiple PCs :)
[openpandora.oe.git] / recipes / hotfix / updater1.sh
1 #### THIS SCRIPT IS NOT FINISHED YET! ####
2
3 #!/bin/bash
4 newkern=b00a5d617f11366689488395b19411de
5 oldkern=3112d1782a90c2c87ae17a152a35deae
6 currkern=$(md5sum /boot/uImage | cut -d" " -f1)
7 needfree=$(ls -lk uImage | grep uImage | cut -d" " -f5)
8 oldinterfaces=23f72750f2f7335b9c2ed3f55aaa5061
9 oldrcwl1251=7a6361e842f0f589418218436affbe07
10 newmmenu=af66a5118a9bfef8eca5de13ee64c6a1
11 oldmmenu1=
12 oldmmenu2=fa45e9bc91c48640a9ea592de5fbeb3c
13 oldmmenuconf1=
14 oldmmenuconf2=c90d33c362121ddd0e24e9eac0b82da9
15 newmmenuconf=d3b237cf95ff6c6e81b23483e87391e1
16 currmmenu=$(md5sum /usr/bin/mmenu | cut -d" " -f1)
17 currmmenuconf=$(md5sum /etc/pandora/conf/mmenu.conf | cut -d" " -f1)
18 err="Your system has been updated without any errors."
19
20 rm /tmp/updater.log
21
22 if zenity --question --title="Update Package 2" --text="This PND updates your Pandora OS. You can safely delete it after it has finished.\nThis pack includes all updates from Hotfix 1 as well.\n\nDo you want to start the upgrade now? " --ok-label="Start now" --cancel-label="Don't do it" ; then
23
24 (
25 echo "10"
26 echo "# Updating kernel if needed"
27
28 # HotFix 1
29 # Kernel Update
30
31   if [ $oldkern = $currkern ]; then   
32      rm /boot/uImage.old
33      currfree=$(df /boot | grep boot | awk '{print $4}')
34      if [ $currfree -lt $needfree ]; then
35         err="There is not enough diskspace on /boot/ to update the kernel.\n\nKernel couldn't be updated."
36         echo "Kernel not updated - not enough diskspace on /boot/" >> /tmp/updater.log
37       else
38         cp uImage /boot/uImage.new
39         sync
40         currkern=$(md5sum /boot/uImage.new | cut -d" " -f1)
41           if [ $currkern = $newkern ]; then
42             mv /boot/uImage /boot/uImage.old
43             mv /boot/uImage.new /boot/uImage
44             currkern=$(md5sum /boot/uImage | cut -d" " -f1)
45             if [ $currkern != $newkern ]; then
46                rm /boot/uImage
47                mv /boot/uImage.old /boot/uImage
48                err="There was a checksum error while copying the kernel.\n\nKernel couldn't be updated. Please check your SD-Card and try to recopy the PND-File."
49                echo "Kernel not updated - checksum error" >> /tmp/updater.log
50             fi
51           else
52             rm /boot/uImage.new
53             err="There was a checksum error while copying the kernel.\n\nKernel couldn't be updated. Please check your SD-Card and try to recopy the PND-File."
54             echo "Kernel not updated - checksum error" >> /tmp/updater.log
55           fi
56      fi
57   fi
58   echo "Kernel successfully updated" >> /tmp/updater.log
59   sync
60
61 # Libraries for HotFix 1
62   
63 echo "20"
64 echo "# Installing missing Python libraries"
65 if [ ! -f /usr/lib/glob.py ];
66   opkg install gnome-vfs-plugin-ftp_2.24.1-r2.5_armv7a.ipk gnome-vfs-plugin-http_2.24.1-r2.5_armv7a.ipk python-pycairo_1.4.0-ml3.5_armv7a.ipk python-pygtk_2.16.0-r1.5_armv7a.ipk python-shell_2.6.4-ml9.1.5_armv7a.ipk
67   echo "Python libraries successfully updated" >> /tmp/updater.log
68   sync
69 else 
70   echo "Python libraries were installed." >> /tmp/updater.log
71 fi
72
73 # HotFix 2
74 # MiniMenu Update
75
76 echo "30"
77 echo "# Installing updated MiniMenu"
78  if [ $oldmmenu1 = $currmmenu -o $oldmmenu2 = $currmenu]; then   
79      rm /usr/bin/mmenu.old
80      cp 2/mmenu /usr/bin/mmenu.new
81      cp 2/mmenu.conf /etc/pandora/conf/mmenu.conf.new
82         sync
83         currmmenu=$(md5sum /usr/bin/mmenu.new | cut -d" " -f1)
84           if [ $currmmenu = $newmmenu ]; then
85             mv /usr/bin/mmenu /usr/bin/mmenu.old
86             mv /etc/pandora/conf/mmenu.conf /etc/pandora/conf/mmenu.conf.old
87             mv /usr/bin/mmenu.new /usr/bin/mmenu
88             mv /etc/pandora/conf/mmenu.conf.new /etc/pandora/conf/mmenu.conf
89             currmmenu=$(md5sum /boot/uImage | cut -d" " -f1)
90             if [ $currmmenu != $newmmenu ]; then
91                rm /usr/bin/mmenu
92                rm /etc/pandora/conf/mmenu.conf
93                mv /etc/pandora/conf/mmenu.conf.old /etc/pandora/conf/mmenu.conf
94                mv /usr/bin/mmenu.old /usr/bin/mmenu
95                err="There was a checksum error while copying MiniMenu.\n\nMiniMenu couldn't be updated. Please check your SD-Card and try to recopy the PND-File."
96                echo "MiniMenu not updated - checksum error" >> /tmp/updater.log
97             fi
98           else
99             rm /usr/bin/mmenu.new
100             rm /etc/pandora/conf/mmenu.conf.new
101             err="There was a checksum error while copying MiniMenu.\n\nMiniMenu couldn't be updated. Please check your SD-Card and try to recopy the PND-File."
102             echo "MiniMenu not updated - checksum error" >> /tmp/updater.log
103           fi
104      fi
105   fi
106   echo "MiniMenu successfully updated" >> /tmp/updater.log
107   sync
108
109 # Libraries for HotFix 2
110
111 echo "40"
112 echo "# Installing Boost Library"
113 if [ ! -f /usr/lib/glob.py ];
114   opkg install 2/
115   echo "Boost library successfully updated" >> /tmp/updater.log
116   sync
117 else 
118   echo "Boost library was already up-to-date." >> /tmp/updater.log
119 fi
120
121 # Bugfixes in Scripts
122
123 echo "50"
124 echo "# Installing updated scripts"
125
126
127 )
128
129
130 # Zenity Progress goes here
131 fi