Restore previously installed APT packages
parent
ef2941603c
commit
8b5078f47f
|
@ -199,6 +199,7 @@ sortModulesToInstall() {
|
||||||
# Set:
|
# Set:
|
||||||
# PACKAGES_PERSISTENT
|
# PACKAGES_PERSISTENT
|
||||||
# PACKAGES_VOLATILE
|
# PACKAGES_VOLATILE
|
||||||
|
# PACKAGES_PREVIOUS
|
||||||
buildRequiredPackageLists() {
|
buildRequiredPackageLists() {
|
||||||
buildRequiredPackageLists_persistent=''
|
buildRequiredPackageLists_persistent=''
|
||||||
buildRequiredPackageLists_volatile=''
|
buildRequiredPackageLists_volatile=''
|
||||||
|
@ -634,6 +635,7 @@ buildRequiredPackageLists() {
|
||||||
done
|
done
|
||||||
PACKAGES_PERSISTENT=''
|
PACKAGES_PERSISTENT=''
|
||||||
PACKAGES_VOLATILE=''
|
PACKAGES_VOLATILE=''
|
||||||
|
PACKAGES_PREVIOUS=''
|
||||||
if test -z "$buildRequiredPackageLists_persistent$buildRequiredPackageLists_volatile"; then
|
if test -z "$buildRequiredPackageLists_persistent$buildRequiredPackageLists_volatile"; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
@ -643,7 +645,6 @@ buildRequiredPackageLists() {
|
||||||
;;
|
;;
|
||||||
debian)
|
debian)
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get update -q
|
DEBIAN_FRONTEND=noninteractive apt-get update -q
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get autoremove --purge -y -q
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
if test -n "$buildRequiredPackageLists_persistent"; then
|
if test -n "$buildRequiredPackageLists_persistent"; then
|
||||||
|
@ -665,6 +666,13 @@ buildRequiredPackageLists() {
|
||||||
done
|
done
|
||||||
PACKAGES_VOLATILE="${PACKAGES_VOLATILE# }"
|
PACKAGES_VOLATILE="${PACKAGES_VOLATILE# }"
|
||||||
fi
|
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
|
# Get the full list of APT/APK packages that will be installed, given the required packages
|
||||||
|
@ -1290,6 +1298,14 @@ cleanup() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
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
|
case "$cleanup_distro" in
|
||||||
alpine)
|
alpine)
|
||||||
rm -rf /var/cache/apk/*
|
rm -rf /var/cache/apk/*
|
||||||
|
|
Loading…
Reference in New Issue