5 apt-get
-y install --no-install-recommends \
26 if [ -n "$INCLUDE_VK_CTS" ]; then
27 apt-get
install -y libvulkan1
35 export PS1=lava-shell:
40 #######################################################################
41 # Strip the image to a small minimal system without removing the debian
44 # xz compress firmware so it doesn't waste RAM at runtime.
45 find /lib
/firmware
-type f
-print0 | \
46 xargs -0r -P4 -n4 xz
-T1 -C crc32
48 # Copy timezone file and remove tzdata package
50 cp /usr
/share
/zoneinfo
/Etc
/UTC
/etc
/localtime
52 UNNEEDED_PACKAGES
="libfdisk1
56 export DEBIAN_FRONTEND
=noninteractive
58 # Removing unused packages
59 for PACKAGE
in ${UNNEEDED_PACKAGES}
62 if ! apt-get remove
--purge --yes "${PACKAGE}"
64 echo "WARNING: ${PACKAGE} isn't installed"
68 apt-get autoremove
--yes || true
73 # Dropping documentation, localization, i18n files, etc
74 rm -rf /usr
/share
/doc
/*
75 rm -rf /usr
/share
/locale
/*
76 rm -rf /usr
/share
/X11
/locale
/*
78 rm -rf /usr
/share
/i18n
/*
79 rm -rf /usr
/share
/info
/*
80 rm -rf /usr
/share
/lintian
/*
81 rm -rf /usr
/share
/common-licenses
/*
82 rm -rf /usr
/share
/mime
/*
84 # Dropping reportbug scripts
87 # Drop udev hwdb not required on a stripped system
88 rm -rf /lib
/udev
/hwdb.bin
/lib
/udev
/hwdb.d
/*
90 # Drop all gconv conversions && binaries
92 rm -rf usr
/sbin
/iconvconfig
93 rm -rf usr
/lib
/*/gconv
/
95 # Remove libusb database
96 rm -rf usr
/sbin
/update-usbids
97 rm -rf var
/lib
/usbutils
/usb.ids
98 rm -rf usr
/share
/misc
/usb.ids
100 #######################################################################
101 # Crush into a minimal production image to be deployed via some type of image
103 # IMPORTANT: The Debian system is not longer functional at this point,
104 # for example, apt and dpkg will stop working
106 UNNEEDED_PACKAGES
="apt libapt-pkg6.0 "\
107 "ncurses-bin ncurses-base libncursesw6 libncurses6 "\
109 "debconf libdebconfclient0 "\
110 "e2fsprogs e2fslibs libfdisk1 "\
113 "init-system-helpers "\
118 "libsemanage1 libsemanage-common "\
123 "debian-archive-keyring "\
129 "libgles2-mesa-dev "\
134 # Removing unneeded packages
135 for PACKAGE
in ${UNNEEDED_PACKAGES}
137 echo "Forcing removal of ${PACKAGE}"
138 if ! dpkg
--purge --force-remove-essential --force-depends "${PACKAGE}"
140 echo "WARNING: ${PACKAGE} isn't installed"
144 # Show what's left package-wise before dropping dpkg itself
145 COLUMNS
=300 dpkg-query
-W --showformat='${Installed-Size;10}\t${Package}\n' |
sort -k1,1n
148 dpkg
--purge --force-remove-essential --force-depends dpkg
150 # No apt or dpkg, no need for its configuration archives
154 # Drop directories not part of ostree
155 # Note that /var needs to exist as ostree bind mounts the deployment /var over
157 rm -rf var
/* opt srv share
159 # ca-certificates are in /etc drop the source
160 rm -rf usr
/share
/ca-certificates
162 # No bash, no need for completions
163 rm -rf usr
/share
/bash-completion
165 # No zsh, no need for comletions
166 rm -rf usr
/share
/zsh
/vendor-completions
168 # drop gcc-6 python helpers
169 rm -rf usr
/share
/gcc-6
171 # Drop sysvinit leftovers
173 rm -rf etc
/rc
[0-6S].d
175 # Drop upstart helpers
178 # Various xtables helpers
179 rm -rf usr
/lib
/xtables
182 # TODO: only remaining locale is actually "C". Should we really remove it?
183 rm -rf usr
/lib
/locale
/*
186 rm -rf usr
/sbin
/*fdisk
189 rm -rf usr
/bin
/localedef
191 # Systemd dns resolver
192 find usr etc
-name '*systemd-resolve*' -prune -exec rm -r {} \
;
194 # Systemd network configuration
195 find usr etc
-name '*networkd*' -prune -exec rm -r {} \
;
198 find usr etc
-name '*timesyncd*' -prune -exec rm -r {} \
;
200 # systemd hw database manager
201 find usr etc
-name '*systemd-hwdb*' -prune -exec rm -r {} \
;
204 find usr etc
-name '*fuse*' -prune -exec rm -r {} \
;
206 # lsb init function leftovers
209 # Only needed when adding libraries
210 rm -rf usr
/sbin
/ldconfig
*
215 # Remove pam module to authenticate against a DB
216 # plus libdb-5.3.so that is only used by this pam module
217 rm -rf usr
/lib
/*/security
/pam_userdb.so
218 rm -rf usr
/lib
/*/libdb-5.3.so
220 # remove NSS support for nis, nisplus and hesiod
221 rm -rf usr
/lib
/*/libnss_hesiod
*
222 rm -rf usr
/lib
/*/libnss_nis
*