blob: d5af995a8d83e7c5a260f256a6761f4290a1b9df (
plain)
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
|
# Maintainer: somekool <somekool _ at _ gmail _ dot _com>
pkgname=netvirt-agent-git
pkgver=0.6.r20.g3798298
pkgrel=3798298
pkgdesc="NetVirt is an open source network virtualization platform (NVP)."
arch=('i686' 'x86_64')
url=("http://netvirt.org" "https://github.com/netvirt/netvirt")
license='GPLv3'
depends=()
optdepends=()
makedepends=('git' 'scons' 'cmake' 'libcap') # 'libqt4-dev' 'libssl-dev')
source="${pkgname}::git+https://github.com/netvirt/netvirt.git"
md5sums=('SKIP')
pkgver() {
# see https://wiki.archlinux.org/index.php/VCS_package_guidelines for more details
git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
pkgrel() {
git rev-parse --short HEAD
}
prepare() {
cd ${srcdir}/${pkgname}
set -e
git submodule update --init --recursive
pushd udt4
make > /dev/null
popd
pushd libconfig
#fix_libconfig_git
[ ! -f Makefile ] && ./configure
make > /dev/null
popd
pushd tapcfg
./buildall.sh linuxonly || true > /dev/null
popd
set +e
echo ======================== prepare completed ========================
}
build() {
[ -d ${srcdir}/${pkgname}/build ] && rm -fr ${srcdir}/${pkgname}/build
mkdir ${srcdir}/${pkgname}/build
cd ${srcdir}/${pkgname}/build
cmake .. -DCMAKE_INSTALL_PREFIX:PATH=${pkgdir}/usr -DWITH_GUI=OFF
make nvagent
echo ======================== build completed ========================
}
package() {
cd ${srcdir}/${pkgname}/build
make install
#TODO: this could/should become a post_install item
echo "#!/bin/sh
sudo chmod 666 /dev/net/tun
sudo setcap cap_net_bind_service,cap_net_admin=ep /usr/bin/netvirt-agent
" > ${pkgdir}/usr/bin/netvirt-allow_user
# restartd on ubuntu allow to easily create a daemon with any command,
# but unfortunatelly, it does not look to be available under arch linux
#echo "#!/bin/sh
#sudo pacman -S restartd
#echo 'netvirt-agent \"netvirt-agent\" \"sleep 20 && su - \$USER -c netvirt-agent &\" \"\"' | sudo tee -a /etc/restartd.conf
#" > ${pkgdir}/usr/bin/netvirt-daemonize
# ArchLinux uses SystemD, Yeah
cat << EOF > ${pkgdir}/usr/lib/systemd/system/netvirt-agent.service
[Unit]
Description=Netvirt Agent
After=network.target
[Service]
Environment="HOME=/root"
ExecStart=/usr/bin/netvirt-agent
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=always
[Install]
WantedBy=multi-user.target
EOF
}
|