3eb8ba9fa5736e73c96f46c59a6056958fdd906a
[libguestfs.git] / appliance / debian / modules / y0_install-guestfsd
1 #!/bin/bash -e
2 # install guestfsd specific stuff
3
4 # Kernel modules take up nearly half of the image.  Only include ones
5 # which are on the whitelist.
6 exec 5<../appliance/kmod.whitelist
7 whitelist=
8 while read kmod 0<&5; do
9     whitelist="$whitelist -a -not -name $kmod"
10 done
11 exec 5<&-
12
13 echo "Module whitelist: $whitelist"
14 find $DEBIRF_ROOT/lib/modules/*/kernel -name '*.ko' $whitelist -a -exec rm '{}' \;
15
16 # install additional packages:
17 PKGLIST=$(< packagelist)
18 echo "Will add $PKGLIST"
19 debirf_exec apt-get --assume-yes install $PKGLIST
20 debirf_exec apt-get --assume-yes remove vim-tiny dhcp3-client iptables
21
22 debirf_exec mkdir -p --mode=0777 /sysroot
23
24 # cleanup some other heavy lifters:
25 rm -rf "$DEBIRF_ROOT"/usr/share/doc/
26 rm -rf "$DEBIRF_ROOT"/usr/share/zoneinfo/
27 rm -rf "$DEBIRF_ROOT"/usr/share/man/
28
29 # Install the actual appliance:
30 echo $PWD
31 install -o root -g root -m 0755 ../daemon/guestfsd "$DEBIRF_ROOT"/sbin/guestfsd
32 install -o root -g root -m 0755 init "$DEBIRF_ROOT"/sbin/init