]>
Commit | Line | Data |
---|---|---|
2d9ee050 AF |
1 | #!/bin/bash |
2 | ############################################################################ | |
3 | # # | |
4 | # This file is part of the IPFire Firewall. # | |
5 | # # | |
6 | # IPFire is free software; you can redistribute it and/or modify # | |
7 | # it under the terms of the GNU General Public License as published by # | |
4378d325 | 8 | # the Free Software Foundation; either version 3 of the License, or # |
2d9ee050 AF |
9 | # (at your option) any later version. # |
10 | # # | |
11 | # IPFire is distributed in the hope that it will be useful, # | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | |
14 | # GNU General Public License for more details. # | |
15 | # # | |
16 | # You should have received a copy of the GNU General Public License # | |
17 | # along with IPFire; if not, write to the Free Software # | |
18 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # | |
19 | # # | |
9b50da9d | 20 | # Copyright (C) 2008 IPFire-Team <info@ipfire.org>. # |
2d9ee050 AF |
21 | # # |
22 | ############################################################################ | |
ff753a4c | 23 | # |
4378d325 AF |
24 | . /opt/pakfire/lib/functions.sh |
25 | /usr/local/bin/backupctrl exclude >/dev/null 2>&1 | |
ff753a4c | 26 | # |
4378d325 AF |
27 | OLDVERSION=`grep "version = " /opt/pakfire/etc/pakfire.conf | cut -d'"' -f2` |
28 | NEWVERSION="2.3" | |
a23731d1 | 29 | KVER="2.6.23.17" |
2d9ee050 AF |
30 | ROOT=`grep "root=" /boot/grub/grub.conf | cut -d"=" -f2 | cut -d" " -f1 | tail -n 1` |
31 | MOUNT=`grep "kernel" /boot/grub/grub.conf | tail -n 1` | |
32 | # Nur den letzten Parameter verwenden | |
33 | echo $MOUNT > /dev/null | |
34 | MOUNT=$_ | |
2d9ee050 | 35 | # |
2d9ee050 | 36 | echo |
609d4fa5 | 37 | echo Update IPFire $OLDVERSION to $NEWVERSION |
2d9ee050 | 38 | echo |
2d9ee050 AF |
39 | # |
40 | # check if we the backup file already exist | |
41 | if [ -e /var/ipfire/backup/update_$OLDVERSION-$NEWVERSION.tar.bz2 ]; then | |
45ff5fa6 AF |
42 | echo Moving backup to backup-old ... |
43 | mv -f /var/ipfire/backup/update_$OLDVERSION-$NEWVERSION.tar.bz2 \ | |
44 | /var/ipfire/backup/update_$OLDVERSION-$NEWVERSION-old.tar.bz2 | |
2d9ee050 AF |
45 | fi |
46 | echo First we made a backup of all files that was inside of the | |
47 | echo update archive. This may take a while ... | |
9b50da9d | 48 | # Add some files that are not in the package to backup |
e3d5f630 AF |
49 | echo etc/issue >> /opt/pakfire/tmp/ROOTFILES |
50 | echo opt/pakfire/etc/pakfire.conf >> /opt/pakfire/tmp/ROOTFILES | |
9b50da9d | 51 | echo var/spool/cron/root.orig >> /opt/pakfire/tmp/ROOTFILES |
c76472c0 | 52 | echo etc/udev/rules.d/30-persistent-network.rules >> /opt/pakfire/tmp/ROOTFILES |
4c1bf0c9 | 53 | echo etc/sysconfig/lm_sensors >> /opt/pakfire/tmp/ROOTFILES |
3b6f5eb1 AF |
54 | echo var/log/rrd >> /opt/pakfire/tmp/ROOTFILES |
55 | echo var/updatexlerator >> /opt/pakfire/tmp/ROOTFILES | |
bd24e1fa | 56 | echo lib/iptables >> /opt/pakfire/tmp/ROOTFILES |
761ef000 AF |
57 | echo lib/modules >> /opt/pakfire/tmp/ROOTFILES |
58 | echo boot >> /opt/pakfire/tmp/ROOTFILES | |
168a6840 AF |
59 | echo srv/web/ipfire/cgi-bin/fwhits.cgi >> /opt/pakfire/tmp/ROOTFILES |
60 | echo srv/web/ipfire/cgi-bin/network.cgi >> /opt/pakfire/tmp/ROOTFILES | |
61 | echo srv/web/ipfire/cgi-bin/traffics.cgi >> /opt/pakfire/tmp/ROOTFILES | |
bcad0fd0 CS |
62 | echo srv/web/ipfire/cgi-bin/graphs.cgi >> /opt/pakfire/tmp/ROOTFILES |
63 | echo srv/web/ipfire/cgi-bin/qosgraph.cgi >> /opt/pakfire/tmp/ROOTFILES | |
9b50da9d | 64 | # |
2d9ee050 | 65 | tar cjvf /var/ipfire/backup/update_$OLDVERSION-$NEWVERSION.tar.bz2 \ |
e3d5f630 | 66 | -T /opt/pakfire/tmp/ROOTFILES --exclude='#*' -C / > /dev/null 2>&1 |
2d9ee050 | 67 | echo |
4c1bf0c9 | 68 | echo Update IPfire to $NEWVERSION ... |
2d9ee050 | 69 | # |
159a9efd CS |
70 | # Delete old collectd symlink |
71 | # | |
72 | rm -rf /etc/rc.d/rc3.d/S20collectd | |
73 | # | |
761ef000 AF |
74 | # Delete squid symlink |
75 | # | |
76 | rm -rf /etc/rc.d/rc3.d/S99squid | |
77 | # | |
168a6840 AF |
78 | # Delete old cgi files ... |
79 | # | |
80 | rm -rf /srv/web/ipfire/cgi-bin/fwhits.cgi | |
81 | rm -rf /srv/web/ipfire/cgi-bin/network.cgi | |
82 | rm -rf /srv/web/ipfire/cgi-bin/traffics.cgi | |
bcad0fd0 CS |
83 | rm -rf /srv/web/ipfire/cgi-bin/graphs.cgi |
84 | rm -rf /srv/web/ipfire/cgi-bin/qosgraph.cgi | |
168a6840 | 85 | # |
bd24e1fa AF |
86 | # Delete old iptables libs... |
87 | # | |
88 | rm -rf /lib/iptables | |
89 | # | |
469c9f49 | 90 | # Remove old kernel, configs, initrd, modules ... |
2d9ee050 | 91 | # |
469c9f49 AF |
92 | rm -rf /boot/System.map-* |
93 | rm -rf /boot/config-* | |
94 | rm -rf /boot/ipfirerd-* | |
95 | rm -rf /boot/vmlinuz-* | |
96 | rm -rf /lib/modules/ | |
9b50da9d | 97 | # |
c2cd9391 CS |
98 | # Stopping Squid |
99 | # | |
100 | echo | |
101 | echo Stopping Squid ... | |
102 | /etc/init.d/squid stop | |
103 | # | |
2d9ee050 AF |
104 | # Unpack the updated files |
105 | # | |
106 | echo | |
107 | echo Unpack the updated files ... | |
4378d325 | 108 | extract_files |
c2cd9391 CS |
109 | # |
110 | # Starting Squid | |
111 | # | |
112 | echo | |
113 | echo Starting Squid ... | |
114 | /etc/init.d/squid start | |
2d9ee050 AF |
115 | # |
116 | # Modify grub.conf | |
609d4fa5 AF |
117 | # |
118 | echo | |
2d9ee050 | 119 | echo Update grub configuration ... |
609d4fa5 | 120 | sed -i "s|ROOT|$ROOT|g" /boot/grub/grub.conf |
2d9ee050 AF |
121 | sed -i "s|KVER|$KVER|g" /boot/grub/grub.conf |
122 | sed -i "s|MOUNT|$MOUNT|g" /boot/grub/grub.conf | |
2d9ee050 | 123 | # |
edd66ab6 AF |
124 | # Made emergency - initramdisk |
125 | # | |
e3d5f630 AF |
126 | echo |
127 | echo Create new Initramdisks ... | |
edd66ab6 AF |
128 | cp -f /etc/mkinitcpio.conf /etc/mkinitcpio.conf.org |
129 | sed -i "s| autodetect | |g" /etc/mkinitcpio.conf | |
e3d5f630 | 130 | mkinitcpio -k $KVER-ipfire -g /boot/ipfirerd-$KVER-emergency.img |
edd66ab6 AF |
131 | cp -f /etc/mkinitcpio.conf.org /etc/mkinitcpio.conf |
132 | # | |
2d9ee050 AF |
133 | # Made initramdisk |
134 | # | |
2d9ee050 AF |
135 | if [ "${ROOT:0:7}" == "/dev/sd" ]; then |
136 | # Remove ide hook if root is on sda | |
137 | sed -i "s| ide | |g" /etc/mkinitcpio.conf | |
138 | else | |
139 | if [ "${ROOT:0:7}" == "/dev/hd" ]; then | |
2e95c21c | 140 | # Remove pata & sata hook if root is on hda |
2d9ee050 | 141 | sed -i "s| pata | |g" /etc/mkinitcpio.conf |
2e95c21c | 142 | sed -i "s| sata | |g" /etc/mkinitcpio.conf |
2d9ee050 AF |
143 | fi |
144 | fi | |
145 | mkinitcpio -k $KVER-ipfire -g /boot/ipfirerd-$KVER.img | |
fd383f41 | 146 | #mkinitcpio -k $KVER-ipfire-smp -g /boot/ipfirerd-$KVER-smp.img |
999dc5dc | 147 | mkinitcpio -k 2.6.25.17-ipfire -g /boot/ipfirerd-2.6.25.17.img |
2d9ee050 | 148 | # |
761ef000 AF |
149 | # ReInstall grub |
150 | # | |
151 | grub-install --no-floppy ${ROOT::`expr length $ROOT`-1} | |
152 | # | |
a4c0594b AF |
153 | # Update fstab |
154 | # | |
155 | grep -v "tmpfs" /etc/fstab > /tmp/fstab.tmp | |
a4c0594b AF |
156 | echo none /tmp tmpfs defaults,size=128M 0 0 >> /tmp/fstab.tmp |
157 | echo none /var/log/rrd tmpfs defaults,size=64M 0 0 >> /tmp/fstab.tmp | |
5dd4242e CS |
158 | echo none /var/lock tmpfs defaults,size=16M 0 0 >> /tmp/fstab.tmp |
159 | echo none /var/spool tmpfs defaults,size=16M 0 0 >> /tmp/fstab.tmp | |
a4c0594b AF |
160 | mv /tmp/fstab.tmp /etc/fstab |
161 | # | |
2d9ee050 AF |
162 | # Change version of Pakfire.conf |
163 | # | |
164 | sed -i "s|$OLDVERSION|$NEWVERSION|g" /opt/pakfire/etc/pakfire.conf | |
609d4fa5 AF |
165 | # |
166 | # Create new issue | |
167 | # | |
30abd974 | 168 | echo IPFire v$NEWVERSION - www.ipfire.org > /etc/issue |
609d4fa5 AF |
169 | echo =================================== >> /etc/issue |
170 | echo \\n running on \\s \\r \\m >> /etc/issue | |
9b50da9d AF |
171 | # |
172 | # Update crontab | |
173 | # | |
174 | grep -v "ipacsum" /var/spool/cron/root.orig > /tmp/root.orig.tmp | |
7d0027bc AF |
175 | echo "# Backup collectd files" >> /tmp/root.orig.tmp |
176 | echo "01 * * * * /etc/init.d/collectd backup >/dev/null" >> /tmp/root.orig.tmp | |
9b50da9d AF |
177 | mv /tmp/root.orig.tmp /var/spool/cron/root.orig |
178 | chmod 600 /var/spool/cron/root.orig | |
179 | chown root:cron /var/spool/cron/root.orig | |
180 | # | |
181 | # Update network-rules | |
182 | # | |
c76472c0 AF |
183 | sed -i 's|"net", SYSFS{address}|"net", SYSFS{type}=="1", SYSFS{address}|g' \ |
184 | /etc/udev/rules.d/30-persistent-network.rules | |
9b50da9d | 185 | # |
876667fc AF |
186 | # Core 17 |
187 | # | |
609d4fa5 | 188 | perl -e "require '/var/ipfire/lang.pl'; &Lang::BuildCacheLang" |
41e27086 | 189 | perl /var/ipfire/qos/bin/migrate.pl |
d7c1050e | 190 | /var/ipfire/updatexlrator/bin/convert |
876667fc | 191 | # |
88abfb83 AF |
192 | # Delete old lm-sensor modullist... |
193 | # | |
194 | rm -rf /etc/sysconfig/lm_sensors | |
195 | # | |
876667fc AF |
196 | # ISDN |
197 | # | |
609d4fa5 | 198 | /etc/init.d/mISDN config |
7795e9ba | 199 | # |
de0e9b75 | 200 | # Remove obsolete packages, update the lists and do upgrade |
7795e9ba | 201 | # |
45ff5fa6 | 202 | echo '#!/bin/bash' > /tmp/remove_obsolete_paks |
7795e9ba AF |
203 | echo 'while [ "$(ps -A | grep " update.sh")" != "" ]; do' >> /tmp/remove_obsolete_paks |
204 | echo ' sleep 2' >> /tmp/remove_obsolete_paks | |
205 | echo 'done' >> /tmp/remove_obsolete_paks | |
206 | echo 'while [ "$(ps -A | grep " pakfire")" != "" ]; do' >> /tmp/remove_obsolete_paks | |
207 | echo ' sleep 2' >> /tmp/remove_obsolete_paks | |
208 | echo 'done' >> /tmp/remove_obsolete_paks | |
de0e9b75 | 209 | echo '/opt/pakfire/pakfire remove -y mpg123 subversion zaptel' >> /tmp/remove_obsolete_paks |
82d8ebf1 AF |
210 | echo '/opt/pakfire/pakfire update -y --force' >> /tmp/remove_obsolete_paks |
211 | echo '/opt/pakfire/pakfire upgrade -y' >> /tmp/remove_obsolete_paks | |
469c9f49 AF |
212 | echo '/opt/pakfire/pakfire upgrade -y' >> /tmp/remove_obsolete_paks |
213 | echo '/opt/pakfire/pakfire upgrade -y' >> /tmp/remove_obsolete_paks | |
214 | echo 'logger -p syslog.emerg -t core-upgrade-18 "Upgrade finished. Please reboot... "' >> /tmp/remove_obsolete_paks | |
c76472c0 | 215 | # |
7795e9ba AF |
216 | chmod +x /tmp/remove_obsolete_paks |
217 | /tmp/remove_obsolete_paks & | |
609d4fa5 | 218 | echo |
7795e9ba | 219 | echo Please wait until pakfire has ended... |
27731caa | 220 | echo |