diff options
author | Sven Gothel <[email protected]> | 2021-07-02 19:03:44 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2021-07-02 19:03:44 +0200 |
commit | 4cba577252c687374b5b92135a0ef0f0e5db66ed (patch) | |
tree | 0b4032697fbb7c4df84ab7150da94fa2bbeb2cdf | |
parent | 7545621fb6f8171bb146739e703184bcab3f19dd (diff) |
Size reduction: apt-get install always use 'Recommends 0' & 'Suggests 0', drop cache; dpkg: Remove doc, man, ..
-rwxr-xr-x | build.sh | 8 | ||||
-rwxr-xr-x | export-image/04-finalise/01-run.sh | 20 | ||||
-rwxr-xr-x | stage0/00-configure-apt/00-run.sh | 4 | ||||
-rw-r--r-- | stage0/00-configure-apt/files/00default-selection | 2 | ||||
-rw-r--r-- | stage0/00-configure-apt/files/01_nodoc | 25 | ||||
-rw-r--r-- | stage0/00-configure-apt/files/02nocache | 9 |
6 files changed, 60 insertions, 8 deletions
@@ -21,7 +21,9 @@ EOF PACKAGES="$(sed -f "${SCRIPT_DIR}/remove-comments.sed" < "${i}-packages-nr")" if [ -n "$PACKAGES" ]; then on_chroot << EOF -apt-get -o APT::Acquire::Retries=3 install --no-install-recommends -y $PACKAGES +echo "Installing PACKAGES-nr '${PACKAGES}'" +echo apt-get -o APT::Acquire::Retries=3 --no-install-recommends -y $PACKAGES +apt-get -o APT::Acquire::Retries=3 --no-install-recommends -y $PACKAGES EOF if [ "${USE_QCOW2}" = "1" ]; then on_chroot << EOF @@ -36,7 +38,9 @@ EOF PACKAGES="$(sed -f "${SCRIPT_DIR}/remove-comments.sed" < "${i}-packages")" if [ -n "$PACKAGES" ]; then on_chroot << EOF -apt-get -o APT::Acquire::Retries=3 install -y $PACKAGES +echo "Installing PACKAGES '${PACKAGES}'" +echo apt-get -o APT::Acquire::Retries=3 install --no-install-recommends -y $PACKAGES +apt-get -o APT::Acquire::Retries=3 install --no-install-recommends -y $PACKAGES EOF if [ "${USE_QCOW2}" = "1" ]; then on_chroot << EOF diff --git a/export-image/04-finalise/01-run.sh b/export-image/04-finalise/01-run.sh index 865f181..18e097d 100755 --- a/export-image/04-finalise/01-run.sh +++ b/export-image/04-finalise/01-run.sh @@ -21,12 +21,20 @@ INFO_FILE_ROOT="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.root.info" #INFO_FILE_DATA="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.data.info" on_chroot << EOF -if [ -x /etc/init.d/fake-hwclock ]; then - /etc/init.d/fake-hwclock stop -fi -if hash hardlink 2>/dev/null; then - hardlink -t /usr/share/doc -fi + if [ -x /etc/init.d/fake-hwclock ]; then + /etc/init.d/fake-hwclock stop + fi + if hash hardlink 2>/dev/null; then + hardlink -t /usr/share/doc + fi + + # Keep in sync: + # stage0/00-configure-apt/files/01_nodoc + # export-image/04-finalise/01-run.sh + find /usr/share/doc -depth -type f ! -name copyright|xargs rm || true + find /usr/share/doc -empty|xargs rmdir || true + rm -rf /usr/share/man /usr/share/groff /usr/share/info /usr/share/lintian /usr/share/linda /var/cache/man + find /usr/share/locale -mindepth 1 -maxdepth 1 ! -name 'en' ! -name 'de*' ! -name 'se*' ! -name 'fr*' |xargs rm -r EOF if [ -d "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config" ]; then diff --git a/stage0/00-configure-apt/00-run.sh b/stage0/00-configure-apt/00-run.sh index 651d154..d57ce73 100755 --- a/stage0/00-configure-apt/00-run.sh +++ b/stage0/00-configure-apt/00-run.sh @@ -11,6 +11,10 @@ if [ -n "$APT_PROXY" ]; then else rm -f "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache" fi +install -m 644 files/00default-selection "${ROOTFS_DIR}/etc/apt/apt.conf.d/00default-selection" +install -m 644 files/02nocache "${ROOTFS_DIR}/etc/apt/apt.conf.d/02nocache" + +install -m 644 files/01_nodoc "${ROOTFS_DIR}/etc/dpkg/dpkg.cfg.d/01_nodoc" on_chroot apt-key add - < files/raspberrypi.gpg.key on_chroot << EOF diff --git a/stage0/00-configure-apt/files/00default-selection b/stage0/00-configure-apt/files/00default-selection new file mode 100644 index 0000000..0aa044c --- /dev/null +++ b/stage0/00-configure-apt/files/00default-selection @@ -0,0 +1,2 @@ +APT::Install-Recommends "0"; +APT::Install-Suggests "0"; diff --git a/stage0/00-configure-apt/files/01_nodoc b/stage0/00-configure-apt/files/01_nodoc new file mode 100644 index 0000000..8c0833b --- /dev/null +++ b/stage0/00-configure-apt/files/01_nodoc @@ -0,0 +1,25 @@ +# /etc/dpkg/dpkg.cfg.d/01_nodoc +# https://wiki.ubuntu.com/ReducingDiskFootprint#Documentation + +# Keep in sync: +# stage0/00-configure-apt/files/01_nodoc +# export-image/04-finalise/01-run.sh + +path-exclude /usr/share/doc/* +# we need to keep copyright files for legal reasons +path-include /usr/share/doc/*/copyright +path-exclude /usr/share/man/* +path-exclude /usr/share/groff/* +path-exclude /usr/share/info/* +# lintian stuff is small, but really unnecessary +path-exclude /usr/share/lintian/* +path-exclude /usr/share/linda/* + +path-exclude /usr/share/locale/* +path-include /usr/share/locale/en* +path-include /usr/share/locale/de* +#path-include /usr/share/locale/es* +path-include /usr/share/locale/se* +path-include /usr/share/locale/fr* +#path-include /usr/share/locale/zh* + diff --git a/stage0/00-configure-apt/files/02nocache b/stage0/00-configure-apt/files/02nocache new file mode 100644 index 0000000..401aee8 --- /dev/null +++ b/stage0/00-configure-apt/files/02nocache @@ -0,0 +1,9 @@ +# /etc/apt/apt.conf.d/02nocache +# https://wiki.ubuntu.com/ReducingDiskFootprint#Documentation + +Dir::Cache { + srcpkgcache ""; + pkgcache ""; +} + + |