-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
zkg-install
executable file
·45 lines (40 loc) · 1.04 KB
/
zkg-install
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
#!/bin/sh
if ! which zkg > /dev/null 2>&1; then
echo 'zkg not found in $PATH' 1>&2
exit 1
fi
if [ -z "$1" ]; then
echo 'usage: zkg package[:version]' 1>&2
exit 1
fi
export name="$(echo "$1" | cut -d : -f 1)"
export version="$(echo "$1" | cut -d : -f 2 -s)"
echo "installing package ${name}:${version}" 1>&2
case $name in
# Requires non-trivial adaptation
zeek-af_packet-plugin)
git clone https://github.com/J-Gras/zeek-af_packet-plugin.git \
/opt/zeek/auxil/zeek-af_packet-plugin
cd /opt/zeek/auxil/zeek-af_packet-plugin
if [ -z "$version" ]; then
git fetch --tags
git checkout "$(git describe --tags "$(git rev-list --tags --max-count=1)")"
else
git checkout "$version"
fi
./configure --with-kernel=/usr
make -j 2
make install
cd -
;;
*)
zkg="zkg --verbose --force --skiptests"
if [ -z "$version" ]; then
zkg="$zkg --version $version"
fi
eval "$zkg install $name" || (
more "/opt/zeek/var/lib/zkg/logs/${name}-build.log"
exit 1
)
;;
esac