Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iml-backup
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
iml-backup
Commits
9f0f9d4d
Commit
9f0f9d4d
authored
1 year ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
fix for db detection from file and cli restore
parent
d51efb55
No related branches found
No related tags found
1 merge request
!133
fix for db detection from file and cli restore
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
localdump.sh
+20
-14
20 additions, 14 deletions
localdump.sh
with
20 additions
and
14 deletions
localdump.sh
+
20
−
14
View file @
9f0f9d4d
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
# 2022-03-17 ..... WIP: add lines with prefix __DB__
# 2022-03-17 ..... WIP: add lines with prefix __DB__
# 2022-11-04 ah rename hooks
# 2022-11-04 ah rename hooks
# 2024-03-14 ah v2.0: use profiles for local and remote databases
# 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:
# --- variables:
...
@@ -269,19 +270,20 @@
...
@@ -269,19 +270,20 @@
exit
1
exit
1
;;
;;
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
"
LASTINPUT
=
"
$_selection
"
return
0
return
0
;;
;;
*
)
*
)
echo
"
$_selection
"
echo
"
$_selection
"
color.print input
"
${
_prompt
}
>"
color.print input
"
${
_prompt
}
>"
read
-r
LASTINPUT
read
-r
LASTINPUT
if
[
-z
"
$LASTINPUT
"
]
;
then
if
[
-z
"
$LASTINPUT
"
]
;
then
echo
"No input given. Aborting."
echo
"No input given. Aborting."
exit
1
exit
1
fi
fi
;;
;;
esac
esac
}
}
...
@@ -569,8 +571,8 @@ EOH
...
@@ -569,8 +571,8 @@ EOH
# if there is a single dump in backup folder:
# 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'
# '-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
# --> take the last part behind the last space to get a filename
grep
"[rwxsSt
\-
]{10,} "
<<<
"
$LASTINPUT
"
\
echo
"
$LASTINPUT
"
|
grep
-qE
"^[rwxsSt
\-
]{10}
"
\
&&
dbfile
=
"
$(
rev
<<<
\'
"
$LASTINPUT
"
\'
|
cut
-d
' '
-f
1 | rev
)
"
&&
dbfile
=
"
$(
rev
<<<
\'
"
$LASTINPUT
"
\'
|
cut
-d
' '
-f
1 | rev
|
sed
"s#'
\$
##"
)
"
echo
echo
sTargetDb
=
$(
guessDB
${
dbfile
}
)
sTargetDb
=
$(
guessDB
${
dbfile
}
)
...
@@ -595,9 +597,13 @@ EOH
...
@@ -595,9 +597,13 @@ EOH
rc
=
$rc
+1
rc
=
$rc
+1
else
else
PROFILENAME
=
"
${
sDumpfile
//
${
BACKUP_BASEDIR
}
/
}
"
# We expect a structure: /somedir/whatever/<PROFILENAME>/<database>.gz
PROFILENAME
=
"
$(
echo
$PROFILENAME
|
sed
"s,^/*,,"
|
cut
-f
1
-d
'/'
)
"
dumpDirname
=
$(
dirname
"
${
sDumpfile
}
"
)
PROFILENAME
=
$(
basename
"
${
dumpDirname
}
"
)
echo
"INFO: detected profile:
$PROFILENAME
"
echo
""
if
dbdetect.setProfile
"
${
PROFILENAME
}
"
;
then
if
dbdetect.setProfile
"
${
PROFILENAME
}
"
;
then
SERVICENAME
=
$(
dbdetect.getType
"
$PROFILENAME
"
)
SERVICENAME
=
$(
dbdetect.getType
"
$PROFILENAME
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment