From 0a9682ad3b2956e8ec691f778dcdcce7206c0c63 Mon Sep 17 00:00:00 2001 From: Bertrand Jacquin Date: Sat, 11 Dec 2010 00:03:11 +0100 Subject: icmptx: add init script and rewrite Makefile --- net-misc/icmptx/Manifest | 7 ++- .../icmptx/files/icmptx-0.01-BJA-Makefile.diff | 36 ++++++++++++ net-misc/icmptx/files/icmptxcd.conf | 9 +++ net-misc/icmptx/files/icmptxcd.init | 67 ++++++++++++++++++++++ net-misc/icmptx/files/icmptxd.conf | 9 +++ net-misc/icmptx/files/icmptxd.init | 67 ++++++++++++++++++++++ net-misc/icmptx/icmptx-0.01.ebuild | 42 ++++++++++++-- 7 files changed, 230 insertions(+), 7 deletions(-) create mode 100644 net-misc/icmptx/files/icmptx-0.01-BJA-Makefile.diff create mode 100644 net-misc/icmptx/files/icmptxcd.conf create mode 100644 net-misc/icmptx/files/icmptxcd.init create mode 100644 net-misc/icmptx/files/icmptxd.conf create mode 100644 net-misc/icmptx/files/icmptxd.init (limited to 'net-misc') diff --git a/net-misc/icmptx/Manifest b/net-misc/icmptx/Manifest index 422600b9..6ec8d19b 100755 --- a/net-misc/icmptx/Manifest +++ b/net-misc/icmptx/Manifest @@ -1,2 +1,7 @@ +AUX icmptx-0.01-BJA-Makefile.diff 627 RMD160 5d0fac1de29ed9bcd1348341613c1905ab82d404 SHA1 f54f2d1956d06fd2ba9159ef0ec9762605045b9c SHA256 bf3f6e9460e306c2e8b36b110d49ca802954114ef62dd6bd5f73dcf572dc4c04 +AUX icmptxcd.conf 326 RMD160 ed4b4fb7d1ff567c53f3fcfd45d05632bea16a8a SHA1 529fe8394963867d7c41ca1cd5dd4f4f397a2c97 SHA256 faa34b1718fa242d924a198a6143a4325e3c0527cffe9fccff60ddc8631d32d6 +AUX icmptxcd.init 1338 RMD160 2c07a8f410ec06802b7d67946680015f657fe5cd SHA1 8d8af7396f2c90c9286118d65d1c8503be8bf07e SHA256 88b8c9e26914c744145151ca28fd6f13d04c21912ddd14d76febeeb8ffdbd8d0 +AUX icmptxd.conf 327 RMD160 c24032abcd36389335b98e786880303f958fe15c SHA1 6df6df887513bf5dab21f31d9e8b50d1f37b8266 SHA256 eafa579a4b39678609616197481afed2a0398edaca2ff291c2e002f3fb422a4e +AUX icmptxd.init 1354 RMD160 c39a32c3def5e00cb6e2c23b18680176a7f68ea0 SHA1 00627512e49bedb5fdc5ec7617de9775912c9961 SHA256 b66b5d750e707912928bd37c4cce4ff5248ae737e43bc2aa9f8acd42025fab6d DIST icmptx-0.01.tar.gz 6598 RMD160 172d99b1756e824d378dede0c6b3c1b70be4c8ad SHA1 278b6f9f3499ee11626e5dbe2857939510dbcd8f SHA256 8cb2070490ef0d4528968f8158b7a16976f9fb4a003f50c7a3b01ee5d1ade8df -EBUILD icmptx-0.01.ebuild 465 RMD160 4a30548c4ca04279ffd91f0fc29d294eb4124f66 SHA1 76ff7266d9a5d974c5e624e2f10480f05918e7a4 SHA256 4cebc09c178e94f226c33cef4ab33ccb4588a0ee2a1a6e740fc8b3349e86a8c6 +EBUILD icmptx-0.01.ebuild 1079 RMD160 82780b9c5337618038da7b0352e5c7d512a67f14 SHA1 6b54a9fcf89fc6bdd6be6f204b2a9ed89af0464a SHA256 86ff5f8a755464dd05812eb81ac3cd9f9aa7b2e5284dc49bcb306c898d0d21fd diff --git a/net-misc/icmptx/files/icmptx-0.01-BJA-Makefile.diff b/net-misc/icmptx/files/icmptx-0.01-BJA-Makefile.diff new file mode 100644 index 00000000..2747d689 --- /dev/null +++ b/net-misc/icmptx/files/icmptx-0.01-BJA-Makefile.diff @@ -0,0 +1,36 @@ +--- Makefile.ori 2010-12-10 23:34:45.054479998 +0100 ++++ Makefile 2010-12-10 23:42:14.791547555 +0100 +@@ -1,18 +1,22 @@ +-flags=-g ++NAME = icmptx + +-all: icmptx ++CFLAGS = \ ++ -g + +-icmptx: it.o icmptx.o tun_dev.o +- gcc $(flags) -o icmptx icmptx.o it.o tun_dev.o ++SRC = \ ++ it.c \ ++ icmptx.c \ ++ tun_dev.c + +-it.o: it.c +- gcc $(flags) -c it.c ++OBJ = $(SRC:c=o) + +-icmptx.o: icmptx.c +- gcc $(flags) -c icmptx.c ++RM = rm -f ++CC = gcc + +-tun_dev.o: tun_dev.c +- gcc $(flags) -c tun_dev.c ++all: $(NAME) ++ ++$(NAME): $(OBJ) ++ $(CC) -o $(NAME) $(CFLAGS) $(OBJ) + + clean: +- rm -f tun_dev.o it.o icmptx.o icmptx ++ $(RM) $(OBJ) $(PROJECT) diff --git a/net-misc/icmptx/files/icmptxcd.conf b/net-misc/icmptx/files/icmptxcd.conf new file mode 100644 index 00000000..1e2bb031 --- /dev/null +++ b/net-misc/icmptx/files/icmptxcd.conf @@ -0,0 +1,9 @@ +# /etc/conf.d/icmptxcd: config file for /etc/init.d/icmptxcd + +# This will be the virtual TUN/TAP interface created by icmptx. If unset, +# defaults to tun0. Note that no IP configuration will be supplied by +# icmptx -- you must do this yourself using net scripts. +#TUNTAP_INTERFACE=tun0 + +# IP to connect to +#SERVER=10.42.42.42 diff --git a/net-misc/icmptx/files/icmptxcd.init b/net-misc/icmptx/files/icmptxcd.init new file mode 100644 index 00000000..83e3e57d --- /dev/null +++ b/net-misc/icmptx/files/icmptxcd.init @@ -0,0 +1,67 @@ +#!/sbin/runscript +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +depend() { + # If the user set TUNTAP_INTERFACE, they probably have a net script + # configuring that interface. icmptx is responsible for actually creating + # the stupid thing, so we need to run before the config. + if [ ! -z "${TUNTAP_INTERFACE}" ] ; then + if [ -x /etc/init.d/net.${TUNTAP_INTERFACE} ] ; then + before net.${TUNTAP_INTERFACE} + fi + fi +} + +loadtun() { + if [ ! -e /dev/net/tun ] + then + ebegin "Loading TUN/TAP kernel module" + modprobe -q tun + eend $? + fi + + if [ ! -e /dev/net/tun ] + then + eend 1 "Failed to load TUN driver! (did you compile your kernel with TUN/TAP support?)" + return 1 + fi + + return 0 +} + +checkconfig() { + if [ -z "${SERVER}" ] ; then + eerror "SERVER must be set" + fi +} + +start() { + checkconfig || return 1 + + loadtun || return 1 + + ebegin "Starting icmptxcd" + + start-stop-daemon \ + --start \ + --background \ + --make-pidfile \ + --exec /usr/sbin/icmptx \ + --pidfile "/var/run/icmptx.pid" \ + -- ${SERVER} + + eend $? +} + +stop() { + ebegin "Stopping icmptxcd" + + start-stop-daemon \ + --stop \ + --exec /usr/sbin/icmptx \ + --pidfile "/var/run/icmptx.pid" + + eend $? +} diff --git a/net-misc/icmptx/files/icmptxd.conf b/net-misc/icmptx/files/icmptxd.conf new file mode 100644 index 00000000..5e3c88a5 --- /dev/null +++ b/net-misc/icmptx/files/icmptxd.conf @@ -0,0 +1,9 @@ +# /etc/conf.d/icmptxd: config file for /etc/init.d/icmptxd + +# This will be the virtual TUN/TAP interface created by icmptx. If unset, +# defaults to tun0. Note that no IP configuration will be supplied by +# icmptx -- you must do this yourself using net scripts. +#TUNTAP_INTERFACE=tun0 + +# IP to bind to +#BIND_ADDRESS=10.42.42.42 diff --git a/net-misc/icmptx/files/icmptxd.init b/net-misc/icmptx/files/icmptxd.init new file mode 100644 index 00000000..891274d6 --- /dev/null +++ b/net-misc/icmptx/files/icmptxd.init @@ -0,0 +1,67 @@ +#!/sbin/runscript +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +depend() { + # If the user set TUNTAP_INTERFACE, they probably have a net script + # configuring that interface. icmptx is responsible for actually creating + # the stupid thing, so we need to run before the config. + if [ ! -z "${TUNTAP_INTERFACE}" ] ; then + if [ -x /etc/init.d/net.${TUNTAP_INTERFACE} ] ; then + before net.${TUNTAP_INTERFACE} + fi + fi +} + +loadtun() { + if [ ! -e /dev/net/tun ] + then + ebegin "Loading TUN/TAP kernel module" + modprobe -q tun + eend $? + fi + + if [ ! -e /dev/net/tun ] + then + eend 1 "Failed to load TUN driver! (did you compile your kernel with TUN/TAP support?)" + return 1 + fi + + return 0 +} + +checkconfig() { + if [ -z "${BIND_ADDRESS}" ] ; then + eerror "BIND_ADDRESS must be set" + fi +} + +start() { + checkconfig || return 1 + + loadtun || return 1 + + ebegin "Starting icmptxd" + + start-stop-daemon \ + --start \ + --background \ + --make-pidfile \ + --exec /usr/sbin/icmptx \ + --pidfile "/var/run/icmptx.pid" \ + -- ${BIND_ADDRESS} + + eend $? +} + +stop() { + ebegin "Stopping icmptxd" + + start-stop-daemon \ + --stop \ + --exec /usr/sbin/icmptx \ + --pidfile "/var/run/icmptx.pid" + + eend $? +} diff --git a/net-misc/icmptx/icmptx-0.01.ebuild b/net-misc/icmptx/icmptx-0.01.ebuild index 49a0e77f..5ef11d5a 100755 --- a/net-misc/icmptx/icmptx-0.01.ebuild +++ b/net-misc/icmptx/icmptx-0.01.ebuild @@ -3,17 +3,47 @@ # $Header: $ # Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/ -DESCRIPTION="IP over ICMP." +inherit linux-info + +DESCRIPTION="IP over ICMP tunnel" +SRC_URI="http://thomer.com/${PN}/${P}.tar.gz" HOMEPAGE="http://thomer.com/icmptx/" -SRC_URI="http://thomer.com/icmptx/icmptx-0.01.tar.gz" +RDEPEND="virtual/libc" +DEPEND="virtual/os-headers + ${RDEPEND}" +KEYWORDS="~amd64 ~x86 ~ppc" +IUSE="client server" LICENSE="as-is" -DEPEND="" SLOT="0" -KEYWORDS="~amd64 ~x86 ~ppc" -IUSE="" RESTRICT="nomirror" +CONFIG_CHECK="~TUN" + +src_unpack () { + unpack "${A}" + cd ${S} + epatch "${FILESDIR}"/${P}-BJA-Makefile.diff +} + +src_compile () { + emake CC="$(tc-getCC)" || die +} + src_install() { - dobin icmptx + dosbin icmptx dodoc README + + if use client ; then + newinitd "${FILESDIR}"/icmptxd.init icmptxd + newconfd "${FILESDIR}"/icmptxd.conf icmptxd + fi + if use server ; then + newinitd "${FILESDIR}"/icmptxcd.init icmptxcd + newconfd "${FILESDIR}"/icmptxcd.conf icmptxcd + fi +} + +pkg_postinst() { + einfo "Please read the documentation provided in" + einfo " `find /usr/share/doc/${PF}/ -name 'README*'`" } -- cgit v1.2.3