X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=examples%2Fguestfs-test.sh;h=f253969f6b3d3defa12c1ac09ca1ec382e50027d;hb=82ce35c8f18003bb227a9dd3d2c4c912ce2148dc;hp=b45c1f47944947dcafaa5e58b35d24a5dae1bcc5;hpb=c7f1933cab6a4da2f201da741003ba2449c8bbde;p=febootstrap.git diff --git a/examples/guestfs-test.sh b/examples/guestfs-test.sh index b45c1f4..f253969 100755 --- a/examples/guestfs-test.sh +++ b/examples/guestfs-test.sh @@ -13,6 +13,8 @@ # This is a realistic example for 'libguestfs', which contains a # selection of command-line tools, LVM, NTFS and an NFS server. +set -e + if [ $(id -u) -eq 0 ]; then echo "Don't run this script as root. Read instructions in script first." exit 1 @@ -23,7 +25,7 @@ if [ ! -e vmlinuz -o ! -e guest-image ]; then exit 1 fi -../febootstrap \ +febootstrap \ -i bash \ -i coreutils \ -i lvm2 \ @@ -34,12 +36,14 @@ fi fedora-10 ./guestfs $1 echo -n "Before minimization: "; du -sh guestfs -../febootstrap-minimize --all ./guestfs +febootstrap-minimize --all ./guestfs echo -n "After minimization: "; du -sh guestfs # Create the /init which will scan for and enable all LVM volume groups. -( cd guestfs && cat > init <<'__EOF__' +create_init () +{ + cat > /init <<'__EOF__' #!/bin/sh PATH=/sbin:/usr/sbin:$PATH MAKEDEV mem null port zero core full ram tty console fd \ @@ -52,16 +56,18 @@ lvm vgscan --ignorelockingfailure lvm vgchange -ay --ignorelockingfailure /bin/bash -i __EOF__ -chmod +x init -) + chmod +x init +} +export -f create_init +febootstrap-run ./guestfs -- bash -c create_init # Convert the filesystem to an initrd image. -../febootstrap-to-initramfs ./guestfs > guestfs-initrd.img +febootstrap-to-initramfs ./guestfs > guestfs-initrd.img # Now run qemu to boot this guestfs system. qemu-system-$(arch) \ - -m 128 \ + -m 256 \ -kernel vmlinuz -initrd guestfs-initrd.img \ -hda guest-image -boot c