5 apt-get
-y install --no-install-recommends \
19 if [ -n "$INCLUDE_VK_CTS" ]; then
20 apt-get
install -y libvulkan1
28 export PS1=lava-shell:
33 mkdir
-p /lib
/firmware
/rtl_nic
34 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
36 #######################################################################
37 # Strip the image to a small minimal system without removing the debian
40 # xz compress firmware so it doesn't waste RAM at runtime. Except db820c's
41 # GPU firmware, due to using a precompiled kernel without compression support.
42 find /lib
/firmware
-type f
-print0 | \
44 xargs -0r -P4 -n4 xz
-T1 -C crc32
45 ln -s /lib
/firmware
/qcom
/a530
* /lib
/firmware
/
47 # Copy timezone file and remove tzdata package
49 cp /usr
/share
/zoneinfo
/Etc
/UTC
/etc
/localtime
51 UNNEEDED_PACKAGES
="libfdisk1
55 export DEBIAN_FRONTEND
=noninteractive
57 # Removing unused packages
58 for PACKAGE
in ${UNNEEDED_PACKAGES}
61 if ! apt-get remove
--purge --yes "${PACKAGE}"
63 echo "WARNING: ${PACKAGE} isn't installed"
67 apt-get autoremove
--yes || true
72 # Dropping documentation, localization, i18n files, etc
73 rm -rf /usr
/share
/doc
/*
74 rm -rf /usr
/share
/locale
/*
76 rm -rf /usr
/share
/i18n
/*
77 rm -rf /usr
/share
/info
/*
78 rm -rf /usr
/share
/lintian
/*
79 rm -rf /usr
/share
/common-licenses
/*
80 rm -rf /usr
/share
/mime
/*
82 # Dropping reportbug scripts
85 # Drop udev hwdb not required on a stripped system
86 rm -rf /lib
/udev
/hwdb.bin
/lib
/udev
/hwdb.d
/*
88 # Drop all gconv conversions && binaries
90 rm -rf usr
/sbin
/iconvconfig
91 rm -rf usr
/lib
/*/gconv
/
93 # Remove libusb database
94 rm -rf usr
/sbin
/update-usbids
95 rm -rf var
/lib
/usbutils
/usb.ids
96 rm -rf usr
/share
/misc
/usb.ids
98 #######################################################################
99 # Crush into a minimal production image to be deployed via some type of image
101 # IMPORTANT: The Debian system is not longer functional at this point,
102 # for example, apt and dpkg will stop working
104 UNNEEDED_PACKAGES
="apt libapt-pkg6.0 "\
105 "ncurses-bin ncurses-base libncursesw6 libncurses6 "\
107 "debconf libdebconfclient0 "\
108 "e2fsprogs e2fslibs libfdisk1 "\
111 "init-system-helpers "\
116 "libsemanage1 libsemanage-common "\
121 "debian-archive-keyring "\
123 # Removing unneeded packages
124 for PACKAGE
in ${UNNEEDED_PACKAGES}
126 echo "Forcing removal of ${PACKAGE}"
127 if ! dpkg
--purge --force-remove-essential --force-depends "${PACKAGE}"
129 echo "WARNING: ${PACKAGE} isn't installed"
133 # Show what's left package-wise before dropping dpkg itself
134 COLUMNS
=300 dpkg-query
-W --showformat='${Installed-Size;10}\t${Package}\n' |
sort -k1,1n
137 dpkg
--purge --force-remove-essential --force-depends dpkg
139 # No apt or dpkg, no need for its configuration archives
143 # Drop directories not part of ostree
144 # Note that /var needs to exist as ostree bind mounts the deployment /var over
146 rm -rf var
/* opt srv share
148 # ca-certificates are in /etc drop the source
149 rm -rf usr
/share
/ca-certificates
151 # No bash, no need for completions
152 rm -rf usr
/share
/bash-completion
154 # No zsh, no need for comletions
155 rm -rf usr
/share
/zsh
/vendor-completions
157 # drop gcc-6 python helpers
158 rm -rf usr
/share
/gcc-6
160 # Drop sysvinit leftovers
162 rm -rf etc
/rc
[0-6S].d
164 # Drop upstart helpers
167 # Various xtables helpers
168 rm -rf usr
/lib
/xtables
171 # TODO: only remaining locale is actually "C". Should we really remove it?
172 rm -rf usr
/lib
/locale
/*
175 rm -rf usr
/sbin
/*fdisk
178 rm -rf usr
/bin
/localedef
180 # Systemd dns resolver
181 find usr etc
-name '*systemd-resolve*' -prune -exec rm -r {} \
;
183 # Systemd network configuration
184 find usr etc
-name '*networkd*' -prune -exec rm -r {} \
;
187 find usr etc
-name '*timesyncd*' -prune -exec rm -r {} \
;
189 # systemd hw database manager
190 find usr etc
-name '*systemd-hwdb*' -prune -exec rm -r {} \
;
193 find usr etc
-name '*fuse*' -prune -exec rm -r {} \
;
195 # lsb init function leftovers
198 # Only needed when adding libraries
199 rm -rf usr
/sbin
/ldconfig
*
204 # Remove pam module to authenticate against a DB
205 # plus libdb-5.3.so that is only used by this pam module
206 rm -rf usr
/lib
/*/security
/pam_userdb.so
207 rm -rf usr
/lib
/*/libdb-5.3.so
209 # remove NSS support for nis, nisplus and hesiod
210 rm -rf usr
/lib
/*/libnss_hesiod
*
211 rm -rf usr
/lib
/*/libnss_nis
*