1 |
gordonr |
1.1 |
upgrade |
2 |
|
|
text |
3 |
|
|
cdrom |
4 |
slords |
1.8 |
skipx |
5 |
|
|
mouse |
6 |
|
|
network --device eth0 --bootproto dhcp |
7 |
|
|
rootpw --iscrypted $1$iHhL195i$25OY88oyw2bxgU47MvuZf0 |
8 |
|
|
firewall --disabled |
9 |
slords |
1.9 |
selinux --disabled |
10 |
slords |
1.8 |
authconfig --enableshadow --enablemd5 |
11 |
gordonr |
1.1 |
bootloader --location=mbr |
12 |
|
|
zerombr yes |
13 |
|
|
|
14 |
|
|
%post |
15 |
|
|
/sbin/syslogd & |
16 |
slords |
1.2 |
sleep 2 |
17 |
gordonr |
1.1 |
/sbin/e-smith/signal-event post-upgrade |
18 |
|
|
|
19 |
slords |
1.2 |
%pre |
20 |
|
|
#!/bin/sh |
21 |
|
|
set -x |
22 |
|
|
|
23 |
|
|
# let's assume it's a SCSI system |
24 |
|
|
if grep -q 'sda$' /proc/partitions; then |
25 |
|
|
disk=sda |
26 |
|
|
else |
27 |
|
|
# No SCSI Drives is must be IDE |
28 |
|
|
media=`cat /proc/ide/hda/media` |
29 |
|
|
if [ $media == "disk" ] ; then |
30 |
|
|
disk=hda |
31 |
|
|
fi |
32 |
|
|
fi |
33 |
|
|
|
34 |
|
|
set $disk |
35 |
|
|
found=`echo $#` |
36 |
|
|
if [ $found -gt "0" ] ; then |
37 |
|
|
# Dump out current partitions |
38 |
|
|
sfdisk -d /dev/$disk > /tmp/oldparts |
39 |
|
|
|
40 |
|
|
# Check if we have any ext2/3 or swap partitions |
41 |
|
|
if grep -q 'Id=8[23]' /tmp/oldparts; then |
42 |
gordonr |
1.4 |
echo -n "Converting partitions to RAID..." >/dev/tty1 |
43 |
slords |
1.2 |
# Convert ext2/3 and swap partitions to raid autodetect |
44 |
|
|
sed 's/Id=8[32]/Id=fd/' /tmp/oldparts > /tmp/newparts |
45 |
|
|
|
46 |
|
|
# Find swap partition for future checks |
47 |
|
|
swap=`grep 'Id=82' /tmp/oldparts | sed "s/$disk\([0-9]\+\) :.*/md\1/"` |
48 |
|
|
|
49 |
|
|
# Loop throught partitions and convert to degraded raid1 |
50 |
|
|
for part in `grep 'Id=8[23]' /tmp/oldparts | sed 's/ :.*//'`; do |
51 |
|
|
mdpart=`echo $part | sed "s/$disk\([0-9]\+\)/md\1/"` |
52 |
gordonr |
1.3 |
|
53 |
gordonr |
1.4 |
echo -n "$part..." >/dev/tty1 |
54 |
slords |
1.2 |
mdadm --create $mdpart --run --level=1 --raid-devices=2 $part missing |
55 |
|
|
if [ "$mdpart" == "$swap" ]; then |
56 |
|
|
# Recreate swap partition |
57 |
|
|
mkswap $swap |
58 |
|
|
else |
59 |
|
|
# Resize ext2/3 partitions (fix superblock - part 1) |
60 |
|
|
resize2fs -f $mdpart |
61 |
|
|
fi |
62 |
|
|
done |
63 |
gordonr |
1.3 |
|
64 |
gordonr |
1.4 |
echo "done" >/dev/tty1 |
65 |
gordonr |
1.3 |
|
66 |
slords |
1.2 |
# Write out new converted partition table |
67 |
|
|
sfdisk --force /dev/$disk < /tmp/newparts |
68 |
|
|
|
69 |
gordonr |
1.7 |
echo "Checking filesystems on converted partitions. This may take a few minutes." >/dev/tty1 |
70 |
gordonr |
1.6 |
echo -n "Checking filesystems..." >/dev/tty1 |
71 |
gordonr |
1.3 |
|
72 |
slords |
1.2 |
mkdir /mnt/tmp |
73 |
|
|
for part in `grep 'Id=fd' /tmp/newparts | sed "s/$disk\([0-9]\+\) :.*/md\1/"`; do |
74 |
|
|
if [ "$part" != "$swap" ]; then |
75 |
|
|
# Resize ext2/3 partitions (fix superblock - part 2) |
76 |
gordonr |
1.4 |
echo -n "$part..." >/dev/tty1 |
77 |
slords |
1.2 |
e2fsck -f $part |
78 |
|
|
|
79 |
|
|
# Check for /etc/fstab on partitions and convert entries |
80 |
|
|
mount $part /mnt/tmp |
81 |
|
|
if [ -r /mnt/tmp/etc/fstab ]; then |
82 |
|
|
cat /mnt/tmp/etc/fstab | sed "s/$disk\([0-9]\+\)/md\1/" > /mnt/tmp/etc/fstab.tmp |
83 |
|
|
mv /mnt/tmp/etc/fstab.tmp /mnt/tmp/etc/fstab |
84 |
|
|
fi |
85 |
|
|
umount /mnt/tmp |
86 |
|
|
fi |
87 |
|
|
done |
88 |
gordonr |
1.4 |
echo "done" >/dev/tty1 |
89 |
slords |
1.2 |
rmdir /mnt/tmp |
90 |
|
|
mdadm --stop --scan |
91 |
|
|
fi |
92 |
|
|
fi |