5 apt-get
-y install --no-install-recommends \
28 if [ -n "$INCLUDE_VK_CTS" ]; then
29 apt-get
install -y libvulkan1
37 export PS1=lava-shell:
42 mkdir
-p /lib
/firmware
/rtl_nic
43 wget https
://git.kernel.org
/pub
/scm
/linux
/kernel
/git
/firmware
/linux-firmware.git
/tree
/rtl_nic
/rtl8153a-3.fw
-O /lib
/firmware
/rtl_nic
/rtl8153a-3.fw
45 #######################################################################
46 # Strip the image to a small minimal system without removing the debian
49 # xz compress firmware so it doesn't waste RAM at runtime. Except db820c's
50 # GPU firmware, due to using a precompiled kernel without compression support.
51 find /lib
/firmware
-type f
-print0 | \
53 xargs -0r -P4 -n4 xz
-T1 -C crc32
54 ln -s /lib
/firmware
/qcom
/a530
* /lib
/firmware
/
56 # Copy timezone file and remove tzdata package
58 cp /usr
/share
/zoneinfo
/Etc
/UTC
/etc
/localtime
60 UNNEEDED_PACKAGES
="libfdisk1
64 export DEBIAN_FRONTEND
=noninteractive
66 # Removing unused packages
67 for PACKAGE
in ${UNNEEDED_PACKAGES}
70 if ! apt-get remove
--purge --yes "${PACKAGE}"
72 echo "WARNING: ${PACKAGE} isn't installed"
76 apt-get autoremove
--yes || true
81 # Dropping documentation, localization, i18n files, etc
82 rm -rf /usr
/share
/doc
/*
83 rm -rf /usr
/share
/locale
/*
84 rm -rf /usr
/share
/X11
/locale
/*
86 rm -rf /usr
/share
/i18n
/*
87 rm -rf /usr
/share
/info
/*
88 rm -rf /usr
/share
/lintian
/*
89 rm -rf /usr
/share
/common-licenses
/*
90 rm -rf /usr
/share
/mime
/*
92 # Dropping reportbug scripts
95 # Drop udev hwdb not required on a stripped system
96 rm -rf /lib
/udev
/hwdb.bin
/lib
/udev
/hwdb.d
/*
98 # Drop all gconv conversions && binaries
100 rm -rf usr
/sbin
/iconvconfig
101 rm -rf usr
/lib
/*/gconv
/
103 # Remove libusb database
104 rm -rf usr
/sbin
/update-usbids
105 rm -rf var
/lib
/usbutils
/usb.ids
106 rm -rf usr
/share
/misc
/usb.ids
108 #######################################################################
109 # Crush into a minimal production image to be deployed via some type of image
111 # IMPORTANT: The Debian system is not longer functional at this point,
112 # for example, apt and dpkg will stop working
114 UNNEEDED_PACKAGES
="apt libapt-pkg6.0 "\
115 "ncurses-bin ncurses-base libncursesw6 libncurses6 "\
117 "debconf libdebconfclient0 "\
118 "e2fsprogs e2fslibs libfdisk1 "\
121 "init-system-helpers "\
126 "libsemanage1 libsemanage-common "\
131 "debian-archive-keyring "\
137 "libgles2-mesa-dev "\
142 # Removing unneeded packages
143 for PACKAGE
in ${UNNEEDED_PACKAGES}
145 echo "Forcing removal of ${PACKAGE}"
146 if ! dpkg
--purge --force-remove-essential --force-depends "${PACKAGE}"
148 echo "WARNING: ${PACKAGE} isn't installed"
152 # Show what's left package-wise before dropping dpkg itself
153 COLUMNS
=300 dpkg-query
-W --showformat='${Installed-Size;10}\t${Package}\n' |
sort -k1,1n
156 dpkg
--purge --force-remove-essential --force-depends dpkg
158 # No apt or dpkg, no need for its configuration archives
162 # Drop directories not part of ostree
163 # Note that /var needs to exist as ostree bind mounts the deployment /var over
165 rm -rf var
/* opt srv share
167 # ca-certificates are in /etc drop the source
168 rm -rf usr
/share
/ca-certificates
170 # No bash, no need for completions
171 rm -rf usr
/share
/bash-completion
173 # No zsh, no need for comletions
174 rm -rf usr
/share
/zsh
/vendor-completions
176 # drop gcc-6 python helpers
177 rm -rf usr
/share
/gcc-6
179 # Drop sysvinit leftovers
181 rm -rf etc
/rc
[0-6S].d
183 # Drop upstart helpers
186 # Various xtables helpers
187 rm -rf usr
/lib
/xtables
190 # TODO: only remaining locale is actually "C". Should we really remove it?
191 rm -rf usr
/lib
/locale
/*
194 rm -rf usr
/sbin
/*fdisk
197 rm -rf usr
/bin
/localedef
199 # Systemd dns resolver
200 find usr etc
-name '*systemd-resolve*' -prune -exec rm -r {} \
;
202 # Systemd network configuration
203 find usr etc
-name '*networkd*' -prune -exec rm -r {} \
;
206 find usr etc
-name '*timesyncd*' -prune -exec rm -r {} \
;
208 # systemd hw database manager
209 find usr etc
-name '*systemd-hwdb*' -prune -exec rm -r {} \
;
212 find usr etc
-name '*fuse*' -prune -exec rm -r {} \
;
214 # lsb init function leftovers
217 # Only needed when adding libraries
218 rm -rf usr
/sbin
/ldconfig
*
223 # Remove pam module to authenticate against a DB
224 # plus libdb-5.3.so that is only used by this pam module
225 rm -rf usr
/lib
/*/security
/pam_userdb.so
226 rm -rf usr
/lib
/*/libdb-5.3.so
228 # remove NSS support for nis, nisplus and hesiod
229 rm -rf usr
/lib
/*/libnss_hesiod
*
230 rm -rf usr
/lib
/*/libnss_nis
*