-
Notifications
You must be signed in to change notification settings - Fork 0
/
RelSign
executable file
·122 lines (108 loc) · 1.96 KB
/
RelSign
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/sh
# Use agent
GPG_TTY=$(tty) &&
export GPG_TTY &&
if AGENT=$(gpg-agent --daemon 2>/dev/null)
then
eval "$AGENT" &&
GPG_AGENT_PID=$(expr "$GPG_AGENT_INFO" : ".*:\([1-9][0-9]*\):[1-9][0-9]*$") &&
trap 'kill -0 2>/dev/null $GPG_AGENT_PID && kill $GPG_AGENT_PID' 0 1 2 3 15 &&
kill -0 "$GPG_AGENT_PID"
else
# agent is always on
gpgconf --kill gpg-agent
GPG_AGENT_PID=
fi &&
gpg="gpg --use-agent --local-user 96AFE6CB!" || exit
formats='htmldocs manpages'
products () {
with_sig=: with_src=echo
case "$1" in
with-sig)
with_sig=echo
shift
;;
only-sig)
with_sig=echo with_src=:
shift
;;
esac
version=$1
$with_src "git-$version.tar.gz"
$with_sig "git-$version.tar.sig"
for fmt in $formats
do
$with_src "git-$fmt-$version.tar.gz"
$with_sig "git-$fmt-$version.tar.sig"
done
}
report () {
ls -l "git-$1.sign" $(products with-sig "$1")
}
failed=
for tar in git-[0-9]*.tar.gz
do
version=$(expr "$tar" : 'git-\(.*\)\.tar.gz$')
if test -f "git-$version.tar.sig"
then
can_skip=yes
for file in $(products with-sig "$version")
do
if ! test -f "$file"
then
can_skip=no
break
fi
done
if test "$can_skip" = yes
then
report "$version"
continue
fi
fi
rm -f $(products only-sig $version)
files="$tar"
missing=
for fmt in $formats
do
doc="git-$fmt-$version.tar.gz"
if test -f "$doc"
then
files="$files $doc"
else
missing="$missing $doc"
fi
done
case "$missing" in
?*)
echo >&2 "Missing files: $missing"
failed="$failed $version"
continue
;;
esac
sha1sum $files | $gpg --clearsign >git-$version.sign || {
failed="$failed $version"
continue
}
for file in $files
do
gzip -dc <"$file" >"${file%.gz}" &&
$gpg -b "${file%.gz}" || {
failed="$failed $version"
rm -f "${file%.gz}.sig"
}
rm -f "${file%.gz}"
done
case " $failed " in
*" $version "*)
continue
;;
esac
report "$version"
done
if test -n "$GPG_AGENT_PID"
then
kill "$GPG_AGENT_PID"
else
gpgconf --kill gpg-agent
fi