[WIP]: Create archive if none with the same version exists

This commit is contained in:
Jeremy Gardais 2019-07-22 11:58:43 +02:00
parent 3a48690e4d
commit 0e55dbb9be
1 changed files with 5 additions and 2 deletions

View File

@ -23,8 +23,11 @@ if [ "${CEPH_DEB_PKG_FILE}" ]; then
mkdir -p -- "${BKP_DIR}"
# If no recent backup of deb files (<7 days), create a new archive
if [ ! "$(find "${BKP_DIR}" -type f -iname "ceph-deb*.tar" -mtime -7)" ]; then
# If no backup of this version already exists, create a new one
EXISTENT_BACKUP_TAR="$(find "${BKP_DIR}" -type f -iname "ceph-deb_${CEPH_VERSION}*")"
if [ "${EXISTENT_BACKUP_TAR}" ]; then
printf '%b\n' "A backup of this version already exists: ${EXISTENT_BACKUP_TAR}"
else
printf '%b\n' "Backup of Ceph deb files in version: ${CEPH_VERSION}"
tar cf "${BKP_TAR_PATH}" "${CEPH_DEB_DIR}"/*"${CEPH_VERSION}"*.deb > /dev/null 2>&1
fi