mkimage-profiles/features.in/cleanup/live/image-scripts.d/99-cleanupdb
Mikhail Efremov 85a7258d69 cleanup: Add GLOBAL_LIVE_NO_CLEANUPDB support
If set then don't remove apt and rpm from live images.
2018-07-16 20:52:16 +03:00

23 lines
622 B
Bash
Executable File

#!/bin/sh
# don't cripple the image to be copied over or explicitly requested
# not to do this
[ -n "$GLOBAL_LIVE_NO_CLEANUPDB" ] || \
[ -x /usr/sbin/live-install ] || \
[ -x /usr/sbin/livecd-install ] && exit 0
# dump what's here by this point
echo "** live packages before rpmdb purge:"
rpmquery -a --qf='%{NAME} %{VERSION}-%{RELEASE}\n'
# remove apt database and cache
find /var/lib/apt /var/cache/apt -type f -delete
# not going to need them without rpmdb, it's not even rescue anymore
rpm -e --nodeps apt libapt rpm librpmbuild librpm 2>/dev/null ||:
# finally, drop rpmdb
find /var/lib/rpm -type f -delete
: