diff --git a/ceph/ceph.backup.deb.files.sh b/ceph/ceph.backup.deb.files.sh index e912f13..83659f0 100755 --- a/ceph/ceph.backup.deb.files.sh +++ b/ceph/ceph.backup.deb.files.sh @@ -9,6 +9,8 @@ # }}} # Vars {{{ +DEBUG=1 + CEPH_DEB_PKG_DIR=$(mktemp --directory --tmpdir="/tmp" -- ceph-deb-files-XXXXXX.tmp) CEPH_DEB_PKG_PATTERN="ceph|rados|rbd" @@ -32,10 +34,10 @@ if [ "$(command -v ceph)" ]; then cd -- "${CEPH_DEB_PKG_DIR}" > /dev/null || exit 2 ## Download deb files of all ceph related packages installed on the system - 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 - 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 ## Remove deb files @@ -46,12 +48,12 @@ if [ "$(command -v ceph)" ]; then ## Remove temp directory rmdir -- "${CEPH_DEB_PKG_DIR}" else - printf '%b\n' "A backup of this version already exists : ${EXISTENT_BACKUP_TAR}" - exit 1 + [ "${DEBUG}" -eq "0" ] && printf '%b\n' "A backup of this version already exists : ${EXISTENT_BACKUP_TAR}" + exit 0 fi else - printf '%b\n' "Ceph doesn't seems to be available. Please take a look on \`ceph version\` command" + [ "${DEBUG}" -eq "0" ] && printf '%b\n' "Ceph doesn't seems to be available. Please take a look on \`ceph version\` command" exit 1 fi