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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
iml-backup
Commits
89a9d1e9
Commit
89a9d1e9
authored
1 year ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
ini class: fix arrays
parent
e078010e
No related branches found
No related tags found
1 merge request
!129
Db Profiles
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
vendor/ini.class.sh
+11
-4
11 additions, 4 deletions
vendor/ini.class.sh
with
11 additions
and
4 deletions
vendor/ini.class.sh
+
11
−
4
View file @
89a9d1e9
...
@@ -251,6 +251,10 @@ function ini.validate(){
...
@@ -251,6 +251,10 @@ function ini.validate(){
local
ERROR
=
"
\e
[1;31mERROR
\e
[0m"
local
ERROR
=
"
\e
[1;31mERROR
\e
[0m"
local
iErr
;
typeset
-i
iErr
=
0
local
iErr
;
typeset
-i
iErr
=
0
if
[
!
-f
"
${
myinifile
}
"
]
;
then
return
1
fi
if
[
!
-f
"
${
myvalidationfile
}
"
]
;
then
if
[
!
-f
"
${
myvalidationfile
}
"
]
;
then
echo
-e
"
$ERROR
: Validation file '
${
myvalidationfile
}
' does not exist."
echo
-e
"
$ERROR
: Validation file '
${
myvalidationfile
}
' does not exist."
return
1
return
1
...
@@ -277,11 +281,12 @@ function ini.validate(){
...
@@ -277,11 +281,12 @@ function ini.validate(){
echo
-e
"
$ERROR
: unknown section name: [
$section
]"
echo
-e
"
$ERROR
: unknown section name: [
$section
]"
iErr+
=
1
iErr+
=
1
else
else
test
$bShowAll
-ne
0
&&
echo
"OK: [
$section
] ... checking its keys..."
test
$bShowAll
-ne
0
&&
echo
"OK:
section
[
$section
]
is valid
... checking its keys..."
# TODO: verify values
# TODO: verify values
for
mustkey
in
$(
echo
"
${
varsMust
}
"
|
grep
"^[/t ]*
${
section
}
\.
"
|
cut
-f
2
-d
'.'
|
cut
-f
1
-d
':'
)
;
do
for
mustkey
in
$(
echo
"
${
varsMust
}
"
|
grep
"^[/t ]*
${
section
}
\.
"
|
cut
-f
2
-d
'.'
|
cut
-f
1
-d
':'
)
;
do
if
ini.keys
"
$myinifile
"
"
$section
"
|
grep
"^
${
mustkey
}
$"
;
then
keyregex
=
"
$(
echo
$mustkey
|
sed
-e
's,\[,\\[,g'
)
"
if
ini.keys
"
$myinifile
"
"
$section
"
|
grep
"^
${
keyregex
}
$"
;
then
test
$bShowAll
-ne
0
&&
echo
" OK:
$section
.
$mustkey
"
test
$bShowAll
-ne
0
&&
echo
" OK:
$section
.
$mustkey
"
else
else
echo
-e
"
$ERROR
: A MUST key '
$mustkey
' was not found im section [
$section
]."
echo
-e
"
$ERROR
: A MUST key '
$mustkey
' was not found im section [
$section
]."
...
@@ -290,10 +295,12 @@ function ini.validate(){
...
@@ -290,10 +295,12 @@ function ini.validate(){
done
done
for
mykey
in
$(
ini.keys
"
$myinifile
"
"
$section
"
)
;
do
for
mykey
in
$(
ini.keys
"
$myinifile
"
"
$section
"
)
;
do
# we need a regex for keys as array eg "file[] = ..."
keyregex
=
"
$(
echo
"
${
mykey
}
"
|
sed
-e
's,\[,\\[,g'
|
sed
-e
's,\],\\],g'
)
"
if
!
echo
"
if
!
echo
"
${
varsMust
}
${
varsMust
}
${
varsCan
}
${
varsCan
}
"
|
cut
-f
1
-d
':'
|
grep
-q
"^[/t ]*
${
section
}
\.
${
my
key
}
$"
;
then
"
|
cut
-f
1
-d
':'
|
grep
-q
"^[/t ]*
${
section
}
\.
${
key
regex
}
$"
;
then
echo
-e
"
$ERROR
: invald key name:
$section
.
$mykey
"
echo
-e
"
$ERROR
: invald key name:
$section
.
$mykey
"
iErr+
=
1
iErr+
=
1
else
else
...
@@ -301,7 +308,7 @@ function ini.validate(){
...
@@ -301,7 +308,7 @@ function ini.validate(){
check
=
$(
echo
"
check
=
$(
echo
"
${
varsMust
}
${
varsMust
}
${
varsCan
}
${
varsCan
}
"
|
grep
"^[/t ]*
${
section
}
\.
${
my
key
}
[:
$]
"
|
cut
-f
2
-d
':'
)
"
|
grep
"^[/t ]*
${
section
}
\.
${
key
regex
}
[:
$]
"
|
cut
-f
2
-d
':'
)
if
[
-n
"
$check
"
]
;
then
if
[
-n
"
$check
"
]
;
then
value
=
"
$(
ini.value
"
$myinifile
"
"
$section
"
"
$mykey
"
)
"
value
=
"
$(
ini.value
"
$myinifile
"
"
$section
"
"
$mykey
"
)
"
if
!
grep
-Eq
"^
${
check
}
$"
<<<
"
$value
"
;
then
if
!
grep
-Eq
"^
${
check
}
$"
<<<
"
$value
"
;
then
...
...
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