Use aptitude before Debian Stretch

This commit is contained in:
Jeremy Gardais 2019-07-30 11:27:04 +02:00
parent f18b54a572
commit b28910e4bd
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 6 additions and 1 deletions

View File

@ -35,7 +35,12 @@ if [ "$(command -v ceph)" ]; then
## Download deb files of all ceph related packages installed on the system ## Download deb files of all ceph related packages installed on the system
[ "${DEBUG}" -eq "0" ] && printf '%b\n' "Download deb files of all ceph related packages installed on the system." [ "${DEBUG}" -eq "0" ] && printf '%b\n' "Download deb files of all ceph related packages installed on the system."
apt download -- $(dpkg -l | awk -v pattern="${CEPH_DEB_PKG_PATTERN}" '$0~pattern {print $2"="$3}') || exit 3 ## Use aptitude before Debian Stretch because apt doesn't yet know "download" action
if [ "$(cat /etc/debian_version | cut -c1)" -lt "9" ]; then
aptitude download -- $(dpkg -l | awk -v pattern="${CEPH_DEB_PKG_PATTERN}" '$0~pattern {print $2"="$3}') || exit 3
else
apt download -- $(dpkg -l | awk -v pattern="${CEPH_DEB_PKG_PATTERN}" '$0~pattern {print $2"="$3}') || exit 3
fi
[ "${DEBUG}" -eq "0" ] && printf '%b\n' "Backup Ceph deb files in version: ${CEPH_VERSION}" [ "${DEBUG}" -eq "0" ] && printf '%b\n' "Backup Ceph deb files in version: ${CEPH_VERSION}"
tar cf "${BKP_TAR_PATH}" ./*.deb > /dev/null 2>&1 || exit 4 tar cf "${BKP_TAR_PATH}" ./*.deb > /dev/null 2>&1 || exit 4