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

Merge branch '7000-corrections' into 'master'

fix for db detection from file and cli restore

See merge request !133
parents dc81c2c4 9f0f9d4d
No related branches found
No related tags found
1 merge request!133fix for db detection from file and cli restore
......@@ -17,6 +17,7 @@
# 2022-03-17 ..... WIP: add lines with prefix __DB__
# 2022-11-04 ah rename hooks
# 2024-03-14 ah v2.0: use profiles for local and remote databases
# 2024-03-18 ah fix for db detection from file and cli restore
# ======================================================================
# --- variables:
......@@ -269,7 +270,8 @@
exit 1
;;
1)
echo "INFO: No interaction on a single choice. Using '$_selection'"
echo "INFO: No interaction on a single choice. Using"
echo " $_selection"
LASTINPUT="$_selection"
return 0
;;
......@@ -569,8 +571,8 @@ EOH
# if there is a single dump in backup folder:
# '-rw-r--r-- 1 root root 481 Mar 13 12:27 ahcrawler__20240313-1227.sql.gz'
# --> take the last part behind the last space to get a filename
grep "[rwxsSt\-]{10,} " <<< "$LASTINPUT" \
&& dbfile="$(rev <<< \'"$LASTINPUT"\' | cut -d ' ' -f 1 | rev)"
echo "$LASTINPUT" | grep -qE "^[rwxsSt\-]{10}" \
&& dbfile="$(rev <<< \'"$LASTINPUT"\' | cut -d ' ' -f 1 | rev | sed "s#'\$##" )"
echo
sTargetDb=$(guessDB ${dbfile})
......@@ -595,8 +597,12 @@ EOH
rc=$rc+1
else
PROFILENAME="${sDumpfile//${BACKUP_BASEDIR}/}"
PROFILENAME="$( echo $PROFILENAME | sed "s,^/*,," | cut -f 1 -d '/')"
# We expect a structure: /somedir/whatever/<PROFILENAME>/<database>.gz
dumpDirname=$( dirname "${sDumpfile}" )
PROFILENAME=$( basename "${dumpDirname}" )
echo "INFO: detected profile: $PROFILENAME"
echo ""
if dbdetect.setProfile "${PROFILENAME}"; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment