1 |
upgrade |
upgrade |
2 |
text |
text |
3 |
cdrom |
cdrom |
|
skipx |
|
|
mouse |
|
4 |
bootloader --location=mbr |
bootloader --location=mbr |
5 |
zerombr yes |
zerombr yes |
6 |
|
|
7 |
%post |
%post |
8 |
/sbin/syslogd & |
/sbin/syslogd & |
9 |
sleep 1 |
sleep 2 |
10 |
/sbin/e-smith/signal-event post-upgrade |
/sbin/e-smith/signal-event post-upgrade |
11 |
|
|
12 |
kudzu --safe --quiet |
# HACK - fix selinux config |
13 |
/sbin/depmod -a -e -C /dev/null -F /boot/SystemMap-2.4.21-32.0.1.EL 2.4.21-32.0.1.EL |
perl -p -i -e 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config |
|
/sbin/depmod -a -e -C /dev/null -F /boot/SystemMap-2.4.21-32.0.1.ELsmp 2.4.21-32.0.1.ELsmp |
|
|
/sbin/mkinitrd -v -f /boot/initrd-2.4.21-32.0.1.EL.img 2.4.21-32.0.1.EL |
|
|
/sbin/mkinitrd -v -f /boot/initrd-2.4.21-32.0.1.ELsmp.img 2.4.21-32.0.1.ELsmp |
|
14 |
|
|
15 |
|
%pre |
16 |
|
#!/bin/sh |
17 |
|
set -x |
18 |
|
|
19 |
|
# let's assume it's a SCSI system |
20 |
|
if grep -q 'sda$' /proc/partitions; then |
21 |
|
disk=sda |
22 |
|
else |
23 |
|
# No SCSI Drives is must be IDE |
24 |
|
media=`cat /proc/ide/hda/media` |
25 |
|
if [ $media == "disk" ] ; then |
26 |
|
disk=hda |
27 |
|
fi |
28 |
|
fi |
29 |
|
|
30 |
|
set $disk |
31 |
|
found=`echo $#` |
32 |
|
if [ $found -gt "0" ] ; then |
33 |
|
# Dump out current partitions |
34 |
|
sfdisk -d /dev/$disk > /tmp/oldparts |
35 |
|
|
36 |
|
# Check if we have any ext2/3 or swap partitions |
37 |
|
if grep -q 'Id=8[23]' /tmp/oldparts; then |
38 |
|
# Convert ext2/3 and swap partitions to raid autodetect |
39 |
|
sed 's/Id=8[32]/Id=fd/' /tmp/oldparts > /tmp/newparts |
40 |
|
|
41 |
|
# Find swap partition for future checks |
42 |
|
swap=`grep 'Id=82' /tmp/oldparts | sed "s/$disk\([0-9]\+\) :.*/md\1/"` |
43 |
|
|
44 |
|
# Loop throught partitions and convert to degraded raid1 |
45 |
|
for part in `grep 'Id=8[23]' /tmp/oldparts | sed 's/ :.*//'`; do |
46 |
|
mdpart=`echo $part | sed "s/$disk\([0-9]\+\)/md\1/"` |
47 |
|
mdadm --create $mdpart --run --level=1 --raid-devices=2 $part missing |
48 |
|
if [ "$mdpart" == "$swap" ]; then |
49 |
|
# Recreate swap partition |
50 |
|
mkswap $swap |
51 |
|
else |
52 |
|
# Resize ext2/3 partitions (fix superblock - part 1) |
53 |
|
resize2fs -f $mdpart |
54 |
|
fi |
55 |
|
done |
56 |
|
# Write out new converted partition table |
57 |
|
sfdisk --force /dev/$disk < /tmp/newparts |
58 |
|
|
59 |
|
mkdir /mnt/tmp |
60 |
|
for part in `grep 'Id=fd' /tmp/newparts | sed "s/$disk\([0-9]\+\) :.*/md\1/"`; do |
61 |
|
if [ "$part" != "$swap" ]; then |
62 |
|
# Resize ext2/3 partitions (fix superblock - part 2) |
63 |
|
e2fsck -f $part |
64 |
|
|
65 |
|
# Check for /etc/fstab on partitions and convert entries |
66 |
|
mount $part /mnt/tmp |
67 |
|
if [ -r /mnt/tmp/etc/fstab ]; then |
68 |
|
cat /mnt/tmp/etc/fstab | sed "s/$disk\([0-9]\+\)/md\1/" > /mnt/tmp/etc/fstab.tmp |
69 |
|
mv /mnt/tmp/etc/fstab.tmp /mnt/tmp/etc/fstab |
70 |
|
fi |
71 |
|
umount /mnt/tmp |
72 |
|
fi |
73 |
|
done |
74 |
|
rmdir /mnt/tmp |
75 |
|
mdadm --stop --scan |
76 |
|
fi |
77 |
|
fi |