-
Notifications
You must be signed in to change notification settings - Fork 14
/
permits-create.sh.in
executable file
·53 lines (36 loc) · 1022 Bytes
/
permits-create.sh.in
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
#!/bin/bash
prefix=@prefix@;
exec_prefix=@exec_prefix@;
sysconfdir=@sysconfdir@;
bindir=@bindir@;
libdir=@libdir@;
function md5_entry ()
{
local file="$1";
local name="$2";
local md5="d41d8cd98f00b204e9800998ecf8427e";
if [ -e "$file" ]; then
md5=$(md5sum "$file" | cut -f1 -d' ');
fi
echo "$md5 $name";
}
function create_permits_lsr ()
{
local buildroot="$1";
md5_entry "${buildroot}/@bindir@/gpgv" "/lic/gpgv";
md5_entry "${buildroot}/@libdir@/libevil.so" "/$(basename @libdir@)/libevil${bits}.so";
md5_entry "${buildroot}/@sysconfdir@/pubring.gpg" "/lic/pubring.gpg";
}
function sign ()
{
local permitfile="$1";
mkdir -p $(dirname "$permitfile");
gpg --output "$permitfile" --clearsign;
}
function main ()
{
local buildroot="$1";
bits=$(file "${buildroot}/@libdir@/libevil.so" | sed -n 's/.* \([^ ]*\)-bit .*/\1/pg' | head -n 1);
create_permits_lsr "$buildroot" | sign "${buildroot}/"@sysconfdir@/permits${bits}.asc;
}
main "$@";