Skip to content
Snippets Groups Projects
Commit 0f2eacfa authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

fix list databases (path with dots cut the name)

parent 9f0f9d4d
No related branches found
No related tags found
1 merge request!134fix list databases (path with dots cut the name)
This commit is part of merge request !134. Comments created here will be created in the context of that merge request.
...@@ -201,16 +201,20 @@ ...@@ -201,16 +201,20 @@
# global string BACKUP_BASEDIR base directory of all backups of selected dbprofile # global string BACKUP_BASEDIR base directory of all backups of selected dbprofile
# param string optional: DB-Name for file filter to select from existing dumps; # param string optional: DB-Name for file filter to select from existing dumps;
function listBackupedDBs(){ function listBackupedDBs(){
local _filter="$1"
if [ -d "${BACKUP_TARGETDIR}" ]; then if [ -d "${BACKUP_TARGETDIR}" ]; then
if [ -z $1 ]; then if [ -z "$_filter" ]; then
# list all databases # list all databases
find "${BACKUP_TARGETDIR}" -mindepth 1 -maxdepth 1 -type f -exec basename {} \; \ find "${BACKUP_TARGETDIR}" -mindepth 1 -maxdepth 1 -type f -exec basename {} \; \
| sed "s#__[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9].*##g" \ | sed -e "s#__[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9].*##g" \
| sed "s#\..*##g" \ -e "s#\.couchdb\.*##g" \
| sort -ud| sed "s#^\./##g" -e "s#\.gz.meta\$##g" \
-e "s#\.gz\$##g" \
| sort -ud \
| sed "s#^\./##g"
else else
# list dumps of a database # list dumps of a database
ls -ltr ${BACKUP_TARGETDIR}/${1}*gz | sed "s,${BACKUP_TARGETDIR}/,,g" ls -ltr ${BACKUP_TARGETDIR}/${_filter}*gz | sed "s,${BACKUP_TARGETDIR}/,,g"
fi fi
else else
color.echo error "ERROR: ${BACKUP_TARGETDIR} does not exist - here are no backups to restore." color.echo error "ERROR: ${BACKUP_TARGETDIR} does not exist - here are no backups to restore."
...@@ -271,7 +275,7 @@ ...@@ -271,7 +275,7 @@
;; ;;
1) 1)
echo "INFO: No interaction on a single choice. Using" echo "INFO: No interaction on a single choice. Using"
echo " $_selection" color.echo "cmd" " $_selection"
LASTINPUT="$_selection" LASTINPUT="$_selection"
return 0 return 0
;; ;;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment