FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Plugin-Repository/validate.sh at master · dsarno/Plugin-Repository · GitHub
dsarno
/
Plugin-Repository
Public
forked from
OpenTabletDriver/Plugin-Repository
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Plugin-Repository
/
validate.sh
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
79 lines (65 loc) · 1.74 KB
Breadcrumbs
Plugin-Repository
/
validate.sh
Copy path
File metadata and controls
executable file
·
79 lines (65 loc) · 1.74 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!
/usr/bin/env bash
shopt
-s globstar
#
Decend into subdirectories
ROOTDIR=
"
$(
readlink -f
$(
dirname
${BASH_SOURCE[0]}
)
)
"
[
!
-d
"
${ROOTDIR}
"
]
&&
exit
100
;
RESET=
'
\033[0;0m
'
ACCENT=
'
\033[0;97m
'
ERROR=
'
\033[1;91m
'
SUCCESS=
'
\033[1;92m
'
print_clr
() {
[
"
$#
"
-ne
2 ]
&&
exit
101
;
printf
"
$1$2
${RESET}
\n
"
}
test_dep
() {
[
"
$#
"
-ne
1 ]
&&
exit
102
;
if
[
-z
"
$(
command -v
$1
)
"
]
;
then
printf
"
Error: '
$1
' was not found in PATH.\n
"
exit
102
;
fi
}
test_dependencies
() {
test_dep
"
sha256sum
"
test_dep
"
jq
"
test_dep
"
xargs
"
test_dep
"
find
"
}
test_repository_structure
() {
cd
"
${ROOTDIR}
"
if
[
!
-d
"
Repository
"
]
;
then
print_clr
${ERROR}
"
Repository is missing expected 'Repository' folder
"
exit
104
fi
while
read
LINE
;
do
if
!
[[
"
$LINE
"
=~
^Repository/[0-9]([.][0-9]){3}(/[^/]+){2}/[^/]+json$ ]]
;
then
error=
$?
print_clr
${ERROR}
"
FAIL: Invalid path
${LINE}
"
fi
done
<
<(
find Repository/ -iname
'
*.json
'
-type f
)
[
!
-z
"
$error
"
]
&&
exit
$error
print_clr
${SUCCESS}
"
SUCCESS: Repository directory structure
"
}
check_sha256
() {
[
"
$#
"
-ne
2 ]
&&
exit
103
;
printf
"
URL:
$1
\n
"
printf
"
SHA256:
$2
\n
"
CURL_OUTPUT=
$(
curl -sL
"
$1
"
|
sha256sum
)
REMOTE_SHA256=
"
$(
printf
${CURL_OUTPUT
%
-}
|
xargs
)
"
if
[
"
${REMOTE_SHA256}
"
==
"
$2
"
]
;
then
print_clr
${SUCCESS}
"
Success:
${REMOTE_SHA256}
"
else
print_clr
${ERROR}
"
Failed:
${REMOTE_SHA256}
"
exit
200
;
fi
}
validate
() {
print_clr
${ACCENT}
"
Validating '
$1
'
"
SHA256=
$(
jq -r
'
.SHA256
'
$1
)
DOWNLOAD_URL=
$(
jq -r
'
.DownloadUrl
'
$1
)
check_sha256
"
${DOWNLOAD_URL}
"
"
${SHA256}
"
}
test_dependencies
test_repository_structure
for
file
in
${ROOTDIR}
/
**
;
do
[
"
${file
:
-5}
"
==
"
.json
"
]
&&
validate
"
${file}
"
done
exit
0
Back
|
FazBrowse Home
|
New Git URL