summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorBrian C. Lane <bcl@redhat.com>2011-03-09 15:46:30 -0800
committerBrian C. Lane <bcl@redhat.com>2011-03-11 08:12:39 -0800
commit61e660fe9846153e1de18f6434fdfc55054545e9 (patch)
tree3dac8cc19bfb99c62aa67f34dfc06fd3ed2fed0a /scripts
parenta4923ccaabb215af926531ec735387fd1291170b (diff)
downloadanaconda-61e660fe9846153e1de18f6434fdfc55054545e9.tar.gz
anaconda-61e660fe9846153e1de18f6434fdfc55054545e9.tar.xz
anaconda-61e660fe9846153e1de18f6434fdfc55054545e9.zip
Add cmdline options and f15 support to upd-bootiso
Add options to leave tmp directory, skip iso creation and specify an alternate destination directory. Added support for f15
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/upd-bootiso235
1 files changed, 139 insertions, 96 deletions
diff --git a/scripts/upd-bootiso b/scripts/upd-bootiso
index 456c20d4b..01be73b15 100755
--- a/scripts/upd-bootiso
+++ b/scripts/upd-bootiso
@@ -2,7 +2,7 @@
#
# upd-bootiso
#
-# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2010-2011 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,7 +19,8 @@
#
# Author: Brian C. Lane <bcl@redhat.com>
#
-# Update an existing boot.iso image with new anaconda rpm build
+# Update an existing installer iso image with new anaconda rpm build
+# This works for both the boot/netinstall and DVD .iso
#
# This likely only works with x86 iso's since doPostImages() was borrowed
# from mk-images.x86
@@ -58,41 +59,64 @@ abspath() {
echo `cd "$dir" && pwd -P`"$file"
}
+unpackRPMs() {
+ # Unpack the rpm's files into the tree
+ rpm2cpio $ANACONDA_RPM | cpio -idu
+
+ # Unpack any other rpms
+ for f in $EXTRA_RPMS; do
+ echo "Unpacking $f"
+ rpm2cpio $f | cpio -idu
+ done
+}
+
usage() {
if [ $1 -ne 0 ]; then
>&2
fi
- echo "upd-bootiso <boot.iso> <anaconda.rpm> [other.rpm] ..."
+ echo "upd-bootiso [--skipiso] [--leavetmp] [--dest /tmp] <boot.iso> <anaconda.rpm> [other.rpm] [...]"
+ echo " --skipiso Skip creating the final iso"
+ echo " --leavetmp Don't cleanup the /tmp/tmp.* directory"
+ echo " --dest /tmp Destination directory for final iso or image files"
exit $1
}
-[ -z "$1" -o -z "$2" ] && usage 1
[ "$1" == "--help" ] && usage 0
-if [ "$(id -u)" != "0" ]; then
- echo "You must be root to run this script"
- exit 1
-fi
-
-TMPDIR=$(mktemp -d)
-[ $? -eq 0 ] || exit 1
-
-#ORIG_ISO=$(readlink -f $1)
-#ANACONDA_RPM=$(readlink -f $2)
-
-ORIG_ISO=$(abspath $1)
-ANACONDA_RPM=$(abspath $2)
-shift 2;
-
-# Get the full path to any other rpms
-EXTRA_RPMS=""
-for f in $*; do
- EXTRA_RPMS="$EXTRA_RPMS$(abspath $f) "
+DEST="/tmp/"
+while [ $# -gt 0 ]; do
+ case $1 in
+ --skipiso)
+ SKIPISO=1
+ shift
+ ;;
+ --leavetmp)
+ LEAVETMP=1
+ shift
+ ;;
+ --dest)
+ DEST=$(abspath $2)
+ shift; shift
+ ;;
+ *)
+ if [ -z "$ORIG_ISO" ]; then
+ ORIG_ISO=$(abspath $1)
+ elif [ -z "$ANACONDA_RPM" ]; then
+ ANACONDA_RPM=$(abspath $1)
+ else
+ EXTRA_RPMS="$EXTRA_RPMS$(abspath $1) "
+ fi
+ shift
+ ;;
+ esac
done
+[ -z "$ORIG_ISO" -o -z "$ANACONDA_RPM" ] && usage 1
+
# Which anaconda release is this?
echo $ANACONDA_RPM | python -c 'import sys,os;exit(int(os.path.basename(sys.stdin.readline())[9:].split(".")[0]))'
VER=$?
+echo "VERSION is $VER"
# Figure out if this is a 64 bit system
# < 12 doesn't use lib64 directory
@@ -103,20 +127,55 @@ else
fi
echo "LIBDIR=$LIBDIR"
+if [ "$(id -u)" != "0" ]; then
+ echo "You must be root to run this script"
+ exit 1
+fi
+TMPDIR=$(mktemp -d)
+[ $? -eq 0 ] || exit 1
echo "Working in $TMPDIR"
pushd $TMPDIR
-# Extract the iso into newiso
echo "Extracting $ORIG_ISO to ./newiso/"
-mkdir ./iso.orig
-mount -o loop $ORIG_ISO ./iso.orig
+mkdir ./origiso
+mount -o loop $ORIG_ISO ./origiso
mkdir ./newiso
-rsync -a ./iso.orig/ ./newiso/
-umount ./iso.orig
+rsync -a ./origiso/ ./newiso/
+umount ./origiso
+
+echo "Extracting the initrd.img to ./newinitrd"
+mkdir ./newinitrd
+pushd ./newinitrd
+gunzip < ../newiso/isolinux/initrd.img | cpio -idu
+popd
+
+
+# Before f12 images/stage2.img held most of anaconda's files
+# but using squashfs 3.0 which v4.0 cannot read
+# From f12 to f14 it was images/install.img
+# After f14 it is all in isolinux/initrd.img
+
+if [ $VER -gt 14 ]; then
+ echo "Detected anaconda release 15+"
+ # Do f15 and later operations on ./newinitrd
+ pushd ./newinitrd
+ unpackRPMs
+
+ cp ./usr/share/anaconda/raidstart-stub ./usr/bin/raidstart
+ cp ./usr/share/anaconda/raidstop-stub ./usr/bin/raidstop
+ cp ./usr/share/anaconda/list-harddrives-stub ./usr/bin/list-harddrives
+ cp ./usr/share/anaconda/loadkeys-stub ./usr/bin/loadkeys
+ cp ./usr/$LIBDIR/python?.?/site-packages/pyanaconda/sitecustomize.py ./usr/$LIBDIR/python?.?/site-packages
+
+ # Copy loader to the initrd
+ cp ./usr/$LIBDIR/anaconda/loader ../newinitrd/sbin/
+ cp ./usr/share/anaconda/loader.tr ../newinitrd/etc/
+ cp ./usr/$LIBDIR/anaconda/init ../newinitrd/sbin/
-# Update the install.img with new anaconda files
-if [ $VER -gt 11 ]; then
+ # non-standard, used for debugging stage1 problems
+ cp ./usr/bin/{ls,cat,less} ../newinitrd/sbin/
+elif [ $VER -gt 11 ]; then
echo "Extracting ./newiso/images/install.img to ./newinstall/"
mkdir ./install
mount -o loop ./newiso/images/install.img install/
@@ -125,20 +184,13 @@ if [ $VER -gt 11 ]; then
umount ./install
pushd ./newinstall
- rpm2cpio $ANACONDA_RPM | cpio -idu
-
- # Unpack any other rpms
- for f in $EXTRA_RPMS; do
- echo "Unpacking $f"
- rpm2cpio $f | cpio -idu
- done
+ unpackRPMs
if [ $VER -gt 13 ]; then
- echo "Detected anaconda release 14+"
- # >= anaconda-14.* do this
+ echo "Detected anaconda release 14"
+ # = anaconda-14.* do this
cp ./usr/share/anaconda/raidstart-stub ./usr/bin/raidstart
cp ./usr/share/anaconda/raidstop-stub ./usr/bin/raidstop
- cp ./usr/share/anaconda/losetup-stub ./usr/bin/losetup
cp ./usr/share/anaconda/list-harddrives-stub ./usr/bin/list-harddrives
cp ./usr/share/anaconda/loadkeys-stub ./usr/bin/loadkeys
cp ./usr/share/anaconda/mknod-stub ./usr/bin/mknod
@@ -159,83 +211,74 @@ if [ $VER -gt 11 ]; then
cp ./usr/sbin/anaconda ./usr/bin/anaconda
cp ./usr/$LIBDIR/anaconda-runtime/lib* ./usr/lib
cp ./usr/$LIBDIR/anaconda/sitecustomize.py ./usr/lib/python?.?/site-packages
- else
- # Note this is for reference, it won't ever get here
- # <= 11 do this
- cp ./usr/lib/anaconda/raidstart-stub ./usr/bin/raidstart
- cp ./usr/lib/anaconda/raidstop-stub ./usr/bin/raidstop
- cp ./usr/lib/anaconda/losetup-stub ./usr/bin/losetup
- cp ./usr/lib/anaconda/pump-stub ./usr/bin/pump
- cp ./usr/lib/anaconda/list-harddrives-stub ./usr/bin/list-harddrives
- cp ./usr/lib/anaconda/kudzu-probe-stub ./usr/bin/kudzu-probe
- cp ./usr/lib/anaconda/loadkeys-stub ./usr/bin/loadkeys
- cp ./usr/lib/anaconda/mknod-stub ./usr/bin/mknod
- cp ./usr/lib/anaconda/syslogd-stub ./usr/bin/syslogd
- cp ./usr/sbin/anaconda ./usr/bin/anaconda
- cp ./usr/lib/anaconda-runtime/lib* ./usr/$LIBDIR
fi
- popd
+
+ # Copy loader to the initrd
+ cp ./usr/$LIBDIR/anaconda/loader ../newinitrd/sbin/
+ cp ./usr/share/anaconda/loader.tr ../newinitrd/etc/
+ cp ./usr/$LIBDIR/anaconda/init ../newinitrd/sbin/
+
+ # non-standard, used for debugging stage1 problems
+ cp ./usr/bin/{ls,cat,less} ../newinitrd/sbin/
else
echo "Cannot update stage2.img (old squashfs version). Only updating initrd"
mkdir ./newinstall
pushd ./newinstall
- rpm2cpio $ANACONDA_RPM | cpio -idu
+ unpackRPMs
- # Unpack any other rpms
- for f in $EXTRA_RPMS; do
- echo "Unpacking $f"
- rpm2cpio $f | cpio -idu
- done
- popd
-fi
-
-# Extract the initrd.img to newtree
-echo "Extracting the initrd.img to ./newtree"
-mkdir ./newtree
-gunzip < ./newiso/isolinux/initrd.img > ./initrd
-
-pushd ./newtree
-cpio -idu < ../initrd
-
-# Copy over files from anaconda
-if [ $VER -gt 11 ]; then
- cp ../newinstall/usr/$LIBDIR/anaconda/loader ./sbin/
- cp ../newinstall/usr/share/anaconda/loader.tr ./etc/
- cp ../newinstall/usr/$LIBDIR/anaconda/init ./sbin/
+ # Copy loader to the initrd
+ cp ./usr/lib/anaconda-runtime/loader/loader ../newinitrd/sbin/
+ cp ./usr/lib/anaconda-runtime/loader/loader.tr ../newinitrd/etc/
+ cp ./usr/lib/anaconda-runtime/loader/init ../newinitrd/sbin/
# non-standard, used for debugging stage1 problems
- cp ../newinstall/usr/bin/{ls,cat,less} ./sbin/
-else
- cp ../newinstall/usr/lib/anaconda-runtime/loader/loader ./sbin/
- cp ../newinstall/usr/lib/anaconda-runtime/loader/loader.tr ./etc/
- cp ../newinstall/usr/lib/anaconda-runtime/loader/init ./sbin/
+ cp ./usr/bin/{ls,cat,less} ../newinitrd/sbin/
fi
-
+popd
# Create the new initrd.img
+pushd ./newinitrd
find . |cpio --quiet -c -o | gzip -9 > ../initrd.img
popd
-# Stuff new initrd.img into the newiso tree
+# Stuff new initrd.img into the newiso tree
find ./newiso/ -iname initrd.img -exec cp initrd.img {} \;
-# Make a new install.img
-if [ $VER -gt 11 ]; then
+# Make a new install.img if needed (f12 thru f14)
+if [ $VER -gt 11 -a $VER -lt 15 ]; then
echo "Create new install.img"
mksquashfs ./newinstall install.img -all-root -no-fragments -no-progress
find ./newiso/ -iname install.img -exec cp install.img {} \;
fi
-# Make a new boot.iso image
-BOOTISO="./new-boot.iso"
-TOPDESTPATH="./newiso"
-CDLABEL="Fedora"
-rm $TOPDESTPATH/isolinux/boot.cat
-echo "Build new iso"
-doPostImages
+if [ -z $SKIPISO ]; then
+ # Make a new .iso image
+ BOOTISO="./new.iso"
+ TOPDESTPATH="./newiso"
+ CDLABEL="Fedora"
+ rm $TOPDESTPATH/isolinux/boot.cat
+ echo "Build new iso"
+ doPostImages
-mv new-boot.iso /tmp/
-echo "new-boot.iso is in /tmp/"
+ mv new.iso $DEST
+ echo "new.iso is in $DEST"
+else
+ cp initrd.img $DEST
+ if [ -f "install.img" ]; then
+ cp install.img $DEST
+ fi
+fi
+
+# Exit $TMPDIR
popd
-rm -rf $TMPDIR
+if [ -z $LEAVETMP ]; then
+ rm -rf $TMPDIR
+fi
+
+if [ $VER -lt 12 ]; then
+ echo "WARNING: stage2.img was not updated due to older squashfs version."
+ echo "WARNING: Only the initrd.img was updated."
+fi
+
+exit 0