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
9574a910
Commit
9574a910
authored
2 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Plain Diff
Merge branch 'support-windows' into 'master'
Support windows See merge request
!96
parents
39ae37c8
d145fc86
No related branches found
No related tags found
1 merge request
!96
Support windows
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
jobhelper.sh
+32
-2
32 additions, 2 deletions
jobhelper.sh
jobs/env.dist
+6
-0
6 additions, 0 deletions
jobs/env.dist
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
42 additions
and
6 deletions
.gitignore
+
1
−
0
View file @
9574a910
...
...
@@ -2,6 +2,7 @@
# ignored configs
# ----------------------------------------------------------------------
jobs/*.job
jobs/env
keys/*
logs/auto-*
logs/full-*
...
...
This diff is collapsed.
Click to expand it.
jobhelper.sh
+
32
−
2
View file @
9574a910
...
...
@@ -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.
jobs/env.dist
+
6
−
0
View file @
9574a910
...
...
@@ -3,6 +3,12 @@
# set custom variables eg. extend PATH
# ----------------------------------------------------------------------
# extend path
# PATH=/c/portable/restic/:$PATH
# if you get "ERROR: unable to detect fqdn.":
# the command "hostname -f" must return a fqdn (host incl. domain)
# if all tries fail set a hostname as fqdn here
# FQDN=mycomputer.example.com
# ----------------------------------------------------------------------
This diff is collapsed.
Click to expand it.
plugins/transfer/restic.sh
+
1
−
2
View file @
9574a910
...
...
@@ -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 @
9574a910
...
...
@@ -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