Version 2.11.
[febootstrap.git] / examples / guestfs-test.sh
index f487f50..f253969 100755 (executable)
@@ -25,7 +25,7 @@ if [ ! -e vmlinuz -o ! -e guest-image ]; then
     exit 1
 fi
 
-../febootstrap \
+febootstrap \
     -i bash \
     -i coreutils \
     -i lvm2 \
@@ -36,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 \
@@ -54,12 +56,14 @@ 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.