diff --git a/recipes-extra/n2n/n2n/edge.sh b/recipes-extra/n2n/n2n/edge.sh new file mode 100644 index 0000000..3b03ffe --- /dev/null +++ b/recipes-extra/n2n/n2n/edge.sh @@ -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 + diff --git a/recipes-extra/n2n/n2n/n2n-edge@.service b/recipes-extra/n2n/n2n/n2n-edge@.service new file mode 100644 index 0000000..340e691 --- /dev/null +++ b/recipes-extra/n2n/n2n/n2n-edge@.service @@ -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 + diff --git a/recipes-extra/n2n/n2n_git.bb b/recipes-extra/n2n/n2n_git.bb index 67fce84..56c8768 100644 --- a/recipes-extra/n2n/n2n_git.bb +++ b/recipes-extra/n2n/n2n_git.bb @@ -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 = "\