Browse Source

freetz firmware pkg

Toni Uhlig 5 years ago
parent
commit
c2a378ea56

+ 9 - 0
contrib/freetz/make/pingtunnel-ng/Config.in

@@ -0,0 +1,9 @@
+config FREETZ_PACKAGE_PINGTUNNEL_NG
+	bool "Pingtunnel-NG 1.1"
+	default n
+	help
+		Ptunnel-NG is an application that allows you to reliably tunnel TCP
+		connections to a remote host using ICMP echo request and reply packets,
+		commonly known as ping requests and replies. At first glance, this might
+		seem like a rather useless thing to do, but it can actually come in
+		handy in some cases. This is the [N]ew [G]eneration fork of PingTunnel!

+ 1 - 0
contrib/freetz/make/pingtunnel-ng/external.files

@@ -0,0 +1 @@
+[ "$EXTERNAL_FREETZ_PACKAGE_PINGTUNNEL_NG" == "y" ] && EXTERNAL_FILES+=" /usr/sbin/ptunnel-ng"

+ 7 - 0
contrib/freetz/make/pingtunnel-ng/external.in

@@ -0,0 +1,7 @@
+config EXTERNAL_FREETZ_PACKAGE_PINGTUNNEL_NG
+	depends on EXTERNAL_ENABLED && FREETZ_PACKAGE_PINGTUNNEL_NG
+	bool "pingtunnel-ng"
+	default n
+	help
+		externals the following file(s):
+		 /usr/sbin/ptunnel-ng

+ 2 - 0
contrib/freetz/make/pingtunnel-ng/external.services

@@ -0,0 +1,2 @@
+[ "$EXTERNAL_FREETZ_PACKAGE_PINGTUNNEL_NG" == "y" ] && EXTERNAL_SERVICES+=" pingtunnel-ng"
+

+ 4 - 0
contrib/freetz/make/pingtunnel-ng/files/root/etc/default.pingtunnel-ng/pingtunnel-ng.cfg

@@ -0,0 +1,4 @@
+export PINGTUNNELNG_ENABLED='no'
+export PINGTUNNELNG_PASSWORD=''
+export PINGTUNNELNG_EXTRA=''
+export PINGTUNNELNG_MAGIC='0xdeadc0de'

+ 57 - 0
contrib/freetz/make/pingtunnel-ng/files/root/etc/init.d/rc.pingtunnel-ng

@@ -0,0 +1,57 @@
+#!/bin/sh
+
+DAEMON=pingtunnel-ng
+DAEMON_BIN=ptunnel-ng
+PID_FILE=/var/run/$DAEMON.pid
+. /etc/init.d/modlibrc
+
+start() {
+	mkdir -p /tmp/$DAEMON_BIN
+	[ -z "$PINGTUNNELNG_EXTRA" ] && PINGTUNNELNG_EXTRA="--syslog"
+	modlib_startdaemon $DAEMON_BIN \
+		$PINGTUNNELNG_EXTRA \
+		--magic $PINGTUNNELNG_MAGIC \
+		--passwd $PINGTUNNELNG_PASSWORD \
+		--daemon $PID_FILE \
+		--chroot /tmp/$DAEMON_BIN \
+		--user nobody \
+		--group nobody
+}
+
+stop_post() {
+	[ "$1" == "0" ] && rm -rf /tmp/$DAEMON_BIN 2>/dev/null
+}
+
+case $1 in
+	""|load)
+		modlib_add_user_and_group nobody
+
+		modreg cgi 'pingtunnel-ng' 'pingtunnel-ng'
+		modreg daemon $DAEMON
+
+		modlib_start $PINGTUNNELNG_ENABLED
+		;;
+	unload)
+		modunreg daemon $DAEMON
+		modunreg cgi 'pingtunnel-ng'
+		modlib_stop
+		;;
+	start)
+		modlib_start
+		;;
+	stop)
+		modlib_stop
+		;;
+	restart)
+		modlib_restart
+		;;
+	status)
+		modlib_status
+		;;
+	*)
+		echo "Usage: $0 [load|unload|start|stop|restart|status]" 1>&2
+		exit 1
+		;;
+esac
+
+exit 0

+ 20 - 0
contrib/freetz/make/pingtunnel-ng/files/root/usr/lib/cgi-bin/pingtunnel-ng.cgi

@@ -0,0 +1,20 @@
+#!/bin/sh
+
+. /usr/lib/libmodcgi.sh
+
+sec_begin '$(lang de:"Starttyp" en:"Start type")'
+cgi_print_radiogroup_service_starttype "enabled" "$PINGTUNNELNG_ENABLED" "" "" 0
+sec_end
+
+sec_begin '$(lang de:"Server" en:"Server")'
+
+cgi_print_password_p "password" "$PINGTUNNELNG_PASSWORD" 20/32 \
+  "$(lang de:"Tunnel-Passwort" en:"Tunnel password"): "
+
+cgi_print_textline_p "extra" "$PINGTUNNELNG_EXTRA" 40/255 \
+  "$(lang de:"Erweiterte Optionen" en:"Extra options"): "
+
+cgi_print_textline_p "magic" "$PINGTUNNELNG_MAGIC" 20/32 \
+  "$(lang de:"ICMP Tunnel magische Nummer" en:"ICMP Tunnel Magic Number"): "
+
+sec_end

+ 35 - 0
contrib/freetz/make/pingtunnel-ng/pingtunnel-ng.mk

@@ -0,0 +1,35 @@
+$(call PKG_INIT_BIN, 1.1)
+$(PKG)_SOURCE:=ptunnel-ng-$($(PKG)_VERSION).tar.gz
+$(PKG)_SOURCE_SHA256:=3182ecc4f9a7ef3ae8895b460aa596ae050b9718b98fd5eaf224772fba017c22
+$(PKG)_SITE:=https://github.com/lnslbrty/ptunnel-ng/releases/download/v$($(PKG)_VERSION)
+$(PKG)_DIR:=$($(PKG)_SOURCE_DIR)/ptunnel-ng-$($(PKG)_VERSION)
+
+$(PKG)_BINARY:=$($(PKG)_DIR)/src/ptunnel-ng
+$(PKG)_TARGET_BINARY:=$($(PKG)_DEST_DIR)/usr/sbin/ptunnel-ng
+
+$(PKG)_BUILD_PREREQ += aclocal automake autoconf
+$(PKG)_DEPENDS_ON += libpcap
+
+$(PKG)_EXTRA_CFLAGS += -std=gnu99
+$(PKG)_CONFIGURE_OPTIONS += --disable-selinux
+
+$(PKG_SOURCE_DOWNLOAD)
+$(PKG_UNPACKED)
+$(PKG_CONFIGURED_CONFIGURE)
+
+$($(PKG)_BINARY): $($(PKG)_DIR)/.configured
+	echo "______$(PINGTUNNEL_NG_EXTRA_CFLAGS)_____"
+	$(SUBMAKE) -C $(PINGTUNNEL_NG_DIR) V=1 \
+		CFLAGS="$(TARGET_CFLAGS) $(PINGTUNNEL_NG_EXTRA_CFLAGS)"
+
+$($(PKG)_TARGET_BINARY): $($(PKG)_BINARY)
+	$(INSTALL_BINARY_STRIP)
+
+$(pkg):
+
+$(pkg)-precompiled: $($(PKG)_TARGET_BINARY)
+
+$(pkg)-uninstall:
+	$(RM) $(PINGTUNNEL_NG_TARGET_BINARY)
+
+$(PKG_FINISH)