90-cleanup-install-pkgs 851 Bytes
Newer Older
1
#!/bin/sh -efu
2
### create a postinstall script to drop temporarily needed packages
3 4 5

if [ -n "$GLOBAL_VERBOSE" ]; then
	echo "** GLOBAL_CLEANUP_PACKAGES: $GLOBAL_CLEANUP_PACKAGES"
6
	echo "** GLOBAL_CLEANUP_BASE_PACKAGES: $GLOBAL_CLEANUP_BASE_PACKAGES"
7 8
fi >&2

9 10 11
[ -n "$GLOBAL_CLEANUP_PACKAGES" ] ||
	[ -n "$GLOBAL_CLEANUP_BASE_PACKAGES" ] || exit 0

12
CLEANUP_PACKAGES="$GLOBAL_CLEANUP_PACKAGES $GLOBAL_CLEANUP_BASE_PACKAGES"
13

14
SCRIPT="/usr/share/install2/postinstall.d/01-remove-pkgs"
15

16 17 18 19 20 21
cat > "$SCRIPT" << EOF
#!/bin/sh -efu

. install2-init-functions

# don't override the script start message on the same line
22
echo "removing $CLEANUP_PACKAGES"
23

24
# remove temporary packages from the installed system
25
list="\$(exec_chroot rpmquery -a --qf='%{NAME}\\n' $CLEANUP_PACKAGES)"
26 27 28
[ -z "\$list" ] || exec_chroot apt-get remove -f -y  -- \$list
EOF
chmod +x "$SCRIPT"