summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtestboot.sh41
1 files changed, 24 insertions, 17 deletions
diff --git a/testboot.sh b/testboot.sh
index 50b5ce0..8d6e18b 100755
--- a/testboot.sh
+++ b/testboot.sh
@@ -16,6 +16,7 @@ dracut_opts="${dracut_opts:---add anaconda --omit plymouth}"
network="${network:-default}"
vmname="${vmname:-testboot}"
compress=${compress:-$(type -P pigz || type -P xz)}
+rebuild="${rebuild:-false}"
[ "$compress" = "xz" ] && compress="xz --check-crc32 -1"
@@ -41,8 +42,8 @@ __EOT__
usecd="true"
usenet="true"
-ARGS=$(getopt --options "hdcstm:" \
- --longoptions "help,fromcd,nocd,virtconsole,serialconsole,text,dualnic,nonic,ram:"\
+ARGS=$(getopt --options "hdcsrtm:" \
+ --longoptions "help,fromcd,nocd,virtconsole,serialconsole,text,dualnic,nonic,rebuild,ram:"\
--name testboot.sh \
-- "$@") || exit 1
eval set -- "$ARGS"
@@ -50,12 +51,13 @@ while :; do case "$1" in
-h|--help) printhelp; exit 0;;
-d|--fromcd) fromcd="true"; shift;;
--nocd) usecd=""; shift;;
- --dualnic) dualnic="yes"; shift;;
- --nonic) dualnic=""; usenet=""; nonet="on"; shift;;
+ --dualnic) dualnic="true"; shift;;
+ --nonic) dualnic=""; usenet=""; nonet="true"; shift;;
-c|--virtconsole) console="--console pty"; shift;;
-s|--serialconsole) console="--serial pty"; shift;;
-t|--text) graphics="none"; shift;;
-m|--ram) ram="$2"; shift 2;;
+ -r|--rebuild) rebuild="true"; shift;;
--) shift; break;;
*) echo "getopt parse error"; exit 1 ;;
esac; done
@@ -111,7 +113,7 @@ initrd_cpio() {
# TODO: check for $dracutdir/dracut.sh and git pull otherwise
setup_dracut() {
- if ! [ -f $dracutdir/modules.d/80anaconda/parse-kickstart ]; then
+ if [ ! -f $dracutdir/modules.d/80anaconda/parse-kickstart ]; then
if [ ! -d $anacondadir/dracut ]; then
# TODO: git pull
echo "ERROR: can't find anaconda dracut module :/"
@@ -157,18 +159,23 @@ if [ "$fromcd" != "true" ]; then
# do we need to create the initramfs dir?
initrd="$dir/initrd.img"
if [ ! -d $dir/initramfs ]; then
- echo "rebuilding initramfs"
- setup_dracut
- (
- cd $dracutdir
- ./dracut.sh --local --no-compress --nomdadmconf --nolvmconf \
- --prefix /run/initramfs $dracut_opts \
- --force $dir/.initrd.cpio $kv
- ) || exit 1
- initrd_unpack $dir/.initrd.cpio $dir/initramfs
- cp $dir/initramfs.orig/.buildstamp $dir/initramfs/.buildstamp
- # force rebuild of initrd.img
- rm -rf $initrd
+ if [ "$rebuild" == "true" ]; then
+ echo "rebuilding initramfs"
+ setup_dracut
+ (
+ cd $dracutdir
+ ./dracut.sh --local --no-compress --nomdadmconf --nolvmconf \
+ --prefix /run/initramfs $dracut_opts \
+ --force $dir/.initrd.cpio $kv
+ ) || exit 1
+ initrd_unpack $dir/.initrd.cpio $dir/initramfs
+ cp $dir/initramfs.orig/.buildstamp $dir/initramfs/.buildstamp
+ # force rebuild of initrd.img
+ rm -rf $initrd
+ else
+ echo "copying initramfs"
+ cp -a $dir/initramfs.orig $dir/initramfs
+ fi
fi
# do we need to build initrd.img from initramfs?