ubuntu: Ignore packages in packagelist.in which are missing.
[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 from the package list, but
17 # only ones which exist in the repository
18 PKGLIST=
19 for pkg in $(< packagelist); do
20   if [ "$(debirf_exec apt-get -s install $pkg 3>&1 1>&2 2>&3 1>&- | grep '^E:' | wc -l)" -gt 0 ]; then
21     echo "Ignoring package $pkg, because it was not found in this repository."
22   else
23     PKGLIST="$PKGLIST $pkg"
24   fi
25 done
26 echo "Will add $PKGLIST"
27 debirf_exec apt-get --assume-yes install $PKGLIST
28 debirf_exec apt-get --assume-yes remove vim-tiny dhcp3-client iptables
29
30 debirf_exec mkdir -p --mode=0777 /sysroot
31
32 # cleanup some other heavy lifters:
33 rm -rf "$DEBIRF_ROOT"/usr/share/doc/
34 rm -rf "$DEBIRF_ROOT"/usr/share/zoneinfo/
35 rm -rf "$DEBIRF_ROOT"/usr/share/man/
36
37 # Install the actual appliance:
38 echo $PWD
39 install -o root -g root -m 0755 ../daemon/guestfsd "$DEBIRF_ROOT"/sbin/guestfsd
40 install -o root -g root -m 0755 init "$DEBIRF_ROOT"/sbin/init