]> git.ipfire.org Git - ipfire-2.x.git/blob - updates/1.4.8/setup
git-svn-id: http://svn.ipfire.org/svn/ipfire/IPFire/source@16 ea5c0bd1-69bd-2848...
[ipfire-2.x.git] / updates / 1.4.8 / setup
1 #!/bin/bash
2
3 UPGRADEVERSION="1.4.8"
4 PREVIOUSVERSION="1.4.7"
5 echo "This is the $UPGRADEVERSION update patch for IPCop $PREVIOUSVERSION installing."
6
7 CURRENTVERSION=`perl -e "require '/var/ipcop/general-functions.pl';print \\$General::version;"`
8 if [ "$CURRENTVERSION" != "$PREVIOUSVERSION" ]; then
9 echo "You are not running IPCop v$PREVIOUSVERSION for this patch to install."
10 echo "Aborting installation."
11 exit -1
12 fi
13
14 # general-functions might not be overwrited by patch...
15 /bin/sed -i -e "s+= '1.4.*$+= '$UPGRADEVERSION';+" /var/ipcop/general-functions.pl
16
17 BOOT=`/bin/df | grep "/boot" | /usr/bin/awk '{ print $2 }'`
18 KVER=`uname -r`
19
20 # /boot is too small on flash disk with only 5MB size
21 # because smp files are bigger, we can't support upgrade from smp kernel with flash on small /boot
22 if [ "$BOOT" -le 7000 ]; then
23 if [ "$KVER" = "2.4.27-smp" -o "$KVER" = "2.4.29-smp" ]; then
24 echo "can't support kernel upgrade on smp machine with only 5MB on /boot"
25 echo "have 8MB on /boot with flash if you really need to use -smp during upgrade"
26 exit 1
27 else
28 rm -rf /boot/{vmlinuz,System.map}-2.4.27-smp \
29 /boot/{vmlinuz,System.map}-2.4.29-smp \
30 /boot/System.map-2.4.29-smp \
31 /boot/System.map-2.4.29-smp \
32 /boot/ipcoprd-smp-2.4.{27,29}.img
33 fi
34 fi
35 # make files really be erased or new files write may fail with flash on boot with 5MB
36 /bin/sync
37
38 # Install kernel 2.4.31 modules & k dependants files
39 # kernel modules are necessary to rebuild initrd
40 /bin/tar -zxpf patch.tar.gz -C /
41
42 ROOTDEV=`/bin/ls -l /dev/harddisk4 | /usr/bin/awk '{ print $NF }'`
43 # for IPCop without a kernel upgrade
44 if ( ! /bin/grep -q '2.4.27' /boot/grub/grub.conf ); then
45 echo "title IPCop old (2.4.27)" >> /boot/grub/grub.conf
46 echo " root (hd0,0)" >> /boot/grub/grub.conf
47 echo " kernel /vmlinuz-2.4.27 root=${ROOTDEV} panic=10 acpi=off ro" >> /boot/grub/grub.conf
48 if [ -f /boot/ipcoprd.img ]; then
49 echo " initrd /ipcoprd-2.4.27.img" >> /boot/grub/grub.conf
50 fi
51 echo " savedefault" >> /boot/grub/grub.conf
52 fi
53
54 # fix grub missing smp menu entries for old kernel on non flash /boot
55 if [ "$BOOT" -gt 7000 ]; then
56 echo "title IPCop old (2.4.27-smp)" >> /boot/grub/grub.conf
57 echo " root (hd0,0)" >> /boot/grub/grub.conf
58 echo " kernel /vmlinuz-2.4.27-smp root=${ROOTDEV} panic=10 acpi=off ro">> /boot/grub/grub.conf
59 if [ -f /boot/ipcoprd-smp.img ]; then
60 echo " initrd /ipcoprd-smp-2.4.27.img" >> /boot/grub/grub.conf
61 fi
62 echo " savedefault" >> /boot/grub/grub.conf
63 fi
64 echo "title IPCop old (2.4.27 ACPI enabled)" >> /boot/grub/grub.conf
65 echo " root (hd0,0)" >> /boot/grub/grub.conf
66 echo " kernel /vmlinuz-2.4.27 root=${ROOTDEV} panic=10 ro" >> /boot/grub/grub.conf
67 if [ -f /boot/ipcoprd.img ]; then
68 echo " initrd /ipcoprd-2.4.27.img" >> /boot/grub/grub.conf
69 fi
70 echo " savedefault" >> /boot/grub/grub.conf
71 # only on non flash /boot
72 if [ "$BOOT" -gt 7000 ]; then
73 echo "title IPCop old (2.4.27-smp ACPI HT enabled)" >> /boot/grub/grub.conf
74 echo " root (hd0,0)" >> /boot/grub/grub.conf
75 echo " kernel /vmlinuz-2.4.27-smp root=${ROOTDEV} panic=10 acpi=ht ro" >> /boot/grub/grub.conf
76 if [ -f /boot/ipcoprd.img ]; then
77 echo " initrd /ipcoprd-smp-2.4.27.img" >> /boot/grub/grub.conf
78 fi
79 echo " savedefault" >> /boot/grub/grub.conf
80 fi
81
82 # Upgrade grub and fix strange looking smp version name
83 sed -i -e 's/ipcoprd-smp-2.4.27/ipcoprd-2.4.27-smp/' \
84 -e 's/2.4.27/2.4.29/' /boot/grub/grub.conf
85
86 # Fix initrd
87 if [ -f /boot/ipcoprd.img ]; then
88 # Find out scsi module
89 IMAGE=`/usr/bin/mktemp /tmp/ipcoprd.img.XXXXXX`
90 MNTPOINT=`/usr/bin/mktemp -d /tmp/ipcoprd.mnt.XXXXXX`
91 /bin/gzip -d -c /boot/ipcoprd.img > $IMAGE
92 /bin/mount -o loop $IMAGE $MNTPOINT
93 SCSIDRIVER=`/bin/ls -1 $MNTPOINT/lib | \
94 /bin/grep -v sd_mod.o.gz |\
95 /bin/grep -v sg.o.gz |\
96 /bin/grep -v sr_mod.o.gz |\
97 /bin/grep -v 53c700.o.gz |\
98 /bin/grep -v NCR53C9x.o.gz |\
99 /bin/grep -v libata.o.gz |\
100 /bin/grep -v scsi_mod.o.gz |\
101 /bin/grep -v ataraid.o.gz |\
102 /bin/grep -v mptbase.o.gz |\
103 /bin/grep -v isa-pnp.o |\
104 /bin/grep -v ds.o.gz |\
105 /bin/grep -v pcmcia_core.o.gz |\
106 /bin/sed 's/.o.gz//'`
107 /bin/umount -d $MNTPOINT
108 /bin/rm -rf $MNTPOINT $IMAGE
109 /bin/mv -f /boot/ipcoprd.img /boot/ipcoprd-2.4.29.img
110 /bin/mv -f /boot/ipcoprd-smp.img /boot/ipcoprd-2.4.29-smp.img
111 if [ "$SCSIDRIVER" ]; then
112 if [ ! -f ipcoprd-2.4.29-smp.img ]; then
113 # on 1.4.3/1.4.4 update, ipcoprd-smp.img has failed, so do it now
114 /sbin/mkinitrd --with=scsi_mod --with=${SCSIDRIVER} --with=sd_mod --with=sr_mod --with=libata --with=ataraid /boot/ipcoprd-2.4.29-smp.img 2.4.29-smp
115 fi
116 /sbin/mkinitrd --with=scsi_mod --with=${SCSIDRIVER} --with=sd_mod --with=sr_mod --with=libata --with=ataraid /boot/ipcoprd.img 2.4.31
117 /sbin/mkinitrd --with=scsi_mod --with=${SCSIDRIVER} --with=sd_mod --with=sr_mod --with=libata --with=ataraid /boot/ipcoprd-smp.img 2.4.31-smp
118 fi
119 fi
120
121 # fix etc/modules.conf is more recent than ...modules.dep for 2.4.29 and 2.4.31
122 touch /lib/modules/*/modules.dep
123
124 echo "IPCop v$UPGRADEVERSION - The Bad Packets Stop Here">/etc/issue
125 killall mingetty #redisplay correct version
126 echo "end of $UPGRADEVERSION update"
127 exit 0