From 0be277647d8d4c5c30e1a5667889803987ce7b7a Mon Sep 17 00:00:00 2001 From: Apachez Date: Sat, 16 Sep 2023 05:09:56 +0200 Subject: T5511: Cleanup of unused directories (and files) in order to shrink image-size --- .../hooks/live/20-rm_ddclient_hook.chroot | 15 ++-- .../hooks/live/22-rm_cron_atop.chroot | 8 ++- .../hooks/live/80-delete-docs.chroot | 80 +++++++++++----------- .../hooks/live/81-cleanup-etc-defaults.chroot | 19 ++--- .../hooks/live/82-cleanup-udev-rules.chroot | 11 +-- .../hooks/live/83-cleanup-etc-motd-d.chroot | 10 ++- data/live-build-config/rootfs/excludes | 68 +++++++++++++++++- 7 files changed, 147 insertions(+), 64 deletions(-) (limited to 'data/live-build-config') diff --git a/data/live-build-config/hooks/live/20-rm_ddclient_hook.chroot b/data/live-build-config/hooks/live/20-rm_ddclient_hook.chroot index 350843c7..f4ea265e 100755 --- a/data/live-build-config/hooks/live/20-rm_ddclient_hook.chroot +++ b/data/live-build-config/hooks/live/20-rm_ddclient_hook.chroot @@ -1,9 +1,12 @@ #!/bin/sh -if [ -f /etc/dhcp/dhclient-exit-hooks.d/ddclient ]; then - rm -f /etc/dhcp/dhclient-exit-hooks.d/ddclient -fi +# Made obsolete by T5511, use rootfs/excludes instead. +# +#if [ -f /etc/dhcp/dhclient-exit-hooks.d/ddclient ]; then +# rm -f /etc/dhcp/dhclient-exit-hooks.d/ddclient +#fi +# +#if [ -f /etc/ddclient.conf ]; then +# rm -f /etc/ddclient.conf +#fi -if [ -f /etc/ddclient.conf ]; then - rm -f /etc/ddclient.conf -fi diff --git a/data/live-build-config/hooks/live/22-rm_cron_atop.chroot b/data/live-build-config/hooks/live/22-rm_cron_atop.chroot index 7f77e1f7..047564bb 100755 --- a/data/live-build-config/hooks/live/22-rm_cron_atop.chroot +++ b/data/live-build-config/hooks/live/22-rm_cron_atop.chroot @@ -1,6 +1,8 @@ #!/bin/sh -if [ -f /etc/cron.d/atop ]; then - rm -f /etc/cron.d/atop -fi +# Made obsolete by T5511, use rootfs/excludes instead. +# +#if [ -f /etc/cron.d/atop ]; then +# rm -f /etc/cron.d/atop +#fi diff --git a/data/live-build-config/hooks/live/80-delete-docs.chroot b/data/live-build-config/hooks/live/80-delete-docs.chroot index 1f50a9ec..e7825fd0 100755 --- a/data/live-build-config/hooks/live/80-delete-docs.chroot +++ b/data/live-build-config/hooks/live/80-delete-docs.chroot @@ -1,42 +1,44 @@ #!/bin/bash -# Delete various unused files and directories in order free some space and shrink imagesize. - -# We do not need any documentation on the system. -# Copyright/licenses files are ignored for deletion. -shopt -s extglob -rm -rf /usr/share/doc/*/!(copyright*|README*) /usr/share/doc-base - -# We do not need any manpages on the system since man-binary is missing. -rm -rf /usr/local/man -rm -rf /usr/local/share/man -rm -rf /usr/share/man - -# We do not need any games on the system. -rm -rf /usr/games -rm -rf /usr/local/games - -# We do not need any caches on the system (will be recreated when needed). -rm -rf /var/cache/* - -# We do not need any log-files on the system (will be recreated when needed). -rm -rf /var/log/alternatives.log -rm -rf /var/log/bootstrap.log -rm -rf /var/log/dpkg.log -rm -rf /var/log/apt/history.log -rm -rf /var/log/apt/term.log -rm -rf /var/log/nginx/access.log -rm -rf /var/log/nginx/error.log -rm -rf /var/log/squidguard/squidGuard.log -rm -rf /var/log/stunnel4/stunnel.log - -# We do not need any backup-files on the system. -rm -rf /etc/sudoers.bak -rm -rf /etc/xml/catalog.old -rm -rf /etc/xml/polkitd.xml.old -rm -rf /etc/xml/xml-core.xml.old -rm -rf /root/.gnupg/pubring.kbx~ -rm -rf /var/lib/dpkg/diversions-old -rm -rf /var/lib/dpkg/status-old -rm -rf /var/lib/sgml-base/supercatalog.old +# Made obsolete by T5511, use rootfs/excludes instead. +# +## Delete various unused files and directories in order free some space and shrink imagesize. +# +## We do not need any documentation on the system. +## Copyright/licenses files are ignored for deletion. +#shopt -s extglob +#rm -rf /usr/share/doc/*/!(copyright*|README*) /usr/share/doc-base +# +## We do not need any manpages on the system since man-binary is missing. +#rm -rf /usr/local/man +#rm -rf /usr/local/share/man +#rm -rf /usr/share/man +# +## We do not need any games on the system. +#rm -rf /usr/games +#rm -rf /usr/local/games +# +## We do not need any caches on the system (will be recreated when needed). +#rm -rf /var/cache/* +# +## We do not need any log-files on the system (will be recreated when needed). +#rm -f /var/log/alternatives.log +#rm -f /var/log/bootstrap.log +#rm -f /var/log/dpkg.log +#rm -f /var/log/apt/history.log +#rm -f /var/log/apt/term.log +#rm -f /var/log/nginx/access.log +#rm -f /var/log/nginx/error.log +#rm -f /var/log/squidguard/squidGuard.log +#rm -f /var/log/stunnel4/stunnel.log +# +## We do not need any backup-files on the system. +#rm -f /etc/sudoers.bak +#rm -f /etc/xml/catalog.old +#rm -f /etc/xml/polkitd.xml.old +#rm -f /etc/xml/xml-core.xml.old +#rm -f /root/.gnupg/pubring.kbx~ +#rm -f /var/lib/dpkg/diversions-old +#rm -f /var/lib/dpkg/status-old +#rm -f /var/lib/sgml-base/supercatalog.old diff --git a/data/live-build-config/hooks/live/81-cleanup-etc-defaults.chroot b/data/live-build-config/hooks/live/81-cleanup-etc-defaults.chroot index c93deee1..554f74d9 100755 --- a/data/live-build-config/hooks/live/81-cleanup-etc-defaults.chroot +++ b/data/live-build-config/hooks/live/81-cleanup-etc-defaults.chroot @@ -1,11 +1,14 @@ #!/bin/sh -# we use systemd to control ISC daemons from within vyos-1x -FILES="/etc/default/isc-dhcp-server /etc/default/isc-dhcp-relay" +# Made obsolete by T5511, use rootfs/excludes instead. +# +## we use systemd to control ISC daemons from within vyos-1x +#FILES="/etc/default/isc-dhcp-server /etc/default/isc-dhcp-relay" +# +#for FILE in ${FILES} +#do +# if [ -f ${FILE} ]; then +# rm -f ${FILE} +# fi +#done -for FILE in ${FILES} -do - if [ -f ${FILE} ]; then - rm -f ${FILE} - fi -done diff --git a/data/live-build-config/hooks/live/82-cleanup-udev-rules.chroot b/data/live-build-config/hooks/live/82-cleanup-udev-rules.chroot index a0173e49..0345a561 100755 --- a/data/live-build-config/hooks/live/82-cleanup-udev-rules.chroot +++ b/data/live-build-config/hooks/live/82-cleanup-udev-rules.chroot @@ -1,7 +1,10 @@ #!/bin/sh -# 99-default.link rule always calls link_config that trying to set -# autonegotiation and duplex even for PPP interfaces. -# Need to delete this rule to prevent overhead on interface creation stage +# Made obsolete by T5511, use rootfs/excludes instead. +# +## 99-default.link rule always calls link_config that trying to set +## autonegotiation and duplex even for PPP interfaces. +## Need to delete this rule to prevent overhead on interface creation stage +# +#rm /lib/systemd/network/99-default.link -rm /lib/systemd/network/99-default.link diff --git a/data/live-build-config/hooks/live/83-cleanup-etc-motd-d.chroot b/data/live-build-config/hooks/live/83-cleanup-etc-motd-d.chroot index 9d8dc97e..51116480 100755 --- a/data/live-build-config/hooks/live/83-cleanup-etc-motd-d.chroot +++ b/data/live-build-config/hooks/live/83-cleanup-etc-motd-d.chroot @@ -1,4 +1,8 @@ #!/bin/sh -if [ -f /etc/update-motd.d/10-uname ]; then - rm -f /etc/update-motd.d/10-uname -fi + +# Made obsolete by T5511, use rootfs/excludes instead. +# +#if [ -f /etc/update-motd.d/10-uname ]; then +# rm -f /etc/update-motd.d/10-uname +#fi + diff --git a/data/live-build-config/rootfs/excludes b/data/live-build-config/rootfs/excludes index 69f0bef7..1229c0f9 100644 --- a/data/live-build-config/rootfs/excludes +++ b/data/live-build-config/rootfs/excludes @@ -9,6 +9,72 @@ # - root starts without leading '/'. # -# We do not need any caches on the system (will be recreated when needed). +# Txxx: Drop isc-dhcp helper files from /etc/default. +# We use systemd to control ISC daemons from within vyos-1x. +# Was: hooks/live/81-cleanup-etc-defaults.chroot +etc/default/isc-dhcp-server +etc/default/isc-dhcp-relay + +# T2185: Clean leftover files (ddclient) from base package. +# Was: hooks/live/20-rm_ddclient_hook.chroot +etc/dhcp/dhclient-exit-hooks.d/ddclient +etc/ddclient.conf + +# T3242: Add hook to prevent link_config redundancy call in systemd-udev. +# 99-default.link rule always calls link_config thats trying to set autonegotiation and duplex even for PPP interfaces. +# Need to delete this rule to prevent overhead on interface creation stage. +# Was: hooks/live/82-cleanup-udev-rules.chroot +lib/systemd/network/99-default.link + +# T3774: Disabled atop services. +# Was: hooks/live/22-rm_cron_atop.chroot +etc/cron.d/atop + +# T3912: Remove superfluous motd.d kernel version shell script. +# Was: hooks/live/83-cleanup-etc-motd-d.chroot +etc/update-motd.d/10-uname + +# T4415: We do not need any documentation on the system. +# Copyright/licenses files are ignored for deletion. +# Was: hooks/live/80-delete-docs.chroot +usr/share/doc/*/!(copyright*|README*) +usr/share/doc-base + +# T5468: We do not need any manpages on the system since man-binary is missing. +# Was: hooks/live/80-delete-docs.chroot +usr/local/man/* +usr/local/share/man/* +usr/share/man/* + +# T5511: We do not need any games on the system. +# Was: hooks/live/80-delete-docs.chroot +usr/games/* +usr/local/games/* + +# T5511: We do not need any caches on the system (will be recreated when needed). +# Was: hooks/live/80-delete-docs.chroot var/cache/* +# T5511: We do not need any log-files on the system (will be recreated when needed). +# Was: hooks/live/80-delete-docs.chroot +var/log/alternatives.log +var/log/bootstrap.log +var/log/dpkg.log +var/log/apt/history.log +var/log/apt/term.log +var/log/nginx/access.log +var/log/nginx/error.log +var/log/squidguard/squidGuard.log +var/log/stunnel4/stunnel.log + +# T5511: We do not need any backup-files on the system. +# Was: hooks/live/80-delete-docs.chroot +etc/sudoers.bak +etc/xml/catalog.old +etc/xml/polkitd.xml.old +etc/xml/xml-core.xml.old +root/.gnupg/pubring.kbx~ +var/lib/dpkg/diversions-old +var/lib/dpkg/status-old +var/lib/sgml-base/supercatalog.old + -- cgit v1.2.3