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.10 |
# Disable selinux for upgrades |
20 |
|
|
lokkit --quiet --nostart --selinux=disabled |
21 |
|
|
|
22 |
slords |
1.2 |
%pre |
23 |
|
|
#!/bin/sh |
24 |
|
|
set -x |
25 |
|
|
|
26 |
|
|
# let's assume it's a SCSI system |
27 |
|
|
if grep -q 'sda$' /proc/partitions; then |
28 |
|
|
disk=sda |
29 |
|
|
else |
30 |
|
|
# No SCSI Drives is must be IDE |
31 |
|
|
media=`cat /proc/ide/hda/media` |
32 |
|
|
if [ $media == "disk" ] ; then |
33 |
|
|
disk=hda |
34 |
|
|
fi |
35 |
|
|
fi |
36 |
|
|
|
37 |
|
|
set $disk |
38 |
|
|
found=`echo $#` |
39 |
|
|
if [ $found -gt "0" ] ; then |
40 |
|
|
# Dump out current partitions |
41 |
|
|
sfdisk -d /dev/$disk > /tmp/oldparts |
42 |
|
|
|
43 |
|
|
# Check if we have any ext2/3 or swap partitions |
44 |
|
|
if grep -q 'Id=8[23]' /tmp/oldparts; then |
45 |
slords |
1.11 |
echo -en "\n\nConverting partitions to RAID..." >/dev/tty1 |
46 |
slords |
1.2 |
# Convert ext2/3 and swap partitions to raid autodetect |
47 |
|
|
sed 's/Id=8[32]/Id=fd/' /tmp/oldparts > /tmp/newparts |
48 |
|
|
|
49 |
|
|
# Find swap partition for future checks |
50 |
|
|
swap=`grep 'Id=82' /tmp/oldparts | sed "s/$disk\([0-9]\+\) :.*/md\1/"` |
51 |
|
|
|
52 |
|
|
# Loop throught partitions and convert to degraded raid1 |
53 |
|
|
for part in `grep 'Id=8[23]' /tmp/oldparts | sed 's/ :.*//'`; do |
54 |
|
|
mdpart=`echo $part | sed "s/$disk\([0-9]\+\)/md\1/"` |
55 |
gordonr |
1.3 |
|
56 |
gordonr |
1.4 |
echo -n "$part..." >/dev/tty1 |
57 |
slords |
1.2 |
mdadm --create $mdpart --run --level=1 --raid-devices=2 $part missing |
58 |
|
|
if [ "$mdpart" == "$swap" ]; then |
59 |
|
|
# Recreate swap partition |
60 |
|
|
mkswap $swap |
61 |
|
|
else |
62 |
|
|
# Resize ext2/3 partitions (fix superblock - part 1) |
63 |
|
|
resize2fs -f $mdpart |
64 |
|
|
fi |
65 |
|
|
done |
66 |
gordonr |
1.3 |
|
67 |
gordonr |
1.4 |
echo "done" >/dev/tty1 |
68 |
gordonr |
1.3 |
|
69 |
slords |
1.2 |
# Write out new converted partition table |
70 |
|
|
sfdisk --force /dev/$disk < /tmp/newparts |
71 |
|
|
|
72 |
slords |
1.11 |
echo -e "\nChecking filesystems on converted partitions. This may take a few minutes." >/dev/tty1 |
73 |
gordonr |
1.3 |
|
74 |
slords |
1.2 |
mkdir /mnt/tmp |
75 |
|
|
for part in `grep 'Id=fd' /tmp/newparts | sed "s/$disk\([0-9]\+\) :.*/md\1/"`; do |
76 |
|
|
if [ "$part" != "$swap" ]; then |
77 |
|
|
# Resize ext2/3 partitions (fix superblock - part 2) |
78 |
slords |
1.11 |
echo -e "\n\nChecking $part..." >/dev/tty1 |
79 |
|
|
e2fsck -f -C0 $part >/dev/tty1 |
80 |
slords |
1.2 |
|
81 |
|
|
# Check for /etc/fstab on partitions and convert entries |
82 |
|
|
mount $part /mnt/tmp |
83 |
|
|
if [ -r /mnt/tmp/etc/fstab ]; then |
84 |
|
|
cat /mnt/tmp/etc/fstab | sed "s/$disk\([0-9]\+\)/md\1/" > /mnt/tmp/etc/fstab.tmp |
85 |
|
|
mv /mnt/tmp/etc/fstab.tmp /mnt/tmp/etc/fstab |
86 |
|
|
fi |
87 |
|
|
umount /mnt/tmp |
88 |
|
|
fi |
89 |
|
|
done |
90 |
|
|
rmdir /mnt/tmp |
91 |
|
|
mdadm --stop --scan |
92 |
|
|
fi |
93 |
|
|
fi |