From 9bb404e23c4bfd02af13689ecaeac47de094e4c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Mon, 22 Jul 2019 13:26:04 +0200 Subject: [PATCH] [WIP]: use `ceph` to get the verion in use --- ceph/ceph.backup.deb.files.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ceph/ceph.backup.deb.files.sh b/ceph/ceph.backup.deb.files.sh index 61a5ead..8c5fa06 100755 --- a/ceph/ceph.backup.deb.files.sh +++ b/ceph/ceph.backup.deb.files.sh @@ -12,10 +12,12 @@ # Vars {{{ CEPH_DEB_DIR="/var/cache/apt/archives" CEPH_DEB_PKG_FILE=$(find "${CEPH_DEB_DIR}" -maxdepth 1 -type f -iname "ceph*.deb" -print -quit) -CEPH_VERSION=$(basename "${CEPH_DEB_PKG_FILE}"|cut -d"_" -f2|sed 's/\(.*\)~.*/\1/') +CEPH_VERSION=$(ceph version | cut -d" " -f3) BKP_DIR="/srv/ceph" BKP_TAR_PATH="${BKP_DIR}/ceph-deb_${CEPH_VERSION}-$(date +%Y%m%d).tar" + +EXISTENT_BACKUP_TAR="$(find "${BKP_DIR}" -type f -iname "ceph-deb_${CEPH_VERSION}*")" # }}} # Test if a "ceph" package is available @@ -24,7 +26,6 @@ if [ "${CEPH_DEB_PKG_FILE}" ]; then mkdir -p -- "${BKP_DIR}" # 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