n2n: Add systemd integration (service file + start script)
This allows for configuration of tunnels by putting config files into /etc/n2n/ similar to what we're used to from /etc/openvpn/
This commit is contained in:
parent
203b5da2b5
commit
8dfafd7aca
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
source /etc/n2n/edge/$1.conf
|
||||
PARAMS="-d $TUN"
|
||||
[[ "z$DHCP" = "z1" ]] && PARAMS="$PARAMS -a dhcp:0.0.0.0" || PARAMS="$PARAMS -a static:$ADDRESS"
|
||||
PARAMS="$PARAMS -c $COMMUNITY"
|
||||
PARAMS="$PARAMS -k $KEY"
|
||||
[[ -z "$NETMASK" ]] || PARAMS="$PARAMS -s $NETMASK"
|
||||
[[ -z "$MACADDR" ]] || PARAMS="$PARAMS -m $MACADDR"
|
||||
PARAMS="$PARAMS -l $SUPERNODE"
|
||||
[[ "z$FORWADING" = "z1" ]] && PARAMS="$PARAMS -r"
|
||||
[[ -z "$LPORT" ]] || PARAMS="$PARAMS -p $LPORT"
|
||||
[[ -z "$MTU" ]] || PARAMS="$PARAMS -M $MTU"
|
||||
[[ -z "$TPORT" ]] || PARAMS="$PARAMS -t $TPORT"
|
||||
[[ "z$PRESOLV" = "z1" ]] && PARAMS="$PARAMS -b"
|
||||
exec /usr/sbin/edge $PARAMS -f
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
Description=N2N VPN Edge
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
ExecStart=/usr/share/n2n/edge.sh %i
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -6,13 +6,17 @@ DEPENDS = "openssl"
|
|||
PV = "2.1.0+git${SRCPV}"
|
||||
RRECOMMENDS_${PN} = "kernel-module-tun"
|
||||
|
||||
PR="r2"
|
||||
PR="r3"
|
||||
|
||||
SRC_URI = "git://github.com/ntop/n2n.git;branch=master \
|
||||
file://edge.sh \
|
||||
file://n2n-edge@.service \
|
||||
file://0001-Makefile-Allow-cross-compilation-environment-to-spec.patch"
|
||||
SRCREV= "${AUTOREV}"
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
inherit systemd
|
||||
|
||||
do_compile() {
|
||||
CFLAGS="$CFLAGS $LDFLAGS"
|
||||
oe_runmake
|
||||
|
@ -20,8 +24,14 @@ do_compile() {
|
|||
|
||||
do_install() {
|
||||
oe_runmake install DESTDIR=${D}
|
||||
install -d ${D}/usr/share/n2n
|
||||
install -m 0755 ${WORKDIR}/edge.sh ${D}/usr/share/n2n
|
||||
install -d ${D}${systemd_unitdir}/system
|
||||
install -m 0644 ${WORKDIR}/n2n-edge@.service ${D}${systemd_unitdir}/system
|
||||
}
|
||||
|
||||
FILES_${PN} += "${systemd_unitdir}"
|
||||
|
||||
#PACKAGES += "n2n-edge n2n-supernode"
|
||||
#
|
||||
#FILES_n2n_edge = "\
|
||||
|
|
Loading…
Reference in New Issue