-
Notifications
You must be signed in to change notification settings - Fork 0
/
APKBUILD
86 lines (72 loc) · 3.48 KB
/
APKBUILD
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
# Maintainer: Randall Winkhart <idgr@tutanota.com>
# DO NOT DISTRIBUTE THE RESULTING PACKAGE.
# THIS APKBUILD CREATES A "portable" PACKAGE,
# MEANING IT CONTAINS SEVERAL OTHER PACKAGES WITH
# LICENSES NOT DECLARED IN THIS PACKAGE.
# THIS APKBUILD IS FOR PERSONAL USE ONLY.
pkgname=gns3-server-portable
pkgver=2.2.51
pkgrel=0
psutilver=6.1.0
pkgdesc="GNS3 network simulator (server)"
url="https://github.com/GNS3/gns3-server"
arch="all"
license="GPL-3.0-or-later"
depends="busybox dynamips libcap ubridge vpcs python3 qemu-system-x86_64 qemu-img"
makedepends="py3-pip py3-setuptools py3-wheel linux-headers python3-dev"
options="!tracedeps"
install="$pkgname.pre-install"
source="gns3-server-$pkgver.tar.gz::https://github.com/GNS3/gns3-server/archive/v$pkgver.tar.gz
psutil-$psutilver.tar.gz::https://files.pythonhosted.org/packages/26/10/2a30b13c61e7cf937f4adf90710776b7918ed0a9c434e2c38224732af310/psutil-$psutilver.tar.gz"
build() {
cd "gns3-server-$pkgver"
python3 setup.py build
cd "../psutil-$psutilver"
python3 setup.py build
}
check() {
cd "$srcdir"/gns3-server-"$pkgver"
python3 setup.py check
cd "../psutil-$psutilver"
python3 setup.py check
}
package() {
# fetch system python version
pyver=$(python3 --version | cut -d. -f2)
# install gns3server to $pkgdir
cd "$srcdir"/gns3-server-"$pkgver"
python3 setup.py install --prefix=/usr --root="$pkgdir"
cd "../psutil-$psutilver"
python3 setup.py install --skip-build --root=psutilTemp
cd "../gns3-server-$pkgver"
# re-arrange $pkgdir for portability
mv "$pkgdir/usr/lib/python3.$pyver/site-packages" "$pkgdir/usr/lib/gns3server"
mv "$pkgdir/usr/bin/gns3server" "$pkgdir/usr/lib/gns3server/gns3server-bin"
mv "$pkgdir/usr/bin/gns3loopback" "$pkgdir/usr/lib/gns3server/gns3loopback"
mv "$pkgdir/usr/bin/gns3vmnet" "$pkgdir/usr/lib/gns3server/gns3vmnet"
rm -r "$pkgdir/usr/lib/python3.$pyver"
ln -s "/usr/lib/gns3server/gns3server-bin" "$pkgdir/usr/bin/gns3server"
ln -s "/usr/lib/gns3server/gns3loopback" "$pkgdir/usr/bin/gns3loopback"
ln -s "/usr/lib/gns3server/gns3vmnet" "$pkgdir/usr/bin/gns3vmnet"
# remove psutil from requirements.txt (it is installed separately)
sed -i '/^psutil/d' requirements.txt
# remove sentry-sdk from requirements.txt (it is optional)
sed -i '/^sentry-sdk/d' requirements.txt
# download and install pip dependencies into portable directory
pip download -r ./requirements.txt -d ./localTemp
for whl in ./localTemp/*.whl; do
wheel unpack "$whl" -d ./localTemp/unpacked
done
for package in ./localTemp/unpacked/*/*/; do
mv "$package" "$pkgdir/usr/lib/gns3server/"
done
# install psutil into portable directory
mv "../psutil-$psutilver/psutilTemp/usr/lib/python3.$pyver/site-packages/psutil" "$pkgdir/usr/lib/gns3server/psutil"
mv "../psutil-$psutilver/psutilTemp/usr/lib/python3.$pyver/site-packages/psutil-$psutilver-py3.$pyver.egg-info" "$pkgdir/usr/lib/gns3server/psutil-$psutilver-py3.$pyver.egg-info"
# install OpenRC service
printf "#!/sbin/openrc-run\nsupervisor=supervise-daemon\n\nname="gns3"\n\ncommand="/usr/bin/gns3server"\ncommand_user=gns3:gns3\n\ndepend() {\n need net localmount\n after firewall\n}\n" | install -Dm 0755 /dev/stdin "$pkgdir/etc/init.d/gns3"
}
sha512sums="
f259e0b8b424ac14925b60a13d2a66afa8ce4d4280f1d5c733035efd5111e05875f08d6cd4456db01e97f6974c378a3d6f935adda28c312ce53b53e5f3953c28 gns3-server-$pkgver.tar.gz
76865df4fdb2a9df45e47589b76b34d0d9d9251491091683e47b4509863e32e46dc62ee2f760b983f0f762b8288d1ea7f32268a6857c049ad12f399908e19c82 psutil-$psutilver.tar.gz
"