5 apt-get
-y install --no-install-recommends \
27 if [ -n "$INCLUDE_VK_CTS" ]; then
28 apt-get
install -y libvulkan1
36 export PS1=lava-shell:
41 mkdir
-p /lib
/firmware
/rtl_nic
42 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
44 #######################################################################
45 # Strip the image to a small minimal system without removing the debian
48 # xz compress firmware so it doesn't waste RAM at runtime. Except db820c's
49 # GPU firmware, due to using a precompiled kernel without compression support.
50 find /lib
/firmware
-type f
-print0 | \
52 xargs -0r -P4 -n4 xz
-T1 -C crc32
53 ln -s /lib
/firmware
/qcom
/a530
* /lib
/firmware
/
55 # Copy timezone file and remove tzdata package
57 cp /usr
/share
/zoneinfo
/Etc
/UTC
/etc
/localtime
59 UNNEEDED_PACKAGES
="libfdisk1
63 export DEBIAN_FRONTEND
=noninteractive
65 # Removing unused packages
66 for PACKAGE
in ${UNNEEDED_PACKAGES}
69 if ! apt-get remove
--purge --yes "${PACKAGE}"
71 echo "WARNING: ${PACKAGE} isn't installed"
75 apt-get autoremove
--yes || true
80 # Dropping documentation, localization, i18n files, etc
81 rm -rf /usr
/share
/doc
/*
82 rm -rf /usr
/share
/locale
/*
83 rm -rf /usr
/share
/X11
/locale
/*
85 rm -rf /usr
/share
/i18n
/*
86 rm -rf /usr
/share
/info
/*
87 rm -rf /usr
/share
/lintian
/*
88 rm -rf /usr
/share
/common-licenses
/*
89 rm -rf /usr
/share
/mime
/*
91 # Dropping reportbug scripts
94 # Drop udev hwdb not required on a stripped system
95 rm -rf /lib
/udev
/hwdb.bin
/lib
/udev
/hwdb.d
/*
97 # Drop all gconv conversions && binaries
99 rm -rf usr
/sbin
/iconvconfig
100 rm -rf usr
/lib
/*/gconv
/
102 # Remove libusb database
103 rm -rf usr
/sbin
/update-usbids
104 rm -rf var
/lib
/usbutils
/usb.ids
105 rm -rf usr
/share
/misc
/usb.ids
107 #######################################################################
108 # Crush into a minimal production image to be deployed via some type of image
110 # IMPORTANT: The Debian system is not longer functional at this point,
111 # for example, apt and dpkg will stop working
113 UNNEEDED_PACKAGES
="apt libapt-pkg6.0 "\
114 "ncurses-bin ncurses-base libncursesw6 libncurses6 "\
116 "debconf libdebconfclient0 "\
117 "e2fsprogs e2fslibs libfdisk1 "\
120 "init-system-helpers "\
125 "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
*