1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
|
#!/bin/sh
# file: /usr/share/doc/bootcd/examples/bootcdmk2diskconf.tst2
# copyright: Bernd Schumacher <bernd.schumacher@hpe.com> (2001-2020)
# license: GNU General Public License, version 3
# description: bootcdmk2diskconf.tst2 - functions to test bootcdmk2diskconf
VERBOSE="" # VERBOSE="" means silent; VERBOSE="1" means verbose
if [ "$1" = "-v" ];then
VERBOSE="1"
shift
fi
if [ $# -ge 1 ]; then
echo "Usage $(basename $0) [-v]" >&2
exit 1
fi
EXPECTED="$(mktemp --suffix=.bootcd.expected)"
RESULT="$(mktemp --suffix=.bootcd.result)"
[ ! "$VERBOSE" ] || echo "EXPECTED=<$EXPECTED> RESULT=<$RESULT>"
############################
### 1. define Test Input ###
############################
export RIFSTAB="# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
/dev/hdc /media/cdrom auto pamconsole,fscontext=syste
m_u:object_r:removable_t,exec,noauto,managed 0 0
/dev/fd0 /media/floppy auto pamconsole,fscontext=syste
m_u:object_r:removable_t,exec,noauto,managed 0 0"
export RIGRUB="# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux AS (2.6.9-42.ELsmp)
root (hd0,0)
kernel /vmlinuz-2.6.9-42.ELsmp ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.9-42.ELsmp.img
title Red Hat Enterprise Linux AS-up (2.6.9-42.EL)
root (hd0,0)
kernel /vmlinuz-2.6.9-42.EL ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.9-42.EL.img"
export RIGRUB2=""
export RILV="LogVol00:VolGroup00:19328
LogVol01:VolGroup00:992"
export RIPV="/dev/sda2:VolGroup00"
export RIDF="/dev/mapper/VolGroup00-LogVol00:19025
/dev/sda1:99"
export RILABEL="/dev/sda1:/boot"
export RIUUID=""
export RIPARTITION="/dev/sda:20480
/dev/sda1:101
/dev/sda2:20371
/dev/sdb:20480
/dev/sdc:20480
/dev/dm-0:19328
/dev/dm-1:992"
export RIMD=""
#################################
### 2. define expected Output ###
#################################
cat <<'END' >$EXPECTED
ORIG_DISK0="/dev/sda"
DISK0="auto"
LVMGRP="VolGroup00 DISK0P2"
LVMVOL="LogVol00 19328 VolGroup00
LogVol01 992 VolGroup00"
ALLOWEDDISKS=""
SFDISK0=",101
;"
VFAT=""
EXT2FS=""
EXT3FS="/dev/VolGroup00/LogVol00
DISK0P1"
EXT4FS=""
XFS=""
SWAP="/dev/VolGroup00/LogVol01"
bootcd_mount()
{
bootcd_global DISK0P1
mkdir -p $1; mount /dev/VolGroup00/LogVol00 $1
mkdir -p $1/boot; mount $DISK0P1 $1/boot
}
bootcd_umount()
{
umount $1/boot
umount $1
}
FSTAB="# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
/dev/hdc /media/cdrom auto pamconsole,fscontext=syste
m_u:object_r:removable_t,exec,noauto,managed 0 0
/dev/fd0 /media/floppy auto pamconsole,fscontext=syste
m_u:object_r:removable_t,exec,noauto,managed 0 0"
ORIG_GRUB2=""
GRUB="# grub.conf generated by anaconda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux AS (2.6.9-42.ELsmp)
root (hd0,0)
kernel /vmlinuz-2.6.9-42.ELsmp ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.9-42.ELsmp.img
title Red Hat Enterprise Linux AS-up (2.6.9-42.EL)
root (hd0,0)
kernel /vmlinuz-2.6.9-42.EL ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.9-42.EL.img"
GRUBDEVICEMAP="auto"
SSHHOSTKEY="no"
UDEV_FIXNET="no"
PARTITIONLABEL="DISK0P1:/boot"
END
################################
### 3. Run bootcdmk2diskconf ###
################################
ia_logfile=/dev/null ./bootcdmk2diskconf --testdata | grep -v "^#" |
grep -v "^libfakeroot internal error: payload not recognized!$" > $RESULT
[ "$VERBOSE" ] && cat "$RESULT"
########################
### 4. Check Results ###
########################
DIFF="$(diff $EXPECTED $RESULT)"
if [ "$DIFF" ]; then
echo "==== ERROR $(basename $0): diff $EXPECTED $RESULT ===="
echo "$DIFF"
fi
#rm $EXPECTED $RESULT
|