2024-06-23 11:54:59 +03:00
|
|
|
#!/bin/sh
|
|
|
|
set -f
|
|
|
|
|
|
|
|
## apt
|
|
|
|
find /var/cache/apt/ ! -type d ! -name 'lock' -delete
|
|
|
|
find /var/lib/apt/ ! -type d -wholename '/var/lib/apt/listchanges*' -delete
|
|
|
|
find /var/lib/apt/lists/ ! -type d ! -name 'lock' -delete
|
|
|
|
find /var/log/ ! -type d -wholename '/var/log/apt/*' -delete
|
|
|
|
find /var/log/ ! -type d -wholename '/var/log/aptitude*' -delete
|
|
|
|
|
|
|
|
## dpkg
|
|
|
|
: "${DPKG_ADMINDIR:=/var/lib/dpkg}"
|
|
|
|
truncate -s 0 "${DPKG_ADMINDIR}/available"
|
|
|
|
find "${DPKG_ADMINDIR}/" ! -type d -wholename "${DPKG_ADMINDIR}/*-old" -delete
|
|
|
|
find /var/log/ ! -type d -wholename '/var/log/alternatives.log' -delete
|
|
|
|
find /var/log/ ! -type d -wholename '/var/log/dpkg.log' -delete
|
|
|
|
|
2024-08-13 09:20:08 +03:00
|
|
|
## DONT DO THIS AT HOME!
|
|
|
|
find "${DPKG_ADMINDIR}/" ! -type d -wholename "${DPKG_ADMINDIR}/info/*.symbols" -delete
|
|
|
|
|
2024-06-23 11:54:59 +03:00
|
|
|
## debconf
|
|
|
|
find /var/cache/debconf/ ! -type d -wholename '/var/cache/debconf/*-old' -delete
|
|
|
|
|
|
|
|
__t=$(mktemp) ; : "${__t:?}"
|
|
|
|
debconf_trim_i18n() {
|
2024-12-04 21:17:59 +03:00
|
|
|
mawk 'BEGIN { m = 0; }
|
|
|
|
$0 == "" { print; }
|
|
|
|
/^[^[:space:]]/ {
|
|
|
|
if ($1 ~ "\.[Uu][Tt][Ff]-?8:") {
|
|
|
|
m = 1;
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
m = 0;
|
|
|
|
print $0;
|
|
|
|
}
|
|
|
|
/^[[:space:]]/ {
|
|
|
|
if (m == 1) next;
|
|
|
|
print $0;
|
|
|
|
}' < "$1" > "${__t}"
|
|
|
|
cat < "${__t}" > "$1"
|
2024-06-23 11:54:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
debconf_trim_i18n /var/cache/debconf/templates.dat
|
|
|
|
while read -r tmpl ; do
|
2024-12-04 21:17:59 +03:00
|
|
|
[ -n "${tmpl}" ] || continue
|
|
|
|
[ -s "${tmpl}" ] || continue
|
|
|
|
debconf_trim_i18n "${tmpl}"
|
2024-06-23 11:54:59 +03:00
|
|
|
done <<EOF
|
|
|
|
$(find "${DPKG_ADMINDIR}/info/" -type f -name '*.templates' | sort -V)
|
|
|
|
EOF
|
|
|
|
rm -f "${__t}" ; unset __t
|
|
|
|
|
|
|
|
## misc
|
|
|
|
rm -f /var/cache/ldconfig/aux-cache
|
|
|
|
|
|
|
|
exit 0
|