/[smeserver]/cdrom.image/upgrade.cfg
ViewVC logotype

Diff of /cdrom.image/upgrade.cfg

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

Revision 1.1.1.1 by gordonr, Sat Jul 2 06:33:16 2005 UTC Revision 1.13 by slords, Sat Jul 30 07:28:32 2005 UTC
# Line 3  text Line 3  text
3  cdrom  cdrom
4  skipx  skipx
5  mouse  mouse
6    network --device eth0 --bootproto dhcp
7    rootpw --iscrypted $1$iHhL195i$25OY88oyw2bxgU47MvuZf0
8    firewall --disabled
9    selinux --disabled
10    authconfig --enableshadow --enablemd5
11  bootloader --location=mbr  bootloader --location=mbr
12  zerombr yes  zerombr yes
13    
14  %post  %post
15  /sbin/syslogd &  /sbin/syslogd &
16  sleep 1  sleep 2
17  /sbin/e-smith/signal-event post-upgrade  /sbin/e-smith/signal-event post-upgrade
18    
19  kudzu --safe --quiet  # Disable selinux for upgrades
20  /sbin/depmod -a -e -C /dev/null -F /boot/SystemMap-2.4.21-32.0.1.EL 2.4.21-32.0.1.EL  lokkit --quiet --nostart --selinux=disabled
 /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  
21    
22    %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            echo -en "\n\nConverting partitions to RAID..." >/dev/tty1
46            # 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            
56                echo -n "$part..." >/dev/tty1
57                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    
67            echo "done" >/dev/tty1
68    
69            # Write out new converted partition table
70            sfdisk --force /dev/$disk < /tmp/newparts
71    
72            echo -e "\nChecking filesystems on converted partitions. This may take a while." >/dev/tty1
73    
74            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                    echo -e "\n\nChecking $part..." >/dev/tty1
79                    e2fsck -f -C0 $part >/dev/tty1
80    
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


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed