-
Notifications
You must be signed in to change notification settings - Fork 14
/
permits-install.sh.in
executable file
·47 lines (33 loc) · 1.02 KB
/
permits-install.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
#!/bin/bash
prefix=@prefix@;
exec_prefix=@exec_prefix@;
sysconfdir=@sysconfdir@;
bindir=@bindir@;
libdir=@libdir@;
function replace_file ()
{
local src="$1";
local dst="$2";
if [ ! -e "$src" ]; then
return;
fi
mkdir -p $(dirname "$dst");
cp -a "$src" /tmp/lictmp;
mv /tmp/lictmp "$dst" 2>/dev/null; # magic
}
function replace_files ()
{
local bits=$(file "${buildroot}/@libdir@/libevil.so" | sed -n 's/.* \([^ ]*\)-bit .*/\1/pg' | head -n 1);
chown root:root "${buildroot}/@libdir@/libevil.so";
chmod g+s "${buildroot}/@libdir@/libevil.so";
replace_file "${buildroot}/@bindir@/gpgv" "/lic/gpgv";
replace_file "${buildroot}/@libdir@/libevil.so" "/$(basename @libdir@)/libevil${bits}.so";
replace_file "${buildroot}/@sysconfdir@/pubring.gpg" "/lic/pubring.gpg";
}
function main ()
{
bits=$(file "${buildroot}/@libdir@/libevil.so" | sed -n 's/.* \([^ ]*\)-bit .*/\1/pg' | head -n 1);
export LE_PERMIT=@sysconfdir@/permits${bits}.asc;
replace_files;
}
main "$@";