Commit 574cce85 authored by 杨文 陈's avatar 杨文 陈 Committed by Leo
Browse files

testing/n2n: new aport

parent 985b46c5
Pipeline #84509 passed with stages
in 1 minute and 26 seconds
# Contributor: wener <wenermail@gmail.com>
# Maintainer: wener <wenermail@gmail.com>
pkgname=n2n
pkgver=2.8
pkgrel=0
pkgdesc="Peer-to-peer VPN"
url="https://github.com/ntop/n2n"
arch="all"
license="GPL-3.0-only"
makedepends="cmake openssl-dev libcap-dev"
install="$pkgname.pre-install"
subpackages="$pkgname-openrc $pkgname-doc"
source="https://github.com/ntop/n2n/archive/$pkgver/n2n-$pkgver.tar.gz
supernode.initd
supernode.confd
edge.initd
edge.confd
"
# source do not contain check
options="!check"
build() {
if [ "$CBUILD" != "$CHOST" ]; then
CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
fi
cmake -B build \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DBUILD_SHARED_LIBS=True \
-DCMAKE_BUILD_TYPE=None \
$CMAKE_CROSSOPTS .
make -C build
}
package() {
make -C build DESTDIR="$pkgdir" install
# NOTE later version do not need this
mkdir -p "$pkgdir"/usr/share/man
mv "$pkgdir"/usr/share/man1 "$pkgdir"/usr/share/man7 "$pkgdir"/usr/share/man8 "$pkgdir"/usr/share/man
install -m644 -D "$builddir"/packages/etc/n2n/supernode.conf.sample "$pkgdir"/etc/n2n/supernode.conf
install -m644 -D "$builddir"/packages/etc/n2n/edge.conf.sample "$pkgdir"/etc/n2n/edge.conf
install -m755 -D "$srcdir"/supernode.initd "$pkgdir"/etc/init.d/supernode
install -m644 -D "$srcdir"/supernode.confd "$pkgdir"/etc/conf.d/supernode
install -m755 -D "$srcdir"/edge.initd "$pkgdir"/etc/init.d/edge
install -m644 -D "$srcdir"/edge.confd "$pkgdir"/etc/conf.d/edge
}
sha512sums="24eaabe1b454fbcf47c251d93fad31bf10241fe7d79b3df8cfd758652fe60f18e4f123054a4319c6b58ae96d130faa93f3d56b1bfec6c91d9c834c8bd5ae71d4 n2n-2.8.tar.gz
99ecfb3b26cd669a72cb65e374b3c39cc21dec6971b935952b75ea2cb237b201872f1764362530405cd439dc65c771e96e33f7756f4ca2f786dc4722a0a533b5 supernode.initd
df2eff2cdf11e233d187c52a7dcb039aebaa3b87ef6a12449955097bc5c17c65e4b8241e8700bdbb7d186548c4cc8d99f9cb51ba017a9f71cc8483270fa2ff4d supernode.confd
de226f5e35d4e9955364393d855f95dc2abd770edbbcef02a8b3e7802d26ae812a1df0750497d616cd450f9bb154f54e73345f753d64124155140267207ea68b edge.initd
2b96db736ecb5e636c44c4230671ca84175c90d19586967aa272bd7cf785126223a1fa2938b66a016b61a917aafcc20d9047d7109d40fb912e89ca3de24ae243 edge.confd"
# cfgfile=/etc/n2n/edge.conf
command_opts="-u n2n -g n2n"
#!/sbin/openrc-run
name=edge
description="N2N Edge Daemon"
instance=${RC_SVCNAME##*.}
[ -n "$instance" ] && : ${cfgfile:=/etc/n2n/edge-$instance.conf}
: ${cfgfile:=/etc/n2n/edge.conf}
command="/usr/sbin/edge"
command_args="$cfgfile ${command_opts}"
command_args_foreground="-f"
supervisor="supervise-daemon"
pidfile="/run/$name.pid"
output_log="/var/log/${RC_SVCNAME}.log"
error_log="/var/log/${RC_SVCNAME}.log"
retry="${EDGE_RETRY:-TERM/60/KILL/10}"
depend() {
need net
after firewall
}
start_pre() {
checkpath -f -m 0644 -o "$command_user" "$output_log" "$error_log"
checkpath -f -m 0640 -o "$command_user" "$cfgfile"
}
#!/bin/sh
addgroup -S n2n 2>/dev/null
adduser -S -D -H -s /bin/false -G n2n -g n2n n2n 2>/dev/null
exit 0
# cfgfile=/etc/n2n/supernode.conf
command_opts="-u n2n -g n2n"
#!/sbin/openrc-run
name=supernode
description="N2N Supernode Daemon"
instance=${RC_SVCNAME##*.}
[ -n "$instance" ] && : ${cfgfile:=/etc/n2n/supernode-$instance.conf}
: ${cfgfile:=/etc/n2n/supernode.conf}
command="/usr/sbin/supernode"
command_args="$cfgfile ${command_opts}"
supervisor="supervise-daemon"
pidfile="/run/$name.pid"
output_log="/var/log/${RC_SVCNAME}.log"
error_log="/var/log/${RC_SVCNAME}.log"
retry="${SUPERNODE_RETRY:-TERM/60/KILL/10}"
depend() {
need net
after firewall
}
start_pre() {
checkpath -f -m 0644 -o "$command_user" "$output_log" "$error_log"
checkpath -f -m 0640 -o "$command_user" "$cfgfile"
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment