mirror of
https://github.com/danog/docker-php-extension-installer.git
synced 2024-12-02 09:27:58 +01:00
Restore previously installed APT packages
This commit is contained in:
parent
ef2941603c
commit
8b5078f47f
@ -199,6 +199,7 @@ sortModulesToInstall() {
|
||||
# Set:
|
||||
# PACKAGES_PERSISTENT
|
||||
# PACKAGES_VOLATILE
|
||||
# PACKAGES_PREVIOUS
|
||||
buildRequiredPackageLists() {
|
||||
buildRequiredPackageLists_persistent=''
|
||||
buildRequiredPackageLists_volatile=''
|
||||
@ -634,6 +635,7 @@ buildRequiredPackageLists() {
|
||||
done
|
||||
PACKAGES_PERSISTENT=''
|
||||
PACKAGES_VOLATILE=''
|
||||
PACKAGES_PREVIOUS=''
|
||||
if test -z "$buildRequiredPackageLists_persistent$buildRequiredPackageLists_volatile"; then
|
||||
return
|
||||
fi
|
||||
@ -643,7 +645,6 @@ buildRequiredPackageLists() {
|
||||
;;
|
||||
debian)
|
||||
DEBIAN_FRONTEND=noninteractive apt-get update -q
|
||||
DEBIAN_FRONTEND=noninteractive apt-get autoremove --purge -y -q
|
||||
;;
|
||||
esac
|
||||
if test -n "$buildRequiredPackageLists_persistent"; then
|
||||
@ -665,6 +666,13 @@ buildRequiredPackageLists() {
|
||||
done
|
||||
PACKAGES_VOLATILE="${PACKAGES_VOLATILE# }"
|
||||
fi
|
||||
if test -n "$PACKAGES_PERSISTENT$PACKAGES_VOLATILE"; then
|
||||
case "$buildRequiredPackageLists_distro" in
|
||||
debian)
|
||||
PACKAGES_PREVIOUS="$(dpkg --get-selections | grep -E '\sinstall$' | awk '{ print $1 }')"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
# Get the full list of APT/APK packages that will be installed, given the required packages
|
||||
@ -1290,6 +1298,14 @@ cleanup() {
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test -n "$PACKAGES_PREVIOUS"; then
|
||||
case "$cleanup_distro" in
|
||||
debian)
|
||||
printf '### RESTORING PREVIOUSLY INSTALLED PACKAGES ###\n'
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -qqy $PACKAGES_PREVIOUS
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case "$cleanup_distro" in
|
||||
alpine)
|
||||
rm -rf /var/cache/apk/*
|
||||
|
Loading…
Reference in New Issue
Block a user