diff --git a/ceph/ceph.backup.deb.files.sh b/ceph/ceph.backup.deb.files.sh index 83659f0..92e3639 100755 --- a/ceph/ceph.backup.deb.files.sh +++ b/ceph/ceph.backup.deb.files.sh @@ -35,7 +35,12 @@ if [ "$(command -v ceph)" ]; then ## 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}" tar cf "${BKP_TAR_PATH}" ./*.deb > /dev/null 2>&1 || exit 4