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.
18 if [ $(id -u) -eq 0 ]; then
19 echo "Don't run this script as root. Read instructions in script first."
23 if [ ! -e vmlinuz -o ! -e guest-image ]; then
24 echo "Read instructions in script first."
36 fedora-10 ./guestfs $1
38 echo -n "Before minimization: "; du -sh guestfs
39 febootstrap-minimize --all ./guestfs
40 echo -n "After minimization: "; du -sh guestfs
42 # Create the /init which will scan for and enable all LVM volume groups.
46 cat > /init <<'__EOF__'
48 PATH=/sbin:/usr/sbin:$PATH
49 MAKEDEV mem null port zero core full ram tty console fd \
50 hda hdb hdc hdd sda sdb sdc sdd loop sd
51 mount -t proc /proc /proc
52 mount -t sysfs /sys /sys
53 mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
54 modprobe sata_nv pata_acpi ata_generic
55 lvm vgscan --ignorelockingfailure
56 lvm vgchange -ay --ignorelockingfailure
62 febootstrap-run ./guestfs -- bash -c create_init
64 # Convert the filesystem to an initrd image.
66 febootstrap-to-initramfs ./guestfs > guestfs-initrd.img
68 # Now run qemu to boot this guestfs system.
72 -kernel vmlinuz -initrd guestfs-initrd.img \
73 -hda guest-image -boot c