-
Notifications
You must be signed in to change notification settings - Fork 14
/
gluster-lic-setup.in
executable file
·61 lines (49 loc) · 1.5 KB
/
gluster-lic-setup.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
54
55
56
57
58
59
60
61
#!/bin/bash -e
#
# chkconfig: 35 50 12
# description: Licensing kick-in
#
prefix=@prefix@;
exec_prefix=@exec_prefix@;
sysconfdir=@sysconfdir@;
bindir=@bindir@;
function install_libevil()
{
le32so=$(file ${exec_prefix}/lib*/libevil* | grep 32-bit | cut -f1 -d:);
ld32so=$(file /lib*/ld-* | grep 32-bit | cut -f1 -d: | head -n1);
ld32dir=$(dirname "$ld32so");
le64so=$(file ${exec_prefix}/lib*/libevil* | grep 64-bit | cut -f1 -d:);
ld64so=$(file /lib*/ld-* | grep 64-bit | cut -f1 -d: | head -n1);
ld64dir=$(dirname "$ld64so");
if [ ! -z "$le32so" -a ! -z "$ld32so" ]; then
cp $le32so $ld32dir/libevil32.so;
chown root:root $ld32dir/libevil32.so;
chmod g+s $ld32dir/libevil32.so;
sed -i 's/ld.so.preload/ld.32.preload/' $ld32so;
echo $ld32dir/libevil32.so > /etc/ld.32.preload;
fi
if [ ! -z "$le64so" -a ! -z "$ld64so" ]; then
cp $le64so $ld64dir/libevil64.so;
chown root:root $ld64dir/libevil64.so;
chmod g+s $ld64dir/libevil64.so;
echo $ld64dir/libevil64.so > /etc/ld.so.preload;
fi
}
function main()
{
if [ ! -d /lic ]; then
mkdir -p /lic;
cp @bindir@/gpgv /lic;
cp @sysconfdir@/pubring.gpg /lic;
fi
if [ ! -e /.epoch ]; then
uuidgen -r > /.epoch;
fi
if [ ! -e /etc/glusterd/glusterd.info ]; then
uuid=$(cat /.epoch);
mkdir -p /etc/glusterd;
echo "UUID=$uuid" > /etc/glusterd/glusterd.info;
fi
install_libevil;
}
main "$@";