X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=make-initramfs.sh.in;h=aaaa92ef22eb0e46fa6ce91bb70ec048885e2b3f;hb=15dbb6973a7af11b81df047194228ea86d46939b;hp=fe3635d8fe3db3064b3b6a880662d1d23d701de3;hpb=8c07ad6191e2a13cf240a47dbed72afdc4010aa4;p=libguestfs.git diff --git a/make-initramfs.sh.in b/make-initramfs.sh.in index fe3635d..aaaa92e 100755 --- a/make-initramfs.sh.in +++ b/make-initramfs.sh.in @@ -34,7 +34,8 @@ fi # Decide on names for the final output. These have to match Makefile.am. output=initramfs.@REPO@.@host_cpu@.img koutput=vmlinuz.@REPO@.@host_cpu@ -rm -f $output $koutput +rm -f $output +rm -f $koutput # Create the basic initramfs. @FEBOOTSTRAP@ $modules @REPO@ initramfs @MIRROR@ @@ -47,7 +48,7 @@ find initramfs -name '*python*' -print0 | xargs -0 rm -rf # Modules take up nearly half of the image. It's a rough guess that # we don't need any drivers (which take up most of the space). # (We need to keep kernel/net/sunrpc for NFS) -rm -rf initramfs/lib/modules/*/kernel/{drivers,sound} +#rm -rf initramfs/lib/modules/*/kernel/{drivers,sound} rm -rf initramfs/lib/modules/*/kernel/arch/x86/kvm # Pull the kernel out into the current directory. We don't want it in @@ -60,21 +61,21 @@ rm -rf initramfs/boot # Add some missing configuration files. if [ ! -f initramfs/etc/hosts ]; then - cat > initramfs/etc/hosts <<'__EOF__' + cat > initramfs/etc/hosts.new <<'__EOF__' 127.0.0.1 guestfs localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 __EOF__ + @FEBOOTSTRAP_RUN@ initramfs -- \ + install -m 0644 -o root -g root /etc/hosts.new /etc/hosts + rm initramfs/etc/hosts.new fi if [ ! -f initramfs/etc/fstab ]; then - touch initramfs/etc/fstab + @FEBOOTSTRAP_RUN@ initramfs -- touch /etc/fstab fi -# Copy the daemon into the filesystem. -#cp daemon/guestfsd initramfs/sbin - # Create the init script. -cat > initramfs/init <<'__EOF__' +cat > initramfs/init.new <<'__EOF__' #!/bin/sh PATH=/sbin:/usr/sbin:$PATH MAKEDEV mem null port zero core full ram tty console fd \ @@ -93,13 +94,20 @@ rpc.mountd __EOF__ if [ "x$debug" != "xyes" ]; then - echo exec guestfsd -f >> initramfs/init + echo exec guestfsd -f >> initramfs/init.new else - echo guestfsd >> initramfs/init - echo exec bash -i >> initramfs/init + echo guestfsd >> initramfs/init.new + echo exec bash -i >> initramfs/init.new fi -chmod +x initramfs/init +@FEBOOTSTRAP_RUN@ initramfs -- install -m 0755 -o root -g root /init.new /init +rm initramfs/init.new + +# Copy the daemon into the filesystem. +cp @abs_builddir@/daemon/guestfsd initramfs/sbin/guestfsd.new +@FEBOOTSTRAP_RUN@ initramfs -- \ + install -m 0755 -o root -g root /sbin/guestfsd.new /sbin/guestfsd +rm initramfs/sbin/guestfsd.new # Generate final image. @FEBOOTSTRAP_TO_INITRAMFS@ initramfs > $output-t