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
d145fc86
Commit
d145fc86
authored
2 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
replace hostname -f with $FQDN
parent
e9c44625
Branches
Branches containing commit
No related tags found
1 merge request
!96
Support windows
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
jobhelper.sh
+32
-2
32 additions, 2 deletions
jobhelper.sh
plugins/transfer/restic.sh
+1
-2
1 addition, 2 deletions
plugins/transfer/restic.sh
transfer.sh
+2
-2
2 additions, 2 deletions
transfer.sh
with
35 additions
and
6 deletions
jobhelper.sh
+
32
−
2
View file @
d145fc86
...
...
@@ -13,7 +13,7 @@
# 2017-02-16 ah,ds v1.2 added storage helper function
# 2018-02-13 ah,ds v1.3 detect samba shares based on a flag
# 2022-10-07 ah v1.4 unescape regex with space to prevent "grep: warning: stray \ before white space"
# 2023-03-1
6
ah v1.5 ignore required user on MS windows; source jobs/env if it exists
# 2023-03-1
7
ah v1.5 ignore required user on MS windows; source jobs/env if it exists
; use varaiable FQDN
# ================================================================================
...
...
@@ -48,6 +48,8 @@ function j_init(){
.
"
${
DIR_JOBS
}
/env"
fi
_getFqdn
if
[
!
-d
"
${
DIR_LOGS
}
"
]
;
then
mkdir
-p
"
${
DIR_LOGS
}
"
&&
echo
"INFO: dir created
${
DIR_LOGS
}
"
fi
...
...
@@ -150,7 +152,7 @@ function j_getFullTarget(){
sTmpSafeName
=
$(
j_getSafename
"
$1
"
)
sTmpHostname
=
$2
if
[
-z
"
$sTmpHostname
"
]
;
then
sTmpHostname
=
$
(
hostname
-f
)
sTmpHostname
=
$
FQDN
fi
if
[
-z
"
${
STORAGE_BASEDIR
}
"
]
;
then
STORAGE_BASEDIR
=
$(
_j_getvar
"
${
STORAGEFILE
}
"
"storage"
)
...
...
@@ -386,6 +388,34 @@ function _isMswindows(){
uname
|
grep
-iE
"(CYGWIN_NT|MINGW|MSYS_NT|Windows_NT|WindowsNT)"
>
/dev/null
}
# get fqdn and put it into FQDN; called in j_init
# - with gnu core utils: hostname -f
# - on ms windows: grep from output of ipconfig and %COMPUTERNAME%
function
_getFqdn
(){
if
[
-z
"
$FQDN
"
]
;
then
if
!
FQDN
=
$(
hostname
-f
2>/dev/null
)
;
then
echo
"INFO: hostname -f is not available"
if
_isMswindows
;
then
if
[
-n
"
$COMPUTERNAME
"
]
;
then
local
_domain
_domain
=
$(
ipconfig
-all
|
grep
"Primary Dns"
|
cut
-f
2
-d
':'
|
tr
-d
' '
)
FQDN
=
"
${
COMPUTERNAME
}
.
${
_domain
}
"
fi
fi
fi
if
[
-z
"
$FQDN
"
]
;
then
echo
"ERROR: unable to detect fqdn. Aborting."
exit
1
fi
fi
if
!
echo
"
$FQDN
"
|
grep
"
\.
.*"
>
/dev/null
;
then
echo
"ERROR: fqdn
$FQDN
does not contain a domain name. Aborting."
exit
1
fi
# echo "INFO: FQDN is [$FQDN]"
}
# ------------------------------------------------------------
# check if it was startet with a given user
# This is skipped if MS windows was detected with "mingw".
...
...
This diff is collapsed.
Click to expand it.
plugins/transfer/restic.sh
+
1
−
2
View file @
d145fc86
...
...
@@ -38,8 +38,7 @@
local
_target
=
$(
j_getFullTarget
)
echo
${
_target
}
|
grep
"https.*@"
>
/dev/null
if
[
$?
-eq
0
]
;
then
local
_host
=
$(
hostname
-f
)
_target
=
$(
echo
$_target
|
sed
"s#
${
_host
}
/##"
)
_target
=
$(
echo
$_target
|
sed
"s#
${
FQDN
}
/##"
)
fi
export
RESTIC_REPOSITORY
=
$_target
...
...
This diff is collapsed.
Click to expand it.
transfer.sh
+
2
−
2
View file @
d145fc86
...
...
@@ -323,7 +323,7 @@ function setAction(){
else
iExit
=
1
until
[
$iExit
-eq
0
]
;
do
registerBackupSlot
"
$
(
hostname
-f
)
"
registerBackupSlot
"
$
FQDN
"
iExit
=
$?
if
[
$iExit
-ne
0
]
;
then
statusBackupSlot
...
...
@@ -482,7 +482,7 @@ function setAction(){
if
[
-z
"
$STORAGE_REGISTER
"
]
;
then
echo
"SKIP"
else
unregisterBackupSlot
"
$
(
hostname
-f
)
"
$rc
unregisterBackupSlot
"
$
FQDN
"
$rc
fi
h2
"
$(
date
)
Backup finished"
...
...
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