]>
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 | # # | |
20 | # Copyright (C) 2007 IPFire-Team <info@ipfire.org>. # | |
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" | |
202f35e2 | 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=$_ | |
609d4fa5 | 35 | OLDKERNEL=`ls /boot/vmlinuz-*-ipfire | cut -d"-" -f2 | tail -n 1` |
2d9ee050 | 36 | # |
2d9ee050 | 37 | echo |
609d4fa5 | 38 | echo Update IPFire $OLDVERSION to $NEWVERSION |
2d9ee050 | 39 | echo |
2d9ee050 AF |
40 | # |
41 | # check if we the backup file already exist | |
42 | if [ -e /var/ipfire/backup/update_$OLDVERSION-$NEWVERSION.tar.bz2 ]; then | |
45ff5fa6 AF |
43 | echo Moving backup to backup-old ... |
44 | mv -f /var/ipfire/backup/update_$OLDVERSION-$NEWVERSION.tar.bz2 \ | |
45 | /var/ipfire/backup/update_$OLDVERSION-$NEWVERSION-old.tar.bz2 | |
2d9ee050 AF |
46 | fi |
47 | echo First we made a backup of all files that was inside of the | |
48 | echo update archive. This may take a while ... | |
625cfc40 | 49 | # Add issue and packfire conf to backup |
e3d5f630 AF |
50 | echo etc/issue >> /opt/pakfire/tmp/ROOTFILES |
51 | echo opt/pakfire/etc/pakfire.conf >> /opt/pakfire/tmp/ROOTFILES | |
2d9ee050 | 52 | tar cjvf /var/ipfire/backup/update_$OLDVERSION-$NEWVERSION.tar.bz2 \ |
e3d5f630 | 53 | -T /opt/pakfire/tmp/ROOTFILES --exclude='#*' -C / > /dev/null 2>&1 |
2d9ee050 AF |
54 | echo |
55 | echo Update IPfire to $NEWVERSON ... | |
56 | # | |
159a9efd CS |
57 | # Delete old collectd symlink |
58 | # | |
59 | rm -rf /etc/rc.d/rc3.d/S20collectd | |
60 | # | |
2d9ee050 AF |
61 | # Backup the old grub config |
62 | # | |
63 | mv /boot/grub/grub.conf /boot/grub/grub-old.conf | |
64 | # | |
65 | # Unpack the updated files | |
66 | # | |
67 | echo | |
68 | echo Unpack the updated files ... | |
4378d325 | 69 | extract_files |
2d9ee050 AF |
70 | # |
71 | # Modify grub.conf | |
609d4fa5 AF |
72 | # |
73 | echo | |
2d9ee050 | 74 | echo Update grub configuration ... |
609d4fa5 | 75 | sed -i "s|ROOT|$ROOT|g" /boot/grub/grub.conf |
2d9ee050 AF |
76 | sed -i "s|KVER|$KVER|g" /boot/grub/grub.conf |
77 | sed -i "s|MOUNT|$MOUNT|g" /boot/grub/grub.conf | |
78 | echo "title Old Kernel" >> /boot/grub/grub.conf | |
609d4fa5 AF |
79 | echo " configfile /grub/grub-old.conf" >> /boot/grub/grub.conf |
80 | sed -i "s|/vmlinuz-ipfire|/vmlinuz-$OLDKERNEL-ipfire|g" /boot/grub/grub-old.conf | |
2d9ee050 | 81 | # |
edd66ab6 AF |
82 | # Made emergency - initramdisk |
83 | # | |
e3d5f630 AF |
84 | echo |
85 | echo Create new Initramdisks ... | |
edd66ab6 AF |
86 | cp -f /etc/mkinitcpio.conf /etc/mkinitcpio.conf.org |
87 | sed -i "s| autodetect | |g" /etc/mkinitcpio.conf | |
e3d5f630 | 88 | mkinitcpio -k $KVER-ipfire -g /boot/ipfirerd-$KVER-emergency.img |
edd66ab6 AF |
89 | cp -f /etc/mkinitcpio.conf.org /etc/mkinitcpio.conf |
90 | # | |
2d9ee050 AF |
91 | # Made initramdisk |
92 | # | |
2d9ee050 AF |
93 | if [ "${ROOT:0:7}" == "/dev/sd" ]; then |
94 | # Remove ide hook if root is on sda | |
95 | sed -i "s| ide | |g" /etc/mkinitcpio.conf | |
96 | else | |
97 | if [ "${ROOT:0:7}" == "/dev/hd" ]; then | |
2e95c21c | 98 | # Remove pata & sata hook if root is on hda |
2d9ee050 | 99 | sed -i "s| pata | |g" /etc/mkinitcpio.conf |
2e95c21c | 100 | sed -i "s| sata | |g" /etc/mkinitcpio.conf |
2d9ee050 AF |
101 | fi |
102 | fi | |
103 | mkinitcpio -k $KVER-ipfire -g /boot/ipfirerd-$KVER.img | |
fd383f41 | 104 | #mkinitcpio -k $KVER-ipfire-smp -g /boot/ipfirerd-$KVER-smp.img |
2d9ee050 AF |
105 | # |
106 | # Change version of Pakfire.conf | |
107 | # | |
108 | sed -i "s|$OLDVERSION|$NEWVERSION|g" /opt/pakfire/etc/pakfire.conf | |
609d4fa5 AF |
109 | # |
110 | # Create new issue | |
111 | # | |
30abd974 | 112 | echo IPFire v$NEWVERSION - www.ipfire.org > /etc/issue |
609d4fa5 AF |
113 | echo =================================== >> /etc/issue |
114 | echo \\n running on \\s \\r \\m >> /etc/issue | |
27731caa | 115 | # Core 17 begin |
609d4fa5 AF |
116 | perl -e "require '/var/ipfire/lang.pl'; &Lang::BuildCacheLang" |
117 | /etc/init.d/mISDN config | |
27731caa | 118 | # Core 17 end |
7795e9ba AF |
119 | # |
120 | # Remove obsolete packages | |
121 | # | |
45ff5fa6 | 122 | echo '#!/bin/bash' > /tmp/remove_obsolete_paks |
7795e9ba AF |
123 | echo 'while [ "$(ps -A | grep " update.sh")" != "" ]; do' >> /tmp/remove_obsolete_paks |
124 | echo ' sleep 2' >> /tmp/remove_obsolete_paks | |
125 | echo 'done' >> /tmp/remove_obsolete_paks | |
126 | echo 'while [ "$(ps -A | grep " pakfire")" != "" ]; do' >> /tmp/remove_obsolete_paks | |
127 | echo ' sleep 2' >> /tmp/remove_obsolete_paks | |
128 | echo 'done' >> /tmp/remove_obsolete_paks | |
45ff5fa6 | 129 | echo '/opt/pakfire/pakfire remove zaptel -y' >> /tmp/remove_obsolete_paks |
02663e5e | 130 | echo '/opt/pakfire/pakfire update --force' >> /tmp/remove_obsolete_paks |
7795e9ba AF |
131 | echo 'echo' >> /tmp/remove_obsolete_paks |
132 | echo 'echo Update to IPFire $NEWVERSION finished. Please reboot... ' >> /tmp/remove_obsolete_paks | |
133 | echo 'echo' >> /tmp/remove_obsolete_paks | |
134 | chmod +x /tmp/remove_obsolete_paks | |
135 | /tmp/remove_obsolete_paks & | |
609d4fa5 | 136 | echo |
7795e9ba | 137 | echo Please wait until pakfire has ended... |
27731caa | 138 | echo |