[WIP]: use `ceph` to get the verion in use

This commit is contained in:
Jeremy Gardais 2019-07-22 13:26:04 +02:00
parent 0e55dbb9be
commit 9bb404e23c
1 changed files with 3 additions and 2 deletions

View File

@ -12,10 +12,12 @@
# Vars {{{ # Vars {{{
CEPH_DEB_DIR="/var/cache/apt/archives" 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_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_DIR="/srv/ceph"
BKP_TAR_PATH="${BKP_DIR}/ceph-deb_${CEPH_VERSION}-$(date +%Y%m%d).tar" 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 # Test if a "ceph" package is available
@ -24,7 +26,6 @@ if [ "${CEPH_DEB_PKG_FILE}" ]; then
mkdir -p -- "${BKP_DIR}" mkdir -p -- "${BKP_DIR}"
# If no backup of this version already exists, create a new one # 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 if [ "${EXISTENT_BACKUP_TAR}" ]; then
printf '%b\n' "A backup of this version already exists: ${EXISTENT_BACKUP_TAR}" printf '%b\n' "A backup of this version already exists: ${EXISTENT_BACKUP_TAR}"
else else