Christopher Edward Lumens 7c8918
diff -ruN anaconda-11.5.0.42.orig/bootdisk/i386/grub.conf anaconda-11.5.0.42/bootdisk/i386/grub.conf
Christopher Edward Lumens 7c8918
--- anaconda-11.5.0.42.orig/bootdisk/i386/grub.conf	2009-04-09 16:53:01.000000000 -0400
Christopher Edward Lumens 7c8918
+++ anaconda-11.5.0.42/bootdisk/i386/grub.conf	2009-04-09 17:00:45.000000000 -0400
Peter Jones 3dd6e4
@@ -1,8 +1,8 @@
Peter Jones 3dd6e4
 #debug --graphics
Peter Jones 3dd6e4
 default=0
Peter Jones 3dd6e4
-splashimage=/EFI/boot/splash.xpm.gz
Peter Jones 3dd6e4
+splashimage=@SPLASHPATH@
Peter Jones 3dd6e4
 timeout 5
Peter Jones 3dd6e4
 hiddenmenu
Peter Jones 3dd6e4
 title @PRODUCT@ @VERSION@
Peter Jones 3dd6e4
-	kernel /EFI/boot/vmlinuz
Peter Jones 3dd6e4
-	initrd /EFI/boot/initrd.img
Peter Jones 3dd6e4
+	kernel @KERNELPATH@
Peter Jones 3dd6e4
+	initrd @INITRDPATH@
Christopher Edward Lumens 7c8918
diff -ruN anaconda-11.5.0.42.orig/bootdisk/x86_64/grub.conf anaconda-11.5.0.42/bootdisk/x86_64/grub.conf
Christopher Edward Lumens 7c8918
--- anaconda-11.5.0.42.orig/bootdisk/x86_64/grub.conf	2009-04-09 16:53:01.000000000 -0400
Christopher Edward Lumens 7c8918
+++ anaconda-11.5.0.42/bootdisk/x86_64/grub.conf	2009-04-09 17:00:45.000000000 -0400
Peter Jones 3dd6e4
@@ -1,8 +1,8 @@
Peter Jones 3dd6e4
 #debug --graphics
Peter Jones 3dd6e4
 default=0
Peter Jones 3dd6e4
-splashimage=/EFI/boot/splash.xpm.gz
Peter Jones 3dd6e4
+splashimage=@SPLASHPATH@
Peter Jones 3dd6e4
 timeout 5
Peter Jones 3dd6e4
 hiddenmenu
Peter Jones 3dd6e4
 title @PRODUCT@ @VERSION@
Peter Jones 3dd6e4
-	kernel /EFI/boot/vmlinuz
Peter Jones 3dd6e4
-	initrd /EFI/boot/initrd.img
Peter Jones 3dd6e4
+	kernel @KERNELPATH@
Peter Jones 3dd6e4
+	initrd @INITRDPATH@
Christopher Edward Lumens 7c8918
diff -ruN anaconda-11.5.0.42.orig/scripts/buildinstall anaconda-11.5.0.42/scripts/buildinstall
Christopher Edward Lumens 7c8918
--- anaconda-11.5.0.42.orig/scripts/buildinstall	2009-04-09 16:53:01.000000000 -0400
Christopher Edward Lumens 7c8918
+++ anaconda-11.5.0.42/scripts/buildinstall	2009-04-09 17:00:45.000000000 -0400
Christopher Edward Lumens 7c8918
@@ -219,8 +219,9 @@
Peter Jones 3dd6e4
 $MK_TREEINFO --family="$PRODUCTSTR" ${VARIANT:+--variant="$VARIANT"} --version=$VERSION --arch=$BASEARCH --outfile=$OUTPUT/.treeinfo
Peter Jones 3dd6e4
 
Peter Jones 3dd6e4
 # FIXME: need to update mk-images to take the yumconf
Peter Jones 3dd6e4
-echo "Making images..."
Peter Jones 3dd6e4
-$MK_IMAGES $DEBUGSTR $NOGRSTR --imgdir $TREEDIR/install --arch $BASEARCH --product "$PRODUCTSTR" --version $VERSION --bugurl "$BUGURL" --output $OUTPUT $yumconf || die "image creation failed"
Peter Jones 3dd6e4
+MKIMGCMD="$MK_IMAGES $DEBUGSTR $NOGRSTR --imgdir $TREEDIR/install --arch $BASEARCH --product "$PRODUCTSTR" --version $VERSION --bugurl "$BUGURL" --output $OUTPUT $yumconf"
Peter Jones 3dd6e4
+echo "Making images: $PWD\$ $MKIMGCMD"
Peter Jones 3dd6e4
+$MKIMGCMD || die "image creation failed"
Peter Jones 3dd6e4
 
Peter Jones 3dd6e4
 echo "Writing .discinfo file"
David Cantrell 39fe2c
 $MK_STAMP --releasestr="$RELEASESTR" --arch=$BASEARCH --discNum="ALL"  --outfile=$OUTPUT/.discinfo
Christopher Edward Lumens 7c8918
diff -ruN anaconda-11.5.0.42.orig/scripts/mk-images anaconda-11.5.0.42/scripts/mk-images
Christopher Edward Lumens 7c8918
--- anaconda-11.5.0.42.orig/scripts/mk-images	2009-04-09 16:53:01.000000000 -0400
Christopher Edward Lumens 7c8918
+++ anaconda-11.5.0.42/scripts/mk-images	2009-04-09 17:00:45.000000000 -0400
Christopher Edward Lumens 7c8918
@@ -889,6 +889,7 @@
Christopher Edward Lumens 7c8918
 # this gets overloaded if we're on an EFI-capable arch (... with grub)
Christopher Edward Lumens 7c8918
 makeEfiImages()
Christopher Edward Lumens 7c8918
 {
Christopher Edward Lumens 7c8918
+    echo "Not on an EFI capable machine; skipping EFI images."
Christopher Edward Lumens 7c8918
     /bin/true
Christopher Edward Lumens 7c8918
 }
Christopher Edward Lumens 7c8918
 
Christopher Edward Lumens 7c8918
diff -ruN anaconda-11.5.0.42.orig/scripts/mk-images.efi anaconda-11.5.0.42/scripts/mk-images.efi
Christopher Edward Lumens 7c8918
--- anaconda-11.5.0.42.orig/scripts/mk-images.efi	2009-04-09 16:53:01.000000000 -0400
Christopher Edward Lumens 7c8918
+++ anaconda-11.5.0.42/scripts/mk-images.efi	2009-04-09 17:00:45.000000000 -0400
Christopher Edward Lumens 7c8918
@@ -45,6 +45,7 @@
Peter Jones 3dd6e4
 
Peter Jones 3dd6e4
 #makeefibootimage required for EFI bootloader dosfs image
Peter Jones 3dd6e4
 makeefibootimage() {
Peter Jones 3dd6e4
+    echo "in makeefibootimage: makeefibootimage $@"
Peter Jones 3dd6e4
     MBD_FILENAME=""
Peter Jones 3dd6e4
     KERNELFILE=""
Peter Jones 3dd6e4
     INITRDFILE=""
Christopher Edward Lumens 7c8918
@@ -57,20 +58,29 @@
Peter Jones 3dd6e4
             KERNELFILE=$2
Peter Jones 3dd6e4
             shift; shift
Peter Jones 3dd6e4
             continue
Peter Jones 3dd6e4
+        elif [ $1 = "--kernelpath" ]; then
Peter Jones 3dd6e4
+            KERNELPATH=$2
Peter Jones 3dd6e4
+            shift; shift
Peter Jones 3dd6e4
+            continue
Peter Jones 3dd6e4
         elif [ $1 = "--initrd" ]; then
Peter Jones 3dd6e4
             INITRDFILE=$2
Peter Jones 3dd6e4
             shift; shift
Peter Jones 3dd6e4
             continue
Peter Jones 3dd6e4
+        elif [ $1 = "--initrdpath" ]; then
Peter Jones 3dd6e4
+            INITRDPATH=$2
Peter Jones 3dd6e4
+            shift; shift
Peter Jones 3dd6e4
+            continue
Peter Jones 3dd6e4
         elif [ $1 = "--imagename" ]; then
Peter Jones 3dd6e4
             MBD_FILENAME=$IMAGEPATH/$2
Peter Jones 3dd6e4
             shift; shift
Peter Jones 3dd6e4
             continue
Peter Jones 3dd6e4
         elif [ $1 = "--grubpkg" ]; then
Peter Jones 3dd6e4
             grubpkg=$2
Peter Jones 3dd6e4
+            echo "grubpkg=$grubpkg"
Peter Jones 3dd6e4
             shift; shift
Peter Jones 3dd6e4
             continue
Peter Jones 3dd6e4
         fi
Peter Jones 3dd6e4
-        echo "Unknown option passed to makebootdisk"
Peter Jones 3dd6e4
+        echo "Unknown option passed to makebootdisk: \"$1\""
Peter Jones 3dd6e4
         exit 1
Peter Jones 3dd6e4
     done
Peter Jones 3dd6e4
 
Christopher Edward Lumens 7c8918
@@ -111,6 +121,7 @@
Peter Jones 3dd6e4
 
Peter Jones 3dd6e4
 # prepare and build an efiboot.img.
Peter Jones 3dd6e4
 prepareEfiImage() {
Peter Jones 3dd6e4
+    echo "in prepareEfiImage"
Peter Jones 3dd6e4
     prepareEfiTree || return 1
Peter Jones 3dd6e4
 
Peter Jones 3dd6e4
     # dynamically calculate the size of the dosfs
Christopher Edward Lumens 7c8918
@@ -125,47 +136,65 @@
Peter Jones 3dd6e4
 # prepare a directory with the kernel, initrd, and various message files
Peter Jones 3dd6e4
 # used to populate the efi boot image
Peter Jones 3dd6e4
 prepareEfiTree() {
Peter Jones 3dd6e4
-    mkdir -p $MBD_BOOTTREE_TMP/EFI/boot
David Cantrell 39fe2c
+    echo "in prepareEfiTree"
David Cantrell 39fe2c
+    mkdir -p $MBD_BOOTTREE_TMP/EFI/BOOT
David Cantrell 39fe2c
 
Peter Jones 3dd6e4
-    cp -a $BOOTDISKDIR/* $MBD_BOOTTREE_TMP/EFI/boot/
Peter Jones 3dd6e4
-    [ -n "$INITRDFILE" ] && cp $INITRDFILE $MBD_BOOTTREE_TMP/EFI/boot/initrd.img
Peter Jones 3dd6e4
-    [ -n "$KERNELFILE" ] && cp $KERNELFILE $MBD_BOOTTREE_TMP/EFI/boot/vmlinuz
Peter Jones 3dd6e4
-
Peter Jones 3dd6e4
-    sed -i "s/@PRODUCT@/$PRODUCT/g" $MBD_BOOTTREE_TMP/EFI/boot/grub.conf
Peter Jones 3dd6e4
-    sed -i "s/@VERSION@/$VERSION/g" $MBD_BOOTTREE_TMP/EFI/boot/grub.conf
Peter Jones 3dd6e4
-
Peter Jones 3dd6e4
-    yumdownloader -c $yumconf $grubpkg
Peter Jones 3dd6e4
+    cp -av $BOOTDISKDIR/*.conf $MBD_BOOTTREE_TMP/EFI/BOOT/
Peter Jones 3dd6e4
+    [ -n "$KERNELFILE" ] && cp -av $KERNELFILE $MBD_BOOTTREE_TMP/EFI/BOOT/vmlinuz
Peter Jones 3dd6e4
+    [ -n "$INITRDFILE" ] && cp -av $INITRDFILE $MBD_BOOTTREE_TMP/EFI/BOOT/initrd.img
Peter Jones 3dd6e4
+    [ -z "$KERNELPATH" ] && KERNELPATH="/EFI/BOOT/vmlinuz"
Peter Jones 3dd6e4
+    [ -z "$INITRDPATH" ] && INITRDPATH="/EFI/BOOT/initrd.img"
Peter Jones 3dd6e4
+
Peter Jones 3dd6e4
+    SPLASHPATH="/EFI/BOOT/splash.xpm.gz"
Peter Jones 3dd6e4
+    sed -e "s/@PRODUCT@/$PRODUCT/g" \
Peter Jones 3dd6e4
+        -e "s/@VERSION@/$VERSION/g" \
Peter Jones 3dd6e4
+        -e "s,@KERNELPATH@,$KERNELPATH,g" \
Peter Jones 3dd6e4
+        -e "s,@INITRDPATH@,$INITRDPATH,g" \
Peter Jones 3dd6e4
+        -e "s,@SPLASHPATH@,$SPLASHPATH,g" \
Peter Jones 3dd6e4
+        -i $MBD_BOOTTREE_TMP/EFI/BOOT/grub.conf
Peter Jones 3dd6e4
+
Peter Jones 3dd6e4
+    ydcmd="yumdownloader -c $yumconf $grubpkg"
Peter Jones 3dd6e4
+    echo "(grubpkg) $ydcmd"
Peter Jones 3dd6e4
+    $ydcmd
Peter Jones 3dd6e4
     rpm2cpio $grubpkg.rpm | (cd $KERNELROOT; cpio --quiet -iumd)
Peter Jones 3dd6e4
-    cp $KERNELROOT/boot/efi/EFI/redhat/grub.efi $MBD_BOOTTREE_TMP/EFI/boot/grub.efi
Peter Jones 3dd6e4
+    cp -av $KERNELROOT/boot/efi/EFI/redhat/grub.efi $MBD_BOOTTREE_TMP/EFI/BOOT/grub.efi
Peter Jones 3dd6e4
 
Peter Jones 3dd6e4
     # The first generation Mactel machines get the bootloader name wrong
Peter Jones 3dd6e4
     # as per the spec.  Awesome, guys.
Peter Jones 3dd6e4
     if [ "$efiarch" == "ia32" ]; then
Peter Jones 3dd6e4
-        cp $MBD_BOOTTREE_TMP/EFI/boot/grub.efi $MBD_BOOTTREE_TMP/EFI/boot/boot.efi
Peter Jones 3dd6e4
-        cp $MBD_BOOTTREE_TMP/EFI/boot/grub.conf $MBD_BOOTTREE_TMP/EFI/boot/boot.conf
Peter Jones 3dd6e4
+        cp -av $MBD_BOOTTREE_TMP/EFI/BOOT/grub.efi $MBD_BOOTTREE_TMP/EFI/BOOT/BOOT.efi
Peter Jones 3dd6e4
+        cp -av $MBD_BOOTTREE_TMP/EFI/BOOT/grub.conf $MBD_BOOTTREE_TMP/EFI/BOOT/BOOT.conf
Peter Jones 3dd6e4
     fi
Peter Jones 3dd6e4
 
Peter Jones 3dd6e4
-    mv $MBD_BOOTTREE_TMP/EFI/boot/grub.efi $MBD_BOOTTREE_TMP/EFI/boot/boot${efiarch}.efi
Peter Jones 3dd6e4
-    mv $MBD_BOOTTREE_TMP/EFI/boot/grub.conf $MBD_BOOTTREE_TMP/EFI/boot/boot${efiarch}.conf
Peter Jones 3dd6e4
+    local tmpefiarch=${efiarch}
Peter Jones 3dd6e4
+    case ${efiarch} in
Peter Jones 3dd6e4
+        x64) tmpefiarch="X64" ;;
Peter Jones 3dd6e4
+        ia32) tmpefiarch="IA32" ;;
Peter Jones 3dd6e4
+    esac
Peter Jones 3dd6e4
+    mv -v $MBD_BOOTTREE_TMP/EFI/BOOT/grub.efi $MBD_BOOTTREE_TMP/EFI/BOOT/BOOT${tmpefiarch}.efi
Peter Jones 3dd6e4
+    mv -v $MBD_BOOTTREE_TMP/EFI/BOOT/grub.conf $MBD_BOOTTREE_TMP/EFI/BOOT/BOOT${tmpefiarch}.conf
Peter Jones 3dd6e4
 
Peter Jones 3dd6e4
     artpkg=$(repoquery --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}" --whatprovides ${brandpkgname}-logos | grep -v generic-logos | head -1)
Peter Jones 3dd6e4
     if [ -z "$artpkg" ]; then
Peter Jones 3dd6e4
        argpkg="generic-logos"
Peter Jones 3dd6e4
     fi
Peter Jones 3dd6e4
 
Peter Jones 3dd6e4
-    yumdownloader -c ${yumconf} ${artpkg}
Peter Jones 3dd6e4
+    ydcmd="yumdownloader -c ${yumconf} ${artpkg}"
Peter Jones 3dd6e4
+    echo "(artpkg) $ydcmd"
Peter Jones 3dd6e4
+    $ydcmd
Peter Jones 3dd6e4
     rpm2cpio ${artpkg}.rpm | (cd $KERNELROOT; cpio --quiet -iumd)
Peter Jones 3dd6e4
-    cp $KERNELROOT/boot/grub/splash.xpm.gz $MBD_BOOTTREE_TMP/EFI/boot/splash.xpm.gz
Peter Jones 3dd6e4
+    cp -av $KERNELROOT/boot/grub/splash.xpm.gz $MBD_BOOTTREE_TMP/$SPLASHPATH
Peter Jones 3dd6e4
 
Peter Jones 3dd6e4
     # if we don't have a kernel or initrd, we're making a CD image and we need
Peter Jones 3dd6e4
     # to mirror EFI/ to the cd.
Peter Jones 3dd6e4
     if [ -z "$KERNELFILE" -a -z "$INITRDFILE" ]; then
Peter Jones 3dd6e4
         cp -av $MBD_BOOTTREE_TMP/EFI/ $TOPDESTPATH/EFI/
Peter Jones 3dd6e4
-        rm -f $TOPDESTPATH/EFI/boot/*.efi
Peter Jones 3dd6e4
+        rm -f $TOPDESTPATH/EFI/BOOT/*.efi
Peter Jones 3dd6e4
     fi
Peter Jones 3dd6e4
 }
Peter Jones 3dd6e4
 
Peter Jones 3dd6e4
 makeEfiImages() {
Peter Jones 3dd6e4
+    echo "in makeEfiImages"
Peter Jones 3dd6e4
     yumconf="$1"
Peter Jones 3dd6e4
     echo "Making EFI images ($PWD)"
Peter Jones 3dd6e4
     if [ "$kernelvers" != "$kernelxen" ]; then
Christopher Edward Lumens 7c8918
@@ -182,9 +211,10 @@
Peter Jones 3dd6e4
             return 1
Peter Jones 3dd6e4
         fi
Peter Jones 3dd6e4
         echo "Building efiboot.img for ${efiarch}/$KERNELARCH at $TOPDESTPATH/images/efiboot.img"
Peter Jones 3dd6e4
+	echo "grubpkg: ${grubpkg}"
Peter Jones 3dd6e4
 
Peter Jones 3dd6e4
         makeefibootimage \
Peter Jones 3dd6e4
-            --imagename pxeboot/efiboot.img \
Peter Jones 3dd6e4
+            --imagename efiboot.img \
Peter Jones 3dd6e4
             --kernel $TOPDESTPATH/images/pxeboot/vmlinuz \
Peter Jones 3dd6e4
             --initrd $TOPDESTPATH/images/pxeboot/initrd.img \
Peter Jones 3dd6e4
             --grubpkg ${grubpkg}
Christopher Edward Lumens 7c8918
@@ -194,13 +224,16 @@
Peter Jones 3dd6e4
             return $ret
Peter Jones 3dd6e4
         fi
Peter Jones 3dd6e4
 
Peter Jones 3dd6e4
-        makeefibootdisk $TOPDESTPATH/images/pxeboot/efiboot.img $TOPDESTPATH/images/efidisk.img
Peter Jones 3dd6e4
-        [ $ret -eq 0 ] || return $ret
Peter Jones 3dd6e4
+        makeefibootdisk $TOPDESTPATH/images/efiboot.img $TOPDESTPATH/images/efidisk.img
Peter Jones 3dd6e4
         local ret=$?
Peter Jones 3dd6e4
+        [ $ret -eq 0 ] || return $ret
Peter Jones 3dd6e4
+        rm -vf $TOPDESTPATH/images/efiboot.img
Peter Jones 3dd6e4
 
Peter Jones 3dd6e4
         # make a boot image with just boot*.efi in it...
Peter Jones 3dd6e4
         makeefibootimage \
Peter Jones 3dd6e4
-            --imagename pxeboot/efiboot.img \
Peter Jones 3dd6e4
+            --imagename efiboot.img \
Peter Jones 3dd6e4
+            --kernelpath /images/pxeboot/vmlinuz \
Peter Jones 3dd6e4
+            --initrdpath /images/pxeboot/initrd.img \
Peter Jones 3dd6e4
             --grubpkg ${grubpkg}
Peter Jones 3dd6e4
         local ret=$?
Peter Jones 3dd6e4
         if [ $ret -ne 0 ]; then
Christopher Edward Lumens 7c8918
diff -ruN anaconda-11.5.0.42.orig/scripts/mk-images.orig anaconda-11.5.0.42/scripts/mk-images.orig
Christopher Edward Lumens 7c8918
--- anaconda-11.5.0.42.orig/scripts/mk-images.orig	1969-12-31 19:00:00.000000000 -0500
Christopher Edward Lumens 7c8918
+++ anaconda-11.5.0.42/scripts/mk-images.orig	2009-04-09 16:53:01.000000000 -0400
Christopher Edward Lumens 7c8918
@@ -0,0 +1,1003 @@
Christopher Edward Lumens 7c8918
+#!/bin/bash
Christopher Edward Lumens 7c8918
+#
Christopher Edward Lumens 7c8918
+# mk-images
Christopher Edward Lumens 7c8918
+#
Christopher Edward Lumens 7c8918
+# Copyright (C) 2007  Red Hat, Inc.  All rights reserved.
Christopher Edward Lumens 7c8918
+#
Christopher Edward Lumens 7c8918
+# This program is free software; you can redistribute it and/or modify
Christopher Edward Lumens 7c8918
+# it under the terms of the GNU General Public License as published by
Christopher Edward Lumens 7c8918
+# the Free Software Foundation; either version 2 of the License, or
Christopher Edward Lumens 7c8918
+# (at your option) any later version.
Christopher Edward Lumens 7c8918
+#
Christopher Edward Lumens 7c8918
+# This program is distributed in the hope that it will be useful,
Christopher Edward Lumens 7c8918
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
Christopher Edward Lumens 7c8918
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Christopher Edward Lumens 7c8918
+# GNU General Public License for more details.
Christopher Edward Lumens 7c8918
+#
Christopher Edward Lumens 7c8918
+# You should have received a copy of the GNU General Public License
Christopher Edward Lumens 7c8918
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Christopher Edward Lumens 7c8918
+#
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+LANG=C
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+PATH=$PATH:/sbin:/usr/sbin
Christopher Edward Lumens 7c8918
+IMAGEUUID=$(date +%Y%m%d%H%M).$(uname -i)
Christopher Edward Lumens 7c8918
+TMPDIR=${TMPDIR:-/tmp}
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+usage () {
Christopher Edward Lumens 7c8918
+    echo "usage: mk-images <pkgsrc> <toplevel> <template> <imgdir> <buildarch> <productname> <version> [<productpath>]"
Christopher Edward Lumens 7c8918
+    exit 0
Christopher Edward Lumens 7c8918
+}
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+DEBUG=""
Christopher Edward Lumens 7c8918
+BUILDARCH=`uname -m`
Christopher Edward Lumens 7c8918
+BOOTISO="boot.iso"
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+while [ $# -gt 0 ]; do
Christopher Edward Lumens 7c8918
+    case $1 in
Christopher Edward Lumens 7c8918
+        --debug)
Christopher Edward Lumens 7c8918
+            DEBUG="--debug"
Christopher Edward Lumens 7c8918
+            shift
Christopher Edward Lumens 7c8918
+        ;;
Christopher Edward Lumens 7c8918
+        --noiso)
Christopher Edward Lumens 7c8918
+            BOOTISO=""
Christopher Edward Lumens 7c8918
+            shift
Christopher Edward Lumens 7c8918
+        ;;
Christopher Edward Lumens 7c8918
+        --arch)
Christopher Edward Lumens 7c8918
+            BUILDARCH=$2
Christopher Edward Lumens 7c8918
+            shift; shift
Christopher Edward Lumens 7c8918
+        ;;
Christopher Edward Lumens 7c8918
+        --imgdir)
Christopher Edward Lumens 7c8918
+            IMGPATH=$2
Christopher Edward Lumens 7c8918
+            shift; shift
Christopher Edward Lumens 7c8918
+        ;;
Christopher Edward Lumens 7c8918
+        --product)
Christopher Edward Lumens 7c8918
+            PRODUCT=$2
Christopher Edward Lumens 7c8918
+            shift; shift
Christopher Edward Lumens 7c8918
+        ;;
Christopher Edward Lumens 7c8918
+        --version)
Christopher Edward Lumens 7c8918
+            VERSION=$2
Christopher Edward Lumens 7c8918
+            shift; shift
Christopher Edward Lumens 7c8918
+        ;;
Christopher Edward Lumens 7c8918
+        --bugurl)
Christopher Edward Lumens 7c8918
+            BUGURL=$2
Christopher Edward Lumens 7c8918
+            shift; shift
Christopher Edward Lumens 7c8918
+        ;;
Christopher Edward Lumens 7c8918
+        --output)
Christopher Edward Lumens 7c8918
+            TOPDESTPATH=$2
Christopher Edward Lumens 7c8918
+            shift; shift
Christopher Edward Lumens 7c8918
+        ;;
Christopher Edward Lumens 7c8918
+        --nogr)
Christopher Edward Lumens 7c8918
+            echo "*** DeprecationWarning: ignoring --nogr option." >&2
Christopher Edward Lumens 7c8918
+            shift
Christopher Edward Lumens 7c8918
+        ;;
Christopher Edward Lumens 7c8918
+        --mindir)
Christopher Edward Lumens 7c8918
+            echo "*** DeprecationWarning: ignoring --mindir option." >&2
Christopher Edward Lumens 7c8918
+            shift; shift
Christopher Edward Lumens 7c8918
+        ;;
Christopher Edward Lumens 7c8918
+        --stg2dir)
Christopher Edward Lumens 7c8918
+            echo "*** DeprecationWarning: please use --imgdir instead of --stg2dir." >&2
Christopher Edward Lumens 7c8918
+            shift; shift
Christopher Edward Lumens 7c8918
+        ;;
Christopher Edward Lumens 7c8918
+        *)
Christopher Edward Lumens 7c8918
+            yumconf=$1
Christopher Edward Lumens 7c8918
+            shift
Christopher Edward Lumens 7c8918
+        ;;
Christopher Edward Lumens 7c8918
+    esac
Christopher Edward Lumens 7c8918
+done
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+if [ -z "$TOPDESTPATH" -o -z "$IMGPATH" -o -z "$PRODUCT" -o -z "$VERSION" ]; then usage; fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+TOPDIR=$(echo $0 | sed "s,/[^/]*$,,")
Christopher Edward Lumens 7c8918
+if [ $TOPDIR = $0 ]; then
Christopher Edward Lumens 7c8918
+    $TOPDIR="."
Christopher Edward Lumens 7c8918
+fi
Christopher Edward Lumens 7c8918
+TOPDIR=$(cd $TOPDIR; pwd)
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+# modules that are needed.  this is the generic "needed for every arch" stuff
Christopher Edward Lumens 7c8918
+COMMONMODS="fat vfat nfs sunrpc lockd floppy cramfs loop edd pcspkr squashfs ipv6 virtio_pci"
Christopher Edward Lumens 7c8918
+USBMODS="ohci-hcd uhci-hcd ehci-hcd usbhid mousedev usb-storage sd_mod sr_mod ub appletouch"
Christopher Edward Lumens 7c8918
+FIREWIREMODS="ohci1394 sbp2 fw-ohci fw-sbp2 firewire-sbp2 firewire-ohci"
Christopher Edward Lumens 7c8918
+SDMODS="mmc-block sdhci sdhci-pci"
Christopher Edward Lumens 7c8918
+IDEMODS="ide-cd ide-cd_mod"
Christopher Edward Lumens 7c8918
+SCSIMODS="sr_mod sg st sd_mod scsi_mod iscsi_tcp iscsi_ibft"
Christopher Edward Lumens 7c8918
+FSMODS="fat msdos vfat ext2 ext3 ext4 reiserfs jfs xfs gfs2 cifs fuse btrfs"
Christopher Edward Lumens 7c8918
+LVMMODS="dm-mod dm-zero dm-snapshot dm-mirror dm-multipath dm-round-robin dm-crypt"
Christopher Edward Lumens 7c8918
+RAIDMODS="raid0 raid1 raid5 raid6 raid456 raid10 linear"
Christopher Edward Lumens 7c8918
+CRYPTOMODS="sha256_generic cbc xts lrw aes_generic crypto_blkcipher crc32c ecb arc4"
Christopher Edward Lumens 7c8918
+PCMCIASOCKMODS="yenta_socket i82365 tcic pcmcia"
Christopher Edward Lumens 7c8918
+INITRDMODS="$USBMODS $FIREWIREMODS $IDEMODS $SCSIMODS $FSMODS $LVMMODS $RAIDMODS $CRYPTOMODS $COMMONMODS $PCMCIASOCKMODS $SDMODS =scsi =net =drm"
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+. $(dirname $0)/buildinstall.functions
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+# Set, verify, and create paths
Christopher Edward Lumens 7c8918
+IMAGEPATH=$TOPDESTPATH/images
Christopher Edward Lumens 7c8918
+FULLMODPATH=$TMPDIR/instimagemods.$$
Christopher Edward Lumens 7c8918
+FINALFULLMODPATH=$IMGPATH/modules
Christopher Edward Lumens 7c8918
+INSTIMGPATH=$TOPDESTPATH/images
Christopher Edward Lumens 7c8918
+KERNELBASE=$TMPDIR/updboot.kernel.$$
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+KERNELNAME=vmlinuz
Christopher Edward Lumens 7c8918
+if [ "$BUILDARCH" = "ia64" ]; then
Christopher Edward Lumens 7c8918
+    KERNELDIR="/boot/efi/EFI/redhat"
Christopher Edward Lumens 7c8918
+else
Christopher Edward Lumens 7c8918
+    KERNELDIR="/boot"
Christopher Edward Lumens 7c8918
+fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+if [ "$BUILDARCH" = "sparc64" ]; then
Christopher Edward Lumens 7c8918
+    BASEARCH=sparc
Christopher Edward Lumens 7c8918
+else
Christopher Edward Lumens 7c8918
+    BASEARCH=$BUILDARCH
Christopher Edward Lumens 7c8918
+fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+# explicit block size setting for some arches (FIXME: we compose
Christopher Edward Lumens 7c8918
+# ppc64-ish trees as ppc, so we have to set the "wrong" block size)
Christopher Edward Lumens 7c8918
+if [ "$BUILDARCH" = "sparc64" ]; then
Christopher Edward Lumens 7c8918
+    CRAMBS="--blocksize 8192"
Christopher Edward Lumens 7c8918
+elif [ "$BUILDARCH" = "sparc" ]; then
Christopher Edward Lumens 7c8918
+    CRAMBS="--blocksize 4096"
Christopher Edward Lumens 7c8918
+else
Christopher Edward Lumens 7c8918
+    CRAMBS=""
Christopher Edward Lumens 7c8918
+fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+if [ $BUILDARCH = x86_64 -o $BUILDARCH = s390x ]; then
Christopher Edward Lumens 7c8918
+    LIBDIR=lib64
Christopher Edward Lumens 7c8918
+else
Christopher Edward Lumens 7c8918
+    LIBDIR=lib
Christopher Edward Lumens 7c8918
+fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+rm -rf $IMAGEPATH
Christopher Edward Lumens 7c8918
+rm -rf $FULLMODPATH
Christopher Edward Lumens 7c8918
+rm -rf $FINALFULLMODPATH
Christopher Edward Lumens 7c8918
+rm -rf $KERNELBASE
Christopher Edward Lumens 7c8918
+mkdir -p $IMAGEPATH
Christopher Edward Lumens 7c8918
+mkdir -p $FULLMODPATH
Christopher Edward Lumens 7c8918
+mkdir -p $FINALFULLMODPATH
Christopher Edward Lumens 7c8918
+mkdir -p $KERNELBASE
Christopher Edward Lumens 7c8918
+mkdir -p $INSTIMGPATH
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+# Stuff that we need
Christopher Edward Lumens 7c8918
+TRIMPCIIDS=$IMGPATH/usr/lib/anaconda-runtime/trimpciids
Christopher Edward Lumens 7c8918
+GETKEYMAPS=$IMGPATH/usr/lib/anaconda-runtime/getkeymaps
Christopher Edward Lumens 7c8918
+GENINITRDSZ=$IMGPATH/usr/lib/anaconda-runtime/geninitrdsz
Christopher Edward Lumens 7c8918
+MKS390CDBOOT=$IMGPATH/usr/lib/anaconda-runtime/mk-s390-cdboot
Christopher Edward Lumens 7c8918
+GENMODINFO=$IMGPATH/usr/lib/anaconda-runtime/genmodinfo
Christopher Edward Lumens 7c8918
+KEYMAPS=$TMPDIR/keymaps-$BUILDARCH.$$
Christopher Edward Lumens 7c8918
+SCREENFONT=$IMGPATH/usr/lib/anaconda-runtime/screenfont-${BASEARCH}.gz
Christopher Edward Lumens 7c8918
+MODLIST=$IMGPATH/usr/lib/anaconda-runtime/modlist
Christopher Edward Lumens 7c8918
+MODINFO=$TMPDIR/modinfo-$BUILDARCH.$$
Christopher Edward Lumens 7c8918
+LOADERBINDIR=$IMGPATH/usr/lib/anaconda-runtime/loader
Christopher Edward Lumens 7c8918
+BOOTDISKDIR=$IMGPATH/usr/lib/anaconda-runtime/boot
Christopher Edward Lumens 7c8918
+LANGTABLE=$IMGPATH/usr/lib/anaconda/lang-table
Christopher Edward Lumens 7c8918
+PCIIDS=$IMGPATH/usr/share/hwdata/pci.ids
Christopher Edward Lumens 7c8918
+XDRIVERS=$IMGPATH/usr/share/hwdata/videoaliases
Christopher Edward Lumens 7c8918
+XDRIVERDESCS=$IMGPATH/usr/share/hwdata/videodrivers
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+REQUIREMENTS="$TRIMPCIIDS $PCIIDS $XDRIVERDESCS $GENMODINFO
Christopher Edward Lumens 7c8918
+      $LANGTABLE $GETKEYMAPS"
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+dieLater=
Christopher Edward Lumens 7c8918
+for n in $REQUIREMENTS; do
Christopher Edward Lumens 7c8918
+    if [ ! -f $n ]; then
Christopher Edward Lumens 7c8918
+        echo "$n doesn't exist"
Christopher Edward Lumens 7c8918
+        dieLater=1
Christopher Edward Lumens 7c8918
+    fi
Christopher Edward Lumens 7c8918
+done
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+for n in $BOOTDISKDIR; do
Christopher Edward Lumens 7c8918
+    if [ ! -d $n ]; then
Christopher Edward Lumens 7c8918
+        echo "$n doesn't exist"
Christopher Edward Lumens 7c8918
+        dieLater=1
Christopher Edward Lumens 7c8918
+    fi
Christopher Edward Lumens 7c8918
+done
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+if [ -n "$dieLater" ]; then exit 1; fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+if [ "$BUILDARCH" != "s390" -a "$BUILDARCH" != "s390x" ]; then
Christopher Edward Lumens 7c8918
+    # go ahead and create the keymaps so we only have to do it once
Christopher Edward Lumens 7c8918
+    if [ -f $IMGPATH/usr/lib/anaconda-runtime/keymaps-override-$BUILDARCH ]; then
Christopher Edward Lumens 7c8918
+        echo "Found keymap override, using it"
Christopher Edward Lumens 7c8918
+        cp $IMGPATH/usr/lib/anaconda-runtime/keymaps-override-$BUILDARCH $KEYMAPS
Christopher Edward Lumens 7c8918
+    else
Christopher Edward Lumens 7c8918
+        echo "Running: $GETKEYMAPS $BUILDARCH $KEYMAPS $IMGPATH"
Christopher Edward Lumens 7c8918
+        $GETKEYMAPS $BUILDARCH $KEYMAPS $IMGPATH
Christopher Edward Lumens 7c8918
+        if [ $? != 0 ]; then
Christopher Edward Lumens 7c8918
+            echo "Unable to create keymaps and thus can't create initrd."
Christopher Edward Lumens 7c8918
+            exit 1
Christopher Edward Lumens 7c8918
+        fi
Christopher Edward Lumens 7c8918
+    fi
Christopher Edward Lumens 7c8918
+fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+findPackage() {
Christopher Edward Lumens 7c8918
+    name=$1
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    pkg=$(repoquery --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}" -c $yumconf --archlist=$KERNELARCH $name.$KERNELARCH)
Christopher Edward Lumens 7c8918
+    if [ -n "$pkg" ]; then
Christopher Edward Lumens 7c8918
+        echo $pkg
Christopher Edward Lumens 7c8918
+        return
Christopher Edward Lumens 7c8918
+    fi
Christopher Edward Lumens 7c8918
+    echo "cannot find package $name" >&2
Christopher Edward Lumens 7c8918
+}
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+rundepmod () {
Christopher Edward Lumens 7c8918
+    where=$1
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    $FAKEARCH /sbin/depmod -a -F $KERNELROOT/boot/System.map-$version \
Christopher Edward Lumens 7c8918
+            -b $where $version
Christopher Edward Lumens 7c8918
+}
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+# This loops to make sure it resolves dependencies of dependencies of...
Christopher Edward Lumens 7c8918
+resdeps () {
Christopher Edward Lumens 7c8918
+    items="$*"
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    deplist=""
Christopher Edward Lumens 7c8918
+    for item in $items ; do
Christopher Edward Lumens 7c8918
+        deps=$(awk -F ':' "/$item.ko: / { print gensub(\".*/$item.ko: \",\"\",\"g\") }" $KERNELROOT/lib/modules/$version/modules.dep)
Christopher Edward Lumens 7c8918
+        for dep in $deps ; do
Christopher Edward Lumens 7c8918
+            depfile=${dep##*/}
Christopher Edward Lumens 7c8918
+            depname=${dep%%.ko}
Christopher Edward Lumens 7c8918
+            deplist="$deplist $depname"
Christopher Edward Lumens 7c8918
+        done
Christopher Edward Lumens 7c8918
+    done
Christopher Edward Lumens 7c8918
+    items=$(for n in $items $deplist; do echo $n; done | sort -u)
Christopher Edward Lumens 7c8918
+    echo $items
Christopher Edward Lumens 7c8918
+}
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+expandModuleSet() {
Christopher Edward Lumens 7c8918
+    SET=""
Christopher Edward Lumens 7c8918
+    for name in $1; do
Christopher Edward Lumens 7c8918
+        char=$(echo $name | cut -c1)
Christopher Edward Lumens 7c8918
+        if [ $char = '=' ]; then
Christopher Edward Lumens 7c8918
+	    NAME=$(echo $name | cut -c2-)
Christopher Edward Lumens 7c8918
+	    if [ "$NAME" = "ata" ]; then
Christopher Edward Lumens 7c8918
+		SET="$SET $(egrep '(ata|ahci)' $KERNELROOT/lib/modules/$version/modules.block |sed -e 's/.ko//')"
Christopher Edward Lumens 7c8918
+	    elif [ "$NAME" = "scsi" ]; then
Christopher Edward Lumens 7c8918
+		SET="$SET $(sed -e 's/.ko//' $KERNELROOT/lib/modules/$version/modules.block)"
Christopher Edward Lumens 7c8918
+	    elif [ "$NAME" = "net" ]; then
Christopher Edward Lumens 7c8918
+		SET="$SET $(sed -e 's/.ko//' $KERNELROOT/lib/modules/$version/modules.networking)"
Christopher Edward Lumens 7c8918
+	    else
Christopher Edward Lumens 7c8918
+                # Ignore if group list does not exist
Christopher Edward Lumens 7c8918
+                if [ -e $KERNELROOT/lib/modules/$version/modules.$NAME ]; then
Christopher Edward Lumens 7c8918
+		    SET="$SET $(sed -e 's/.ko//' $KERNELROOT/lib/modules/$version/modules.$NAME)"
Christopher Edward Lumens 7c8918
+                fi
Christopher Edward Lumens 7c8918
+            fi
Christopher Edward Lumens 7c8918
+        else
Christopher Edward Lumens 7c8918
+            SET="$SET $name"
Christopher Edward Lumens 7c8918
+        fi
Christopher Edward Lumens 7c8918
+    done
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    echo $SET
Christopher Edward Lumens 7c8918
+}
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+makemoduletree() {
Christopher Edward Lumens 7c8918
+    MMB_DIR=$1
Christopher Edward Lumens 7c8918
+    MMB_MODULESET=$(resdeps $2)
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    mkdir -p $MMB_DIR/lib
Christopher Edward Lumens 7c8918
+    mkdir -p $MMB_DIR/modules
Christopher Edward Lumens 7c8918
+    mkdir -p $MMB_DIR/firmware
Christopher Edward Lumens 7c8918
+    ln -snf ../modules $MMB_DIR/lib/modules
Christopher Edward Lumens 7c8918
+    ln -snf ../firmware $MMB_DIR/lib/firmware
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    echo "Copying kernel modules..."
Christopher Edward Lumens 7c8918
+    cp -a $KERNELROOT/lib/modules/* $MMB_DIR/lib/modules/
Christopher Edward Lumens 7c8918
+    echo "Removing extraneous modules..."
Christopher Edward Lumens 7c8918
+    find $MMB_DIR/lib/modules/ -name *.ko | while read module ; do
Christopher Edward Lumens 7c8918
+        m=${module##*/}
Christopher Edward Lumens 7c8918
+        modname=${m%%.ko}
Christopher Edward Lumens 7c8918
+        echo $MMB_MODULESET | grep -wq $modname || {
Christopher Edward Lumens 7c8918
+            rm -f $module
Christopher Edward Lumens 7c8918
+        }
Christopher Edward Lumens 7c8918
+    done
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    echo "Copying required firmware..."
Christopher Edward Lumens 7c8918
+    find $MMB_DIR/lib/modules/ -name *.ko | while read module ; do
Christopher Edward Lumens 7c8918
+        for fw in $(modinfo -F firmware $module); do
Christopher Edward Lumens 7c8918
+            dest=$MBD_DIR/firmware/$fw
Christopher Edward Lumens 7c8918
+            destdir=$(dirname $dest)
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+            # Some firmware files are expected to be in their own directories.
Christopher Edward Lumens 7c8918
+            if [ ! -d $destdir ]; then
Christopher Edward Lumens 7c8918
+                mkdir -p $destdir
Christopher Edward Lumens 7c8918
+            fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+            cp $KERNELROOT/lib/firmware/$fw $dest
Christopher Edward Lumens 7c8918
+        done
Christopher Edward Lumens 7c8918
+    done
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    # Copy in driver firmware we know we'll want during installation. This is
Christopher Edward Lumens 7c8918
+    # required for modules which still don't (or can't) export information
Christopher Edward Lumens 7c8918
+    # about what firmware files they require.
Christopher Edward Lumens 7c8918
+    for module in $MODSET ; do
Christopher Edward Lumens 7c8918
+        case $module in
Christopher Edward Lumens 7c8918
+            ipw2100)
Christopher Edward Lumens 7c8918
+                cp $KERNELROOT/lib/firmware/ipw2100* $MBD_DIR/firmware
Christopher Edward Lumens 7c8918
+            ;;
Christopher Edward Lumens 7c8918
+            ipw2200)
Christopher Edward Lumens 7c8918
+                cp $KERNELROOT/lib/firmware/ipw2200* $MBD_DIR/firmware
Christopher Edward Lumens 7c8918
+            ;;
Christopher Edward Lumens 7c8918
+            iwl3945)
Christopher Edward Lumens 7c8918
+                cp $KERNELROOT/lib/firmware/iwlwifi-3945* $MBD_DIR/firmware
Christopher Edward Lumens 7c8918
+            ;;
Christopher Edward Lumens 7c8918
+            atmel)
Christopher Edward Lumens 7c8918
+                cp $KERNELROOT/lib/firmware/atmel_*.bin $MBD_DIR/firmware
Christopher Edward Lumens 7c8918
+            ;;
Christopher Edward Lumens 7c8918
+            zd1211rw)
Christopher Edward Lumens 7c8918
+                cp -r $KERNELROOT/lib/firmware/zd1211 $MBD_DIR/firmware
Christopher Edward Lumens 7c8918
+            ;;
Christopher Edward Lumens 7c8918
+        esac
Christopher Edward Lumens 7c8918
+    done
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    # clean up leftover cruft
Christopher Edward Lumens 7c8918
+    find -H $MMB_DIR/lib/modules -type d -exec rmdir -f {} \; 2>/dev/null
Christopher Edward Lumens 7c8918
+    $MODLIST --modinfo-file $MODINFO --ignore-missing --modinfo \
Christopher Edward Lumens 7c8918
+    $MMB_MODULESET > $MMB_DIR/lib/modules/module-info
Christopher Edward Lumens 7c8918
+    # compress modules
Christopher Edward Lumens 7c8918
+    find -H $MMB_DIR/lib/modules -type f -name *.ko -exec gzip -9 {} \;
Christopher Edward Lumens 7c8918
+    rundepmod $MMB_DIR
Christopher Edward Lumens 7c8918
+    rm -f $MMB_DIR/lib/modules/*/modules.*map
Christopher Edward Lumens 7c8918
+    rm -f $MMB_DIR/lib/modules/*/{build,source}
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    # create the pci.ids, from modules.alias and the X driver aliases
Christopher Edward Lumens 7c8918
+    awk '!/^(\t\t|#)/ { print ;if ($0 == "ffff  Illegal Vendor ID") nextfile; }' < $PCIIDS | \
Christopher Edward Lumens 7c8918
+        $TRIMPCIIDS $MMB_DIR/lib/modules/*/modules.alias $XDRIVERS/* > ../pci.ids
Christopher Edward Lumens 7c8918
+}
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+makeproductfile() {
Christopher Edward Lumens 7c8918
+    root=$1
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    rm -f $root/.buildstamp
Christopher Edward Lumens 7c8918
+    echo $IMAGEUUID > $root/.buildstamp
Christopher Edward Lumens 7c8918
+    echo $PRODUCT >> $root/.buildstamp
Christopher Edward Lumens 7c8918
+    echo $VERSION >> $root/.buildstamp
Christopher Edward Lumens 7c8918
+    if [ -n "$BUGURL" ]; then
Christopher Edward Lumens 7c8918
+        echo $BUGURL >> $root/.buildstamp
Christopher Edward Lumens 7c8918
+    fi
Christopher Edward Lumens 7c8918
+}
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+instbin() {
Christopher Edward Lumens 7c8918
+    ROOT=$1
Christopher Edward Lumens 7c8918
+    BIN=$2
Christopher Edward Lumens 7c8918
+    DIR=$3
Christopher Edward Lumens 7c8918
+    DEST=$4
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    iself="$(file $ROOT/$BIN | grep ELF | grep executable)"
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    if [ -l $ROOT/$BIN ]; then
Christopher Edward Lumens 7c8918
+        cp -a $ROOT/$BIN $DIR/$DEST
Christopher Edward Lumens 7c8918
+    else
Christopher Edward Lumens 7c8918
+        if [ -z "$iself" ]; then
Christopher Edward Lumens 7c8918
+            install -m 755 $ROOT/$BIN $DIR/$DEST
Christopher Edward Lumens 7c8918
+        else
Christopher Edward Lumens 7c8918
+            install -s -m 755 $ROOT/$BIN $DIR/$DEST
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+            get_dso_deps $ROOT "$BIN"
Christopher Edward Lumens 7c8918
+            local DEPS="$DSO_DEPS"
Christopher Edward Lumens 7c8918
+            mkdir -p $DIR/$LIBDIR
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+            for x in $DEPS ; do
Christopher Edward Lumens 7c8918
+                cp -Lfp $ROOT/$x $DIR/$LIBDIR
Christopher Edward Lumens 7c8918
+            done
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+            pushd $DIR/$LIBDIR
Christopher Edward Lumens 7c8918
+            if [ -f ld-linux.so.2 -a ! -L ld-linux.so.2 ]; then
Christopher Edward Lumens 7c8918
+                rm -f ld-linux.so.2
Christopher Edward Lumens 7c8918
+                linker="$(ls -1 ld-*.*.*.so)"
Christopher Edward Lumens 7c8918
+                if [ -z "$linker" ]; then
Christopher Edward Lumens 7c8918
+                    linker="$(ls -1 ld-*.*.so)"
Christopher Edward Lumens 7c8918
+                fi
Christopher Edward Lumens 7c8918
+                found=$(echo $linker | wc -l)
Christopher Edward Lumens 7c8918
+                if [ $found -ne 1 ]; then
Christopher Edward Lumens 7c8918
+                    echo "Found too many dynamic linkers:" >&2
Christopher Edward Lumens 7c8918
+                    echo $linker >&2
Christopher Edward Lumens 7c8918
+                    exit 1
Christopher Edward Lumens 7c8918
+                fi
Christopher Edward Lumens 7c8918
+                ln -s $linker ld-linux.so.2
Christopher Edward Lumens 7c8918
+            fi
Christopher Edward Lumens 7c8918
+            popd
Christopher Edward Lumens 7c8918
+        fi
Christopher Edward Lumens 7c8918
+    fi
Christopher Edward Lumens 7c8918
+}
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+setupShellEnvironment() {
Christopher Edward Lumens 7c8918
+    echo "tcp     6       TCP" > $MBD_DIR/etc/protocols
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    # PAM configuration
Christopher Edward Lumens 7c8918
+    for i in pam_limits.so pam_env.so pam_unix.so pam_deny.so; do
Christopher Edward Lumens 7c8918
+        cp -f $IMGPATH/$LIBDIR/security/$i $MBD_DIR/$LIBDIR/security
Christopher Edward Lumens 7c8918
+    done
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    cp -f $IMGPATH/etc/pam.d/other $MBD_DIR/etc/pam.d
Christopher Edward Lumens 7c8918
+    cat > $MBD_DIR/etc/pam.d/login << EOF
Christopher Edward Lumens 7c8918
+#%PAM-1.0
Christopher Edward Lumens 7c8918
+auth        required      pam_env.so
Christopher Edward Lumens 7c8918
+auth        sufficient    pam_unix.so likeauth nullok
Christopher Edward Lumens 7c8918
+auth        required      pam_deny.so
Christopher Edward Lumens 7c8918
+account     required      pam_unix.so
Christopher Edward Lumens 7c8918
+password    sufficient    pam_unix.so nullok use_authtok md5 shadow
Christopher Edward Lumens 7c8918
+password    required      pam_deny.so
Christopher Edward Lumens 7c8918
+session     required      pam_limits.so
Christopher Edward Lumens 7c8918
+session     required      pam_unix.so
Christopher Edward Lumens 7c8918
+EOF
Christopher Edward Lumens 7c8918
+    cp -f $MBD_DIR/etc/pam.d/login $MBD_DIR/etc/pam.d/sshd
Christopher Edward Lumens 7c8918
+    cp -f $MBD_DIR/etc/pam.d/login $MBD_DIR/etc/pam.d/remote
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    cp -f $IMGPATH/etc/security/{limits.conf,pam_env.conf} $MBD_DIR/etc/security/
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    # key generation takes ages on s390, you really don't want this for every
Christopher Edward Lumens 7c8918
+    # installation attempt. These are NOT the keys of the installed system!
Christopher Edward Lumens 7c8918
+    mkdir -m 0700 -p $MBD_DIR/etc/ssh
Christopher Edward Lumens 7c8918
+    echo -n "Generating SSH1 RSA host key: "
Christopher Edward Lumens 7c8918
+    /usr/bin/ssh-keygen -q -t rsa1 -f $MBD_DIR/etc/ssh/ssh_host_key \
Christopher Edward Lumens 7c8918
+                        -C '' -N '' >&/dev/null
Christopher Edward Lumens 7c8918
+    echo
Christopher Edward Lumens 7c8918
+    echo -n "Generating SSH2 RSA host key: "
Christopher Edward Lumens 7c8918
+    /usr/bin/ssh-keygen -q -t rsa -f $MBD_DIR/etc/ssh/ssh_host_rsa_key \
Christopher Edward Lumens 7c8918
+                        -C '' -N '' >&/dev/null
Christopher Edward Lumens 7c8918
+    echo
Christopher Edward Lumens 7c8918
+    echo -n "Generating SSH2 DSA host key: "
Christopher Edward Lumens 7c8918
+    /usr/bin/ssh-keygen -q -t dsa -f $MBD_DIR/etc/ssh/ssh_host_dsa_key \
Christopher Edward Lumens 7c8918
+                        -C '' -N '' >&/dev/null
Christopher Edward Lumens 7c8918
+    echo
Christopher Edward Lumens 7c8918
+    (cd $MBD_DIR/etc/ssh; \
Christopher Edward Lumens 7c8918
+        chmod 600 ssh_host_key ssh_host_rsa_key ssh_host_dsa_key; \
Christopher Edward Lumens 7c8918
+        chmod 644 ssh_host_key.pub ssh_host_rsa_key.pub ssh_host_dsa_key.pub; )
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    cat > $MBD_DIR/etc/ssh/sshd_config <
Christopher Edward Lumens 7c8918
+Port 22
Christopher Edward Lumens 7c8918
+HostKey /etc/ssh/ssh_host_key
Christopher Edward Lumens 7c8918
+HostKey /etc/ssh/ssh_host_rsa_key
Christopher Edward Lumens 7c8918
+HostKey /etc/ssh/ssh_host_dsa_key
Christopher Edward Lumens 7c8918
+PermitRootLogin yes
Christopher Edward Lumens 7c8918
+IgnoreRhosts yes
Christopher Edward Lumens 7c8918
+StrictModes yes
Christopher Edward Lumens 7c8918
+X11Forwarding yes
Christopher Edward Lumens 7c8918
+X11DisplayOffset 10
Christopher Edward Lumens 7c8918
+PrintMotd yes
Christopher Edward Lumens 7c8918
+XAuthLocation /sbin/xauth
Christopher Edward Lumens 7c8918
+KeepAlive yes
Christopher Edward Lumens 7c8918
+SyslogFacility AUTHPRIV
Christopher Edward Lumens 7c8918
+RSAAuthentication yes
Christopher Edward Lumens 7c8918
+PasswordAuthentication yes
Christopher Edward Lumens 7c8918
+PermitEmptyPasswords yes
Christopher Edward Lumens 7c8918
+PermitUserEnvironment yes
Christopher Edward Lumens 7c8918
+EOF
Christopher Edward Lumens 7c8918
+    chmod 600 $MBD_DIR/etc/ssh/sshd_config
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    # copy in the binaries
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/bin/login $MBD_DIR /sbin/login
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/sbin/sshd $MBD_DIR /sbin/sshd
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/bin/busybox $MBD_DIR /sbin/busybox
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    # make some symlinks
Christopher Edward Lumens 7c8918
+    (cd $MBD_DIR/sbin;
Christopher Edward Lumens 7c8918
+        set $(./busybox 2>&1| awk '/^\t([[:alnum:]_\.\[]+,)+/' | sed 's/,//g' | sed 's/ +//');
Christopher Edward Lumens 7c8918
+        while [ -n "$1" ]; do
Christopher Edward Lumens 7c8918
+              if [ $1 != "busybox" -a $1 != "sh" ]; then
Christopher Edward Lumens 7c8918
+                # if file doesnt already exist, link to busybox
Christopher Edward Lumens 7c8918
+                if [ ! -f "$1" ]; then
Christopher Edward Lumens 7c8918
+                    ln -sf ./busybox $1
Christopher Edward Lumens 7c8918
+                else
Christopher Edward Lumens 7c8918
+                    [ -n "$DEBUG" ] && echo "Overriding busybox version of $1"
Christopher Edward Lumens 7c8918
+                fi
Christopher Edward Lumens 7c8918
+            fi
Christopher Edward Lumens 7c8918
+            shift
Christopher Edward Lumens 7c8918
+        done )
Christopher Edward Lumens 7c8918
+}
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+makeinitrd() {
Christopher Edward Lumens 7c8918
+    EXTRAINITRDPATH=""
Christopher Edward Lumens 7c8918
+    INITRDSIZE=""
Christopher Edward Lumens 7c8918
+    KEEP=""
Christopher Edward Lumens 7c8918
+    PADSIZE=""
Christopher Edward Lumens 7c8918
+    LOADERBIN=""
Christopher Edward Lumens 7c8918
+    INITRDMODULES=""
Christopher Edward Lumens 7c8918
+    MYLANGTABLE=$LANGTABLE
Christopher Edward Lumens 7c8918
+    MYLOADERTR=loader.tr
Christopher Edward Lumens 7c8918
+    while [ x$(echo $1 | cut -c1-2) = x"--" ]; do
Christopher Edward Lumens 7c8918
+        if [ $1 = "--initrdto" ]; then
Christopher Edward Lumens 7c8918
+            EXTRAINITRDPATH=$2
Christopher Edward Lumens 7c8918
+            shift; shift
Christopher Edward Lumens 7c8918
+            continue
Christopher Edward Lumens 7c8918
+        elif [ $1 = "--keep" ]; then
Christopher Edward Lumens 7c8918
+            KEEP=yes
Christopher Edward Lumens 7c8918
+            shift
Christopher Edward Lumens 7c8918
+            continue
Christopher Edward Lumens 7c8918
+        elif [ $1 = "--initrdsize" ]; then
Christopher Edward Lumens 7c8918
+            INITRDSIZE=$2
Christopher Edward Lumens 7c8918
+            shift; shift
Christopher Edward Lumens 7c8918
+            continue
Christopher Edward Lumens 7c8918
+        elif [ $1 = "--loaderbin" ]; then
Christopher Edward Lumens 7c8918
+            LOADERBIN=$2
Christopher Edward Lumens 7c8918
+            shift; shift
Christopher Edward Lumens 7c8918
+            continue
Christopher Edward Lumens 7c8918
+        elif [ $1 = "--modules" ]; then
Christopher Edward Lumens 7c8918
+            INITRDMODULES=$2
Christopher Edward Lumens 7c8918
+            shift; shift
Christopher Edward Lumens 7c8918
+            continue
Christopher Edward Lumens 7c8918
+        fi
Christopher Edward Lumens 7c8918
+        echo "Unknown option passed to makeinitrd"
Christopher Edward Lumens 7c8918
+        exit 1
Christopher Edward Lumens 7c8918
+    done
Christopher Edward Lumens 7c8918
+    if [ -z "$LOADERBIN" ]; then
Christopher Edward Lumens 7c8918
+        echo "no loader binary specified!" >&2
Christopher Edward Lumens 7c8918
+        exit 1
Christopher Edward Lumens 7c8918
+    fi
Christopher Edward Lumens 7c8918
+    if [ -z "$INITRDMODULES" ]; then
Christopher Edward Lumens 7c8918
+        echo "warning: no loader modules specified!" >&2
Christopher Edward Lumens 7c8918
+    fi
Christopher Edward Lumens 7c8918
+    if [ -z "$INITRDSIZE" ]; then
Christopher Edward Lumens 7c8918
+        echo "I don't know how big to make the initrd image!" >&2
Christopher Edward Lumens 7c8918
+        exit 1
Christopher Edward Lumens 7c8918
+    fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    MBD_DIR=$TMPDIR/makebootdisk.dir.$$
Christopher Edward Lumens 7c8918
+    MBD_FSIMAGE=$TMPDIR/makebootdisk.initrdimage.$$
Christopher Edward Lumens 7c8918
+    MBD_BOOTTREE=$TMPDIR/makebootdisk.tree.$$
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    rm -rf $MBD_DIR $MBD_FSIMAGE
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/modules
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/sbin
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/dev
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/etc
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/etc/udev/rules.d
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/lib/udev/rules.d
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/proc
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/selinux
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/sys
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/etc/terminfo/{a,b,d,l,s,v,x}
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/tmp
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/usr/libexec
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/usr/$LIBDIR/NetworkManager
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/usr/share/dbus-1/system-services
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/var/cache/hald
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/var/lib/dbus
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/var/lib/dhclient
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/var/lock/rpm
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/var/run
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/var/run/dbus
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/var/run/hald
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/var/run/NetworkManager
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/etc/dbus-1/system.d
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/etc/modprobe.d
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/etc/NetworkManager/dispatcher.d
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/$LIBDIR/dbus-1
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/etc/sysconfig/network-scripts
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/usr/share/PolicyKit/policy
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/etc/PolicyKit
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/var/lib/misc
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/etc/hal/fdi
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/usr/share/hal/fdi
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/usr/share/hwdata
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/etc/rc.d/init.d
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/usr/sbin
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/var/run/wpa_supplicant
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    if [ "$BUILDARCH" = "s390" -o "$BUILDARCH" = "s390x" ]; then
Christopher Edward Lumens 7c8918
+        mkdir -m 111 -p $MBD_DIR/var/empty/sshd
Christopher Edward Lumens 7c8918
+        mkdir -p $MBD_DIR/etc/{pam.d,security}
Christopher Edward Lumens 7c8918
+        mkdir -p $MBD_DIR/$LIBDIR/security
Christopher Edward Lumens 7c8918
+        cp $IMGPATH/$LIBDIR/libpam_misc.so.0.* $MBD_DIR/$LIBDIR/libpam_misc.so.0
Christopher Edward Lumens 7c8918
+        ln -s /tmp $MBD_DIR/var/state/xkb
Christopher Edward Lumens 7c8918
+        cp $IMGPATH/usr/bin/xauth $MBD_DIR/sbin/xauth
Christopher Edward Lumens 7c8918
+        cp $IMGPATH/usr/sbin/cmsfs* $MBD_DIR/sbin/
Christopher Edward Lumens 7c8918
+    fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    if [ -n "$INITRDMODULES" ]; then
Christopher Edward Lumens 7c8918
+        MODSET=`expandModuleSet "$INITRDMODULES"`
Christopher Edward Lumens 7c8918
+        makemoduletree $MBD_DIR "$MODSET"
Christopher Edward Lumens 7c8918
+    fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    # set up the arch bits
Christopher Edward Lumens 7c8918
+    echo $arch > $MBD_DIR/etc/arch
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    echo "Setting up arch bits"
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH ${LOADERBINDIR##$IMGPATH}/$LOADERBIN $MBD_DIR /sbin/loader
Christopher Edward Lumens 7c8918
+    if [ "$BUILDARCH" != "s390" -a "$BUILDARCH" != "s390x" ]; then
Christopher Edward Lumens 7c8918
+        instbin $IMGPATH ${LOADERBINDIR##$IMGPATH}/init $MBD_DIR /sbin/init
Christopher Edward Lumens 7c8918
+        ln -s ./init $MBD_DIR/sbin/reboot
Christopher Edward Lumens 7c8918
+        ln -s ./init $MBD_DIR/sbin/halt
Christopher Edward Lumens 7c8918
+        ln -s ./init $MBD_DIR/sbin/poweroff
Christopher Edward Lumens 7c8918
+    else
Christopher Edward Lumens 7c8918
+        instbin $IMGPATH ${LOADERBINDIR##IMGPATH}/shutdown $MBD_DIR /sbin/shutdown
Christopher Edward Lumens 7c8918
+        instbin $IMGPATH /usr/lib/anaconda-runtime/loader/linuxrc.s390 $MBD_DIR /sbin/init
Christopher Edward Lumens 7c8918
+        instbin $IMGPATH /usr/sbin/dasdfmt $MBD_DIR /sbin/dasdfmt
Christopher Edward Lumens 7c8918
+    fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    if [ "$BUILDARCH" != "s390" -a "$BUILDARCH" != "s390x" ]; then
Christopher Edward Lumens 7c8918
+       install -m 644 $KEYMAPS $MBD_DIR/etc/keymaps.gz
Christopher Edward Lumens 7c8918
+       install -m 644 $SCREENFONT $MBD_DIR/etc/screenfont.gz
Christopher Edward Lumens 7c8918
+    fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    install -m 644 $MYLANGTABLE $MBD_DIR/etc/lang-table
Christopher Edward Lumens 7c8918
+    install -m 644 $IMGPATH/etc/passwd $MBD_DIR/etc/passwd
Christopher Edward Lumens 7c8918
+    install -m 644 $IMGPATH/etc/group $MBD_DIR/etc/group
Christopher Edward Lumens 7c8918
+    install -m 644 $IMGPATH/etc/nsswitch.conf $MBD_DIR/etc/nsswitch.conf
Christopher Edward Lumens 7c8918
+    install -m 644 $IMGPATH/etc/hosts $MBD_DIR/etc/hosts
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/bin/mount $MBD_DIR /sbin/mount
Christopher Edward Lumens 7c8918
+    for mountcmd in $IMGPATH/usr/sbin/mount.* ; do
Christopher Edward Lumens 7c8918
+        cmd="$(basename $mountcmd)"
Christopher Edward Lumens 7c8918
+        instbin $IMGPATH /usr/sbin/$cmd $MBD_DIR /sbin/$cmd
Christopher Edward Lumens 7c8918
+    done
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/bin/umount $MBD_DIR /sbin/umount
Christopher Edward Lumens 7c8918
+    for umountcmd in $IMGPATH/usr/sbin/umount.* ; do
Christopher Edward Lumens 7c8918
+        cmd="$(basename $umountcmd)"
Christopher Edward Lumens 7c8918
+        instbin $IMGPATH /usr/sbin/$cmd $MBD_DIR /sbin/$cmd
Christopher Edward Lumens 7c8918
+    done
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/sbin/udevd $MBD_DIR /sbin/udevd
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/sbin/udevadm $MBD_DIR /sbin/udevadm
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/bin/udevinfo $MBD_DIR /sbin/udevinfo
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/bin/bash $MBD_DIR /sbin/bash
Christopher Edward Lumens 7c8918
+    ( cd $MBD_DIR/sbin ; ln -sf bash sh )
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/sbin/consoletype $MBD_DIR /sbin/consoletype
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/bin/logger $MBD_DIR /sbin/logger
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    ( cd $IMGPATH/etc/rc.d/init.d
Christopher Edward Lumens 7c8918
+      cp -a functions $MBD_DIR/etc/rc.d/init.d
Christopher Edward Lumens 7c8918
+    )
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    ( cd $IMGPATH/etc/sysconfig/network-scripts
Christopher Edward Lumens 7c8918
+      cp -a network-functions $MBD_DIR/etc/sysconfig/network-scripts
Christopher Edward Lumens 7c8918
+      cp -a network-functions-ipv6 $MBD_DIR/etc/sysconfig/network-scripts
Christopher Edward Lumens 7c8918
+    )
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    ( cd $MBD_DIR/etc ; ln -sf /etc/rc.d/init.d init.d )
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    # DHCP and DHCPv6 client daemons and support programs
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/sbin/dhclient $MBD_DIR /sbin/dhclient
Christopher Edward Lumens 7c8918
+    cp -a $IMGPATH/usr/sbin/dhclient-script $MBD_DIR/sbin/dhclient-script
Christopher Edward Lumens 7c8918
+    chmod 0755 $MBD_DIR/sbin/dhclient-script
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/sbin/dhcp6c $MBD_DIR /sbin/dhcp6c
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/sbin/arping $MBD_DIR /sbin/arping
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/sbin/ifconfig $MBD_DIR /sbin/ifconfig
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/sbin/ip $MBD_DIR /sbin/ip
Christopher Edward Lumens 7c8918
+    touch $MBD_DIR/etc/resolv.conf
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    # hwdata
Christopher Edward Lumens 7c8918
+    cp -a $IMGPATH/usr/share/hwdata/pci.ids $MBD_DIR/usr/share/hwdata/pci.ids
Christopher Edward Lumens 7c8918
+    cp -a $IMGPATH/usr/share/hwdata/usb.ids $MBD_DIR/usr/share/hwdata/usb.ids
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    # hal
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/sbin/hald $MBD_DIR /sbin/hald
Christopher Edward Lumens 7c8918
+    ( cd $IMGPATH/usr/libexec
Christopher Edward Lumens 7c8918
+      for f in hald-runner hald-generate-fdi-cache hal*storage* ; do
Christopher Edward Lumens 7c8918
+          instbin $IMGPATH /usr/libexec/$f $MBD_DIR /usr/libexec/$f
Christopher Edward Lumens 7c8918
+      done
Christopher Edward Lumens 7c8918
+    )
Christopher Edward Lumens 7c8918
+    touch $MBD_DIR/var/run/hald.acl-list
Christopher Edward Lumens 7c8918
+    cp -a $IMGPATH/usr/share/hal/fdi/* $MBD_DIR/usr/share/hal/fdi
Christopher Edward Lumens 7c8918
+    cp -a $IMGPATH/etc/hal/fdi/* $MBD_DIR/etc/hal/fdi
Christopher Edward Lumens 7c8918
+    cp -a $IMGPATH/etc/dbus-1/system.d/hal.conf $MBD_DIR/etc/dbus-1/system.d
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    # PolicyKit
Christopher Edward Lumens 7c8918
+    ( cd $IMGPATH/etc/PolicyKit
Christopher Edward Lumens 7c8918
+      cp -a PolicyKit.conf $MBD_DIR/etc/PolicyKit
Christopher Edward Lumens 7c8918
+    )
Christopher Edward Lumens 7c8918
+    ( cd $IMGPATH/usr/share/dbus-1/system-services
Christopher Edward Lumens 7c8918
+      cp -a org.freedesktop.PolicyKit.service $MBD_DIR/usr/share/dbus-1/system-services
Christopher Edward Lumens 7c8918
+    )
Christopher Edward Lumens 7c8918
+    ( cd $IMGPATH/usr/share/PolicyKit/policy
Christopher Edward Lumens 7c8918
+      cp -a org.freedesktop.policykit.policy $MBD_DIR/usr/share/PolicyKit/policy
Christopher Edward Lumens 7c8918
+    )
Christopher Edward Lumens 7c8918
+    ( cd $IMGPATH/var/lib/misc
Christopher Edward Lumens 7c8918
+      cp -a PolicyKit.reload $MBD_DIR/var/lib/misc
Christopher Edward Lumens 7c8918
+    )
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    # dbus
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/bin/dbus-uuidgen $MBD_DIR /sbin/dbus-uuidgen
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/bin/dbus-daemon $MBD_DIR /sbin/dbus-daemon
Christopher Edward Lumens 7c8918
+    cp -a $IMGPATH/etc/dbus-1/system.conf $MBD_DIR/etc/dbus-1/system.conf
Christopher Edward Lumens 7c8918
+    cp -a $IMGPATH/$LIBDIR/dbus-1/dbus-daemon-launch-helper $MBD_DIR/$LIBDIR/dbus-1
Christopher Edward Lumens 7c8918
+    chown root:dbus $MBD_DIR/$LIBDIR/dbus-1/dbus-daemon-launch-helper
Christopher Edward Lumens 7c8918
+    chmod 04750 $MBD_DIR/$LIBDIR/dbus-1/dbus-daemon-launch-helper
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    # wpa_supplicant
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/sbin/wpa_passphrase $MBD_DIR /usr/sbin/wpa_passphrase
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/sbin/wpa_supplicant $MBD_DIR /usr/sbin/wpa_supplicant
Christopher Edward Lumens 7c8918
+    cp -a $IMGPATH/etc/dbus-1/system.d/wpa_supplicant.conf $MBD_DIR/etc/dbus-1/system.d
Christopher Edward Lumens 7c8918
+    cp -a $IMGPATH/etc/wpa_supplicant/wpa_supplicant.conf $MBD_DIR/etc/wpa_supplicant
Christopher Edward Lumens 7c8918
+    ( cd $IMGPATH/usr/share/dbus-1/system-services
Christopher Edward Lumens 7c8918
+      cp -a fi.epitest.hostap.WPASupplicant.service $MBD_DIR/usr/share/dbus-1/system-services
Christopher Edward Lumens 7c8918
+    )
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    # NetworkManager
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/sbin/NetworkManager $MBD_DIR /usr/sbin/NetworkManager
Christopher Edward Lumens 7c8918
+    instbin $IMGPATH /usr/sbin/nm-system-settings $MBD_DIR /usr/sbin/nm-system-settings
Christopher Edward Lumens 7c8918
+    cp -a $IMGPATH/etc/dbus-1/system.d/nm-*.conf $MBD_DIR/etc/dbus-1/system.d
Christopher Edward Lumens 7c8918
+    cp -a $IMGPATH/etc/dbus-1/system.d/NetworkManager.conf $MBD_DIR/etc/dbus-1/system.d
Christopher Edward Lumens 7c8918
+    cp -a $IMGPATH/etc/NetworkManager/nm-system-settings.conf $MBD_DIR/etc/NetworkManager
Christopher Edward Lumens 7c8918
+    ( cd $IMGPATH/usr/$LIBDIR/NetworkManager
Christopher Edward Lumens 7c8918
+      for f in *.so ; do
Christopher Edward Lumens 7c8918
+          instbin $IMGPATH /usr/$LIBDIR/NetworkManager/$f $MBD_DIR /usr/$LIBDIR/NetworkManager/$f
Christopher Edward Lumens 7c8918
+      done
Christopher Edward Lumens 7c8918
+    )
Christopher Edward Lumens 7c8918
+    ( cd $IMGPATH/usr/libexec
Christopher Edward Lumens 7c8918
+      for f in nm-* ; do
Christopher Edward Lumens 7c8918
+          instbin $IMGPATH /usr/libexec/$f $MBD_DIR /usr/libexec/$f
Christopher Edward Lumens 7c8918
+      done
Christopher Edward Lumens 7c8918
+    )
Christopher Edward Lumens 7c8918
+    ( cd $IMGPATH/usr/share/dbus-1/system-services
Christopher Edward Lumens 7c8918
+      cp -a org.freedesktop.NetworkManagerSystemSettings.service $MBD_DIR/usr/share/dbus-1/system-services
Christopher Edward Lumens 7c8918
+      cp -a org.freedesktop.nm_dispatcher.service $MBD_DIR/usr/share/dbus-1/system-services
Christopher Edward Lumens 7c8918
+    )
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    # Indirect dependencies
Christopher Edward Lumens 7c8918
+    install -m 755 $IMGPATH/$LIBDIR/libfreebl3.so $MBD_DIR/$LIBDIR/
Christopher Edward Lumens 7c8918
+    install -m 755 $IMGPATH/$LIBDIR/libsoftokn3.so $MBD_DIR/$LIBDIR/
Christopher Edward Lumens 7c8918
+    install -m 755 $IMGPATH/usr/$LIBDIR/libsqlite3.so.0 $MBD_DIR/usr/$LIBDIR/
Christopher Edward Lumens 7c8918
+    install -m 755 $IMGPATH/$LIBDIR/libnss_dns.so.2 $MBD_DIR/$LIBDIR/
Christopher Edward Lumens 7c8918
+    install -m 755 $IMGPATH/$LIBDIR/libnss_files.so.2 $MBD_DIR/$LIBDIR/
Christopher Edward Lumens 7c8918
+    install -m 755 $IMGPATH/$LIBDIR/libgcc_s.so.1 $MBD_DIR/$LIBDIR/
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    install -m 644 $IMGPATH/etc/udev/udev.conf $MBD_DIR/etc/udev/udev.conf
Christopher Edward Lumens 7c8918
+    for i in $IMGPATH/lib/udev/rules.d/*.rules ; do
Christopher Edward Lumens 7c8918
+       install -m 644 $i $MBD_DIR/lib/udev/rules.d/${i##*/}
Christopher Edward Lumens 7c8918
+    done
Christopher Edward Lumens 7c8918
+    for i in $IMGPATH/etc/udev/rules.d/*.rules ; do
Christopher Edward Lumens 7c8918
+       install -m 644 $i $MBD_DIR/etc/udev/rules.d/${i##*/}
Christopher Edward Lumens 7c8918
+    done
Christopher Edward Lumens 7c8918
+    for i in $IMGPATH/lib/udev/*; do
Christopher Edward Lumens 7c8918
+       if [ -f $i ]; then install -m 755 $i $MBD_DIR/lib/udev/${i##*/}; fi
Christopher Edward Lumens 7c8918
+    done
Christopher Edward Lumens 7c8918
+    rm -f $MBD_DIR/lib/udev/rules.d/*persistent*
Christopher Edward Lumens 7c8918
+    rm -f $MBD_DIR/lib/udev/rules.d/*generator*
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    install -m 644 $LOADERBINDIR/$MYLOADERTR $MBD_DIR/etc/loader.tr
Christopher Edward Lumens 7c8918
+    for i in a/ansi d/dumb l/linux s/screen v/vt100 v/vt100-nav v/vt102 x/xterm x/xterm-color g/gnome ; do
Christopher Edward Lumens 7c8918
+        [ -f $IMGPATH/usr/share/terminfo/$i ] && \
Christopher Edward Lumens 7c8918
+        install -m 644 $IMGPATH/usr/share/terminfo/$i $MBD_DIR/etc/terminfo/$i
Christopher Edward Lumens 7c8918
+    done
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    makeproductfile $MBD_DIR
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    for n in insmod rmmod modprobe; do
Christopher Edward Lumens 7c8918
+        instbin $IMGPATH /usr/sbin/$n $MBD_DIR /sbin/$n
Christopher Edward Lumens 7c8918
+    done
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    ln -s /sbin/init $MBD_DIR/init
Christopher Edward Lumens 7c8918
+    ln -s /proc/mounts $MBD_DIR/etc/mtab
Christopher Edward Lumens 7c8918
+    ln -s sbin $MBD_DIR/bin
Christopher Edward Lumens 7c8918
+    mkdir -p $MBD_DIR/var/lib
Christopher Edward Lumens 7c8918
+    ln -s ../../tmp $MBD_DIR/var/lib/xkb
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    # s390/s390x need sshd setup
Christopher Edward Lumens 7c8918
+    if [ "$BUILDARCH" = "s390" -o "$BUILDARCH" = "s390x" ]; then
Christopher Edward Lumens 7c8918
+        setupShellEnvironment
Christopher Edward Lumens 7c8918
+    fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+cat > $MBD_DIR/.profile <
Christopher Edward Lumens 7c8918
+PATH=/bin:/usr/bin:/usr/sbin:/mnt/sysimage/sbin:/mnt/sysimage/usr/sbin:/mnt/sysimage/bin:/mnt/sysimage/usr/bin
Christopher Edward Lumens 7c8918
+export PATH
Christopher Edward Lumens 7c8918
+EOF
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    rm -f $MBD_FSIMAGE
Christopher Edward Lumens 7c8918
+    (cd $MBD_DIR; find . |cpio --quiet -c -o) |gzip -9 > $MBD_FSIMAGE
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    size=$(du $MBD_FSIMAGE | awk '{ print $1 }')
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    echo "Wrote $MBD_FSIMAGE (${size}k compressed)"
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    if [ -n "$EXTRAINITRDPATH" ]; then
Christopher Edward Lumens 7c8918
+        mkdir -p `dirname $EXTRAINITRDPATH`
Christopher Edward Lumens 7c8918
+        cp -a $MBD_FSIMAGE $EXTRAINITRDPATH
Christopher Edward Lumens 7c8918
+    fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    if [ -z "$KEEP" ]; then
Christopher Edward Lumens 7c8918
+        rm -rf $MBD_FSIMAGE $MBD_BOOTTREE
Christopher Edward Lumens 7c8918
+    fi
Christopher Edward Lumens 7c8918
+}
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+makeinstimage () {
Christopher Edward Lumens 7c8918
+    imagename=$1
Christopher Edward Lumens 7c8918
+    type=$2
Christopher Edward Lumens 7c8918
+    tmp=$TMPDIR/instimage.dir.$$
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    rm -rf $tmpimage $tmp
Christopher Edward Lumens 7c8918
+    mkdir -p $mntpoint $tmp
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    mkdir -p $tmp
Christopher Edward Lumens 7c8918
+    (cd $IMGPATH; find . | cpio --quiet -p $tmp)
Christopher Edward Lumens 7c8918
+    makeproductfile $tmp
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    if [ -z "$type" -o "$type" = "cramfs" ]; then
Christopher Edward Lumens 7c8918
+        echo "Running mkcramfs $CRAMBS $tmp $INSTIMGPATH/${imagename}2.img"
Christopher Edward Lumens 7c8918
+        mkfs.cramfs $CRAMBS $tmp $TMPDIR/${imagename}2.img.$$
Christopher Edward Lumens 7c8918
+    elif [ "$type" = "squashfs" ]; then
Christopher Edward Lumens 7c8918
+        echo "Running mksquashfs $tmp $TMPDIR/${imagename}2.img -all-root -no-fragments -no-progress"
Christopher Edward Lumens 7c8918
+        mksquashfs $tmp $TMPDIR/${imagename}2.img.$$ -all-root -no-fragments -no-progress
Christopher Edward Lumens 7c8918
+        chmod 0644 $TMPDIR/${imagename}2.img.$$
Christopher Edward Lumens 7c8918
+    fi
Christopher Edward Lumens 7c8918
+    cp $TMPDIR/${imagename}2.img.$$ $INSTIMGPATH/${imagename}2.img
Christopher Edward Lumens 7c8918
+    size=$(ls -l $INSTIMGPATH/${imagename}2.img | awk '{print $5}')
Christopher Edward Lumens 7c8918
+    size=$(expr $size / 1024)
Christopher Edward Lumens 7c8918
+    echo "Wrote $INSTIMGPATH/${imagename}2.img (${size}k)..."
Christopher Edward Lumens 7c8918
+    relpath=${INSTIMGPATH#$TOPDESTPATH/}
Christopher Edward Lumens 7c8918
+    echo "instimage = ${relpath}/${imagename}2.img" >> $TOPDESTPATH/.treeinfo
Christopher Edward Lumens 7c8918
+    rm -rf $tmp
Christopher Edward Lumens 7c8918
+}
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+makemainimage () {
Christopher Edward Lumens 7c8918
+    imagename=$1
Christopher Edward Lumens 7c8918
+    type=$2
Christopher Edward Lumens 7c8918
+    mmi_tmpimage=$TMPDIR/instimage.img.$$
Christopher Edward Lumens 7c8918
+    mmi_mntpoint=$TMPDIR/instimage.mnt.$$
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    rm -rf $mmi_tmpimage $mmi_mntpoint
Christopher Edward Lumens 7c8918
+    mkdir $mmi_mntpoint
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    if [ $type = "ext2" ]; then
Christopher Edward Lumens 7c8918
+        SIZE=$(du -sk $IMGPATH | awk '{ print int($1 * 1.1) }')
Christopher Edward Lumens 7c8918
+        if [ -d $IMGPATH/usr/lib/anaconda-runtime ]; then
Christopher Edward Lumens 7c8918
+            ERROR=$(du -sk $IMGPATH/usr/lib/anaconda-runtime | awk '{ print $1 }')
Christopher Edward Lumens 7c8918
+            SIZE=$(expr $SIZE - $ERROR)
Christopher Edward Lumens 7c8918
+        fi
Christopher Edward Lumens 7c8918
+        if [ -d $IMGPATH/usr/share/syslinux ]; then
Christopher Edward Lumens 7c8918
+            ERROR=$(du -sk $IMGPATH/usr/share/syslinux | awk '{ print $1 }')
Christopher Edward Lumens 7c8918
+            SIZE=$(expr $SIZE - $ERROR)
Christopher Edward Lumens 7c8918
+        fi
Christopher Edward Lumens 7c8918
+        dd if=/dev/zero bs=1k count=${SIZE} of=$mmi_tmpimage 2>/dev/null
Christopher Edward Lumens 7c8918
+        mke2fs -q -F $mmi_tmpimage > /dev/null
Christopher Edward Lumens 7c8918
+        tune2fs -c0 -i0 $mmi_tmpimage >/dev/null
Christopher Edward Lumens 7c8918
+        mount -o loop $mmi_tmpimage $mmi_mntpoint
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+        (cd $IMGPATH; find . |
Christopher Edward Lumens 7c8918
+            fgrep -v "./usr/lib/anaconda-runtime" |
Christopher Edward Lumens 7c8918
+            fgrep -v "./usr/share/syslinux"
Christopher Edward Lumens 7c8918
+            cpio -H crc -o) | (cd $mmi_mntpoint; cpio -iumd)
Christopher Edward Lumens 7c8918
+        makeproductfile $mmi_mntpoint
Christopher Edward Lumens 7c8918
+        umount $mmi_mntpoint
Christopher Edward Lumens 7c8918
+        rmdir $mmi_mntpoint
Christopher Edward Lumens 7c8918
+    elif [ $type = "squashfs" ]; then
Christopher Edward Lumens 7c8918
+        makeproductfile $IMGPATH
Christopher Edward Lumens 7c8918
+        echo "Running mksquashfs $IMGPATH $mmi_tmpimage -all-root -no-fragments -no-progress"
Christopher Edward Lumens 7c8918
+        mksquashfs $IMGPATH $mmi_tmpimage -all-root -no-fragments -no-progress
Christopher Edward Lumens 7c8918
+        chmod 0644 $mmi_tmpimage
Christopher Edward Lumens 7c8918
+        SIZE=$(expr `cat $mmi_tmpimage | wc -c` / 1024)
Christopher Edward Lumens 7c8918
+    elif [ $type = "cramfs" ]; then
Christopher Edward Lumens 7c8918
+        makeproductfile $IMGPATH
Christopher Edward Lumens 7c8918
+        echo "Running mkcramfs $CRAMBS $IMGPATH $mmi_tmpimage"
Christopher Edward Lumens 7c8918
+        mkfs.cramfs $CRAMBS $IMGPATH $mmi_tmpimage
Christopher Edward Lumens 7c8918
+        SIZE=$(expr `cat $mmi_tmpimage | wc -c` / 1024)
Christopher Edward Lumens 7c8918
+    fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    cp $mmi_tmpimage $INSTIMGPATH/${imagename}.img
Christopher Edward Lumens 7c8918
+    chmod 644 $INSTIMGPATH/${imagename}.img
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    echo "Wrote $INSTIMGPATH/${imagename}.img (${SIZE}k)"
Christopher Edward Lumens 7c8918
+    relpath=${INSTIMGPATH#$TOPDESTPATH/}
Christopher Edward Lumens 7c8918
+    echo "mainimage = ${relpath}/${imagename}.img" >> $TOPDESTPATH/.treeinfo
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+    rm $mmi_tmpimage
Christopher Edward Lumens 7c8918
+}
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+makeSecondStage() {
Christopher Edward Lumens 7c8918
+    echo "[stage2]" >> $TOPDESTPATH/.treeinfo
Christopher Edward Lumens 7c8918
+    echo "Building install.img"
Christopher Edward Lumens 7c8918
+    makemainimage "install" "squashfs"
Christopher Edward Lumens 7c8918
+    [ $? = 0 ] || exit 1
Christopher Edward Lumens 7c8918
+}
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+doPostImages() {
Christopher Edward Lumens 7c8918
+   /bin/true
Christopher Edward Lumens 7c8918
+}
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+# this gets overloaded if we're on an EFI-capable arch (... with grub)
Christopher Edward Lumens 7c8918
+makeEfiImages()
Christopher Edward Lumens 7c8918
+{
Christopher Edward Lumens 7c8918
+    /bin/true
Christopher Edward Lumens 7c8918
+}
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+# source the architecture specific mk-images file so we can call functions
Christopher Edward Lumens 7c8918
+# in it
Christopher Edward Lumens 7c8918
+if [ ${BUILDARCH} = s390x ]; then
Christopher Edward Lumens 7c8918
+    # FIXME: this is a bad hack for s390, but better than copying for now
Christopher Edward Lumens 7c8918
+    source $TOPDIR/mk-images.s390
Christopher Edward Lumens 7c8918
+elif [ ${BUILDARCH} = ppc64 ]; then
Christopher Edward Lumens 7c8918
+    # ... and similar for ppc64
Christopher Edward Lumens 7c8918
+    source $TOPDIR/mk-images.ppc
Christopher Edward Lumens 7c8918
+elif [ ${BUILDARCH} = "x86_64" -o ${BUILDARCH} = "i386" ]; then
Christopher Edward Lumens 7c8918
+    source $TOPDIR/mk-images.x86
Christopher Edward Lumens 7c8918
+    source $TOPDIR/mk-images.efi
Christopher Edward Lumens 7c8918
+else
Christopher Edward Lumens 7c8918
+    source $TOPDIR/mk-images.${BUILDARCH}
Christopher Edward Lumens 7c8918
+fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+# Find the kernel, unpack it, and verify it
Christopher Edward Lumens 7c8918
+kerneltags="kernel"
Christopher Edward Lumens 7c8918
+efiarch=""
Christopher Edward Lumens 7c8918
+arches="$BUILDARCH"
Christopher Edward Lumens 7c8918
+if [ "$BUILDARCH" = "ppc" ]; then
Christopher Edward Lumens 7c8918
+    arches="ppc64 ppc"
Christopher Edward Lumens 7c8918
+elif [ "$BUILDARCH" = "i386" ]; then
Christopher Edward Lumens 7c8918
+    arches="i586"
Christopher Edward Lumens 7c8918
+    efiarch="ia32"
Christopher Edward Lumens 7c8918
+    kerneltags="kernel kernel-PAE"
Christopher Edward Lumens 7c8918
+    kernelxen="kernel-PAE"
Christopher Edward Lumens 7c8918
+elif [ "$BUILDARCH" = "x86_64" ]; then
Christopher Edward Lumens 7c8918
+    kerneltags="kernel"
Christopher Edward Lumens 7c8918
+    efiarch="x64"
Christopher Edward Lumens 7c8918
+elif [ "$BUILDARCH" = "ia64" ]; then
Christopher Edward Lumens 7c8918
+    kerneltags="kernel"
Christopher Edward Lumens 7c8918
+    efiarch="ia64"
Christopher Edward Lumens 7c8918
+fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+foundakernel=""
Christopher Edward Lumens 7c8918
+for KERNELARCH in $arches; do
Christopher Edward Lumens 7c8918
+    for kernelvers in $kerneltags; do
Christopher Edward Lumens 7c8918
+        kpackage=$(findPackage $kernelvers)
Christopher Edward Lumens 7c8918
+        if [ "$KERNELARCH" = "i586" -a -z "$kpackage" ]; then
Christopher Edward Lumens 7c8918
+            echo "No i586 kernel, trying i686..."
Christopher Edward Lumens 7c8918
+            KERNELARCH="i686"
Christopher Edward Lumens 7c8918
+            kpackage=$(findPackage $kernelvers)
Christopher Edward Lumens 7c8918
+        fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+        if [ -z "$kpackage" ]; then
Christopher Edward Lumens 7c8918
+            echo "Unable to find kernel package $kernelvers"
Christopher Edward Lumens 7c8918
+            continue
Christopher Edward Lumens 7c8918
+        fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+        yumdownloader -c $yumconf --archlist=$KERNELARCH $kpackage
Christopher Edward Lumens 7c8918
+        kpackage="$kpackage.rpm"
Christopher Edward Lumens 7c8918
+        if [ ! -f "$kpackage" ]; then
Christopher Edward Lumens 7c8918
+            echo "kernel ($kernelvers) doesn't exist for $KERNELARCH.  skipping"
Christopher Edward Lumens 7c8918
+            continue
Christopher Edward Lumens 7c8918
+        fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+        KERNELROOT=$KERNELBASE/$KERNELARCH
Christopher Edward Lumens 7c8918
+        mkdir -p $KERNELROOT
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+        foundakernel="yes"
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+        if [ "$BUILDARCH" = "ia64" ]; then
Christopher Edward Lumens 7c8918
+            vmlinuz=$(rpm --nodigest --nosignature -qpl $kpackage |grep ^/boot/efi/EFI/redhat/vmlinuz | head -n 1)
Christopher Edward Lumens 7c8918
+            version=${vmlinuz##/boot/efi/EFI/redhat/vmlinuz-}
Christopher Edward Lumens 7c8918
+        else
Christopher Edward Lumens 7c8918
+            vmlinuz=$(rpm --nodigest --nosignature -qpl $kpackage |grep ^/boot/vmlinuz | head -n 1)
Christopher Edward Lumens 7c8918
+            version=${vmlinuz##/boot/vmlinuz-}
Christopher Edward Lumens 7c8918
+        fi
Christopher Edward Lumens 7c8918
+        arch=$(rpm --nodigest --nosignature --qf '%{ARCH}\n' -qp $kpackage)
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+        rpm2cpio $kpackage | (cd $KERNELROOT; cpio --quiet -iumd)
Christopher Edward Lumens 7c8918
+        rm -f $kpackage
Christopher Edward Lumens 7c8918
+        # expand out any available firmware too
Christopher Edward Lumens 7c8918
+        for p in $(repoquery -c $yumconf '*firmware*') ; do
Christopher Edward Lumens 7c8918
+            yumdownloader -c $yumconf $p
Christopher Edward Lumens 7c8918
+            rpm2cpio *firmware*.rpm | (cd $KERNELROOT; cpio --quiet -iumd)
Christopher Edward Lumens 7c8918
+            rm -f *firmware*.rpm
Christopher Edward Lumens 7c8918
+        done
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+        if [ ! -d "$KERNELROOT/lib/modules/$version" ]; then
Christopher Edward Lumens 7c8918
+            echo "$KERNELROOT/lib/modules/$version is not a valid modules directory" 2>&1
Christopher Edward Lumens 7c8918
+            exit 1
Christopher Edward Lumens 7c8918
+        fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+        if [ ! -f "$KERNELROOT/$KERNELDIR/${KERNELNAME}-$version" ]; then
Christopher Edward Lumens 7c8918
+            echo "$KERNELROOT/$KERNELDIR/${KERNELNAME}-$version does not exist"
Christopher Edward Lumens 7c8918
+            exit 1
Christopher Edward Lumens 7c8918
+        fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+        allmods=$(find $KERNELROOT/lib/modules/$version -name *.ko)
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+        rundepmod $KERNELROOT
Christopher Edward Lumens 7c8918
+        $GENMODINFO $KERNELROOT/lib/modules/$version > $MODINFO
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+        # make the boot images
Christopher Edward Lumens 7c8918
+        makeBootImages
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+        makeEfiImages $yumconf
Christopher Edward Lumens 7c8918
+    done
Christopher Edward Lumens 7c8918
+done
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+if [ -n "$foundakernel" ]; then
Christopher Edward Lumens 7c8918
+    makeSecondStage
Christopher Edward Lumens 7c8918
+    rm -rf $KERNELBASE
Christopher Edward Lumens 7c8918
+fi
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+doPostImages
Christopher Edward Lumens 7c8918
+
Christopher Edward Lumens 7c8918
+cd $TOPDIR
Christopher Edward Lumens 7c8918
diff -ruN anaconda-11.5.0.42.orig/scripts/mk-images.x86 anaconda-11.5.0.42/scripts/mk-images.x86
Christopher Edward Lumens 7c8918
--- anaconda-11.5.0.42.orig/scripts/mk-images.x86	2009-04-09 16:53:01.000000000 -0400
Christopher Edward Lumens 7c8918
+++ anaconda-11.5.0.42/scripts/mk-images.x86	2009-04-09 17:00:45.000000000 -0400
Christopher Edward Lumens 7c8918
@@ -159,15 +159,16 @@
Peter Jones 3dd6e4
     if [ -n "$BOOTISO" ]; then
Peter Jones 3dd6e4
         EFIARGS=""
Peter Jones 3dd6e4
         EFIGRAFT=""
Peter Jones 3dd6e4
-        if [ -f $TOPDESTPATH/images/pxeboot/efiboot.img ]; then
Peter Jones 3dd6e4
-            cp $TOPDESTPATH/images/pxeboot/efiboot.img $TOPDESTPATH/isolinux/efiboot.img
Peter Jones 3dd6e4
-            EFIARGS="-eltorito-alt-boot -e isolinux/efiboot.img -no-emul-boot"
Peter Jones 3dd6e4
-            EFIGRAFT="EFI/boot=$TOPDESTPATH/EFI/boot"
Peter Jones 3dd6e4
+        if [ -f $TOPDESTPATH/images/efiboot.img ]; then
Peter Jones 3dd6e4
+            echo "Found efiboot.img, making an EFI-capable boot.iso"
Peter Jones 3dd6e4
+            EFIARGS="-eltorito-alt-boot -e images/efiboot.img -no-emul-boot"
Peter Jones 3dd6e4
+            EFIGRAFT="EFI/BOOT=$TOPDESTPATH/EFI/BOOT"
Peter Jones 3dd6e4
+        else
Peter Jones 3dd6e4
+            echo "No efiboot.img found, making BIOS-only boot.iso"
Peter Jones 3dd6e4
         fi
Peter Jones 3dd6e4
         BIOSARGS="-b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table"
Peter Jones 3dd6e4
-        echo $PWD:\$ mkisofs -o $TOPDESTPATH/images/$BOOTISO $BIOSARGS $EFIARGS -R -J -V "$PRODUCT" -T -graft-points isolinux=$TOPDESTPATH/isolinux images/install.img=$TOPDESTPATH/images/install.img $EFIGRAFT
Peter Jones 3dd6e4
-        mkisofs -o $TOPDESTPATH/images/$BOOTISO $BIOSARGS $EFIARGS -R -J -V "$PRODUCT" -T -graft-points isolinux=$TOPDESTPATH/isolinux images/install.img=$TOPDESTPATH/images/install.img $EFIGRAFT
Peter Jones 3dd6e4
-        implantisomd5 $TOPDESTPATH/images/$BOOTISO
Peter Jones 3dd6e4
+        mkisocmd="mkisofs -v -o $TOPDESTPATH/images/$BOOTISO $BIOSARGS $EFIARGS -R -J -V "$PRODUCT" -T -graft-points isolinux=$TOPDESTPATH/isolinux images=$TOPDESTPATH/images $EFIGRAFT"
Peter Jones 3dd6e4
+        echo $PWD:\$ $mkisocmd
Peter Jones 3dd6e4
+	$mkisocmd
Peter Jones 3dd6e4
     fi
Peter Jones 3dd6e4
-
Peter Jones 3dd6e4
 }