summaryrefslogtreecommitdiffstats
path: root/appliance/debian/modules/y0_install-guestfsd
blob: 2d895a05e5d5cf0290cf1d8e9b019806716ff212 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash -e
# install guestfsd specific stuff

# Kernel modules take up nearly half of the image.  Only include ones
# which are on the whitelist.
exec 5<../appliance/kmod.whitelist
whitelist=
while read kmod 0<&5; do
    whitelist="$whitelist -a -not -name $kmod"
done
exec 5<&-

echo "Module whitelist: $whitelist"
find $DEBIRF_ROOT/lib/modules/*/kernel -name '*.ko' $whitelist -a -exec rm '{}' \;

# install additional packages from the package list, but
# only ones which exist in the repository
PKGLIST=
for pkg in $(< packagelist); do
  if [ "$(debirf_exec apt-get -s install $pkg 3>&1 1>&2 2>&3 1>&- | grep '^E:' | wc -l)" -gt 0 ]; then
    echo "Ignoring package $pkg, because it was not found in this repository."
  else
    PKGLIST="$PKGLIST $pkg"
  fi
done
echo "Will add $PKGLIST"
debirf_exec apt-get --assume-yes install $PKGLIST
debirf_exec apt-get --assume-yes remove vim-tiny dhcp3-client iptables

debirf_exec mkdir -p --mode=0777 /sysroot

# cleanup some other heavy lifters:
rm -rf "$DEBIRF_ROOT"/usr/share/doc/
rm -rf "$DEBIRF_ROOT"/usr/share/zoneinfo/
rm -rf "$DEBIRF_ROOT"/usr/share/man/

# Install the actual appliance:
echo $PWD
install -o root -g root -m 0755 ../daemon/guestfsd "$DEBIRF_ROOT"/sbin/guestfsd
install -o root -g root -m 0755 init "$DEBIRF_ROOT"/sbin/init