3 # Before running, make sure 'vmlinuz' in this examples directory is a
4 # bootable Linux kernel or a symlink to one. You can just use any
5 # kernel out of the /boot directory for this.
9 # ln -s /boot/vmlinuz-NNN vmlinuz
11 # Also make 'guest-image' be a symlink to a virtual machine disk image.
13 # This is a realistic example for 'libguestfs', which contains a
14 # selection of command-line tools, LVM, NTFS and an NFS server.
16 if [ $(id -u) -eq 0 ]; then
17 echo "Don't run this script as root. Read instructions in script first."
21 if [ ! -e vmlinuz -o ! -e guest-image ]; then
22 echo "Read instructions in script first."
34 fedora-10 ./guestfs $1
36 echo -n "Before minimization: "; du -sh guestfs
37 ../febootstrap-minimize --all ./guestfs
38 echo -n "After minimization: "; du -sh guestfs
40 # Create the /init which will scan for and enable all LVM volume groups.
42 ( cd guestfs && cat > init <<'__EOF__'
44 PATH=/sbin:/usr/sbin:$PATH
45 MAKEDEV mem null port zero core full ram tty console fd \
46 hda hdb hdc hdd sda sdb sdc sdd loop sd
47 mount -t proc /proc /proc
48 mount -t sysfs /sys /sys
49 mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
50 modprobe sata_nv pata_acpi ata_generic
51 lvm vgscan --ignorelockingfailure
52 lvm vgchange -ay --ignorelockingfailure
58 # Convert the filesystem to an initrd image.
60 ../febootstrap-to-initramfs ./guestfs > guestfs-initrd.img
62 # Now run qemu to boot this guestfs system.
66 -kernel vmlinuz -initrd guestfs-initrd.img \
67 -hda guest-image -boot c