forked from cli/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscoop-gen
More file actions
executable file
·31 lines (27 loc) · 781 Bytes
/
scoop-gen
File metadata and controls
executable file
·31 lines (27 loc) · 781 Bytes
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
#!/bin/bash
# Usage: cat checksums.txt | script/scoop-gen <version> <json-file>
set -e
tagname="${1?}"
jsonfile="${2?}"
jq_args=(
--arg version "${tagname#v}"
--arg urlprefix "https://github.com/cli/cli/releases/download/$tagname/"
$(cat | awk '
/windows_386/ {
printf "--arg win32hash %s\n", $1
printf "--arg win32file %s\n", $2
}
/windows_amd64/ {
printf "--arg win64hash %s\n", $1
printf "--arg win64file %s\n", $2
}
')
)
jq '
.version = $version |
.architecture."32bit".url = $urlprefix + $win32file |
.architecture."32bit".hash = $win32hash |
.architecture."64bit".url = $urlprefix + $win64file |
.architecture."64bit".hash = $win64hash
' "${jq_args[@]}" --indent 4 "$jsonfile" > "$jsonfile"~
mv "$jsonfile"{~,}