Subject: [alpine-devel] [PATCH] creating iptraf package

From: Marcin Mankiewicz <[email-masked]>
Date: Mon, 16 Sep 2013 12:35:00 +0200

---
 testing/iptraf/APKBUILD             |  48 ++++++++
 testing/iptraf/kernel_install.patch | 231 ++++++++++++++++++++++++++++++++++++
 2 files changed, 279 insertions(+)
 create mode 100644 testing/iptraf/APKBUILD
 create mode 100644 testing/iptraf/kernel_install.patch

diff --git a/testing/iptraf/APKBUILD b/testing/iptraf/APKBUILD
new file mode 100644
index 0000000..90cf96d
--- /dev/null
+++ b/testing/iptraf/APKBUILD
@@ -0,0 +1,48 @@
+# Contributor: Marcin Mankiewicz <[email-masked]>
+# Maintainer:
+pkgname=iptraf
+pkgver=3.0.0
+pkgrel=0
+pkgdesc="IPTraf is a console-based network statistics utility for Linux."
+url="http://http://iptraf.seul.org/"
+arch="all"
+license="GPL"
+depends="ncurses"
+depends_dev="ncurses-dev"
+makedepends="$depends_dev"
+subpackages=""
+source="ftp://iptraf.seul.org/pub/iptraf/iptraf-$pkgver.tar.gz
+	kernel_install.patch"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+
+prepare() {
+	local i
+	cd "$_builddir"
+	for i in $source; do
+		case $i in
+		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+		esac
+	done
+}
+
+build() {
+	cd "$_builddir"
+	cd support
+	make clean
+	cd ../src
+	make clean
+	make || return 1
+}
+
+package() {
+	cd "$_builddir"
+	cd src
+	make install DESTDIR="$pkgdir"
+}
+md5sums="377371c28ee3c21a76f7024920649ea8  iptraf-3.0.0.tar.gz
+5b440b76ed02037b777dbab678f4b0f4  kernel_install.patch"
+sha256sums="9ee433d95573d612539da4b452e6cdcbca6ab6674a88bfbf6eaf12d4902b5163  iptraf-3.0.0.tar.gz
+9fe76282c70d466ca9c7c82069ca539755afd29a88375c7d582bed17caaf7c6b  kernel_install.patch"
+sha512sums="f98064105a850ebd92675e6bd2d3ed5361c238f198f309f3960e1905ebb00dbbf52e3f5daea0b9e157c6dc3c55db7b0c0a1adcafce928dbd4a2cd9c9225dcdb3  iptraf-3.0.0.tar.gz
+3eb10ba42eac19decdd731537385e7618e5694a0d2b0ad7d55c39d5c67f71e4c49575393b060edb0338b1f9faecad0728345a48e8e75b377b6afcaee8ad7c795  kernel_install.patch"
diff --git a/testing/iptraf/kernel_install.patch b/testing/iptraf/kernel_install.patch
new file mode 100644
index 0000000..04360e4
--- /dev/null
+++ b/testing/iptraf/kernel_install.patch
@@ -0,0 +1,231 @@
+diff -Naur iptraf-3.0.0/src/dirs.h iptraf-3.0.0-alt/src/dirs.h
+--- iptraf-3.0.0/src/dirs.h	2005-09-13 08:42:54.000000000 +0200
++++ iptraf-3.0.0-alt/src/dirs.h	2013-09-16 11:57:34.533320245 +0200
+@@ -26,7 +26,7 @@
+  */
+ 
+ #ifndef WORKDIR
+-#define WORKDIR		"/var/local/iptraf"
++#define WORKDIR		"/var/iptraf"
+ #endif
+ 
+ #ifndef LOGDIR
+@@ -34,7 +34,7 @@
+ #endif
+ 
+ #ifndef EXECDIR
+-#define EXECDIR		"/usr/local/bin"
++#define EXECDIR		"/usr/bin"
+ #endif
+ 
+ /*
+diff -Naur iptraf-3.0.0/src/fltselect.c iptraf-3.0.0-alt/src/fltselect.c
+--- iptraf-3.0.0/src/fltselect.c	2005-09-13 08:42:54.000000000 +0200
++++ iptraf-3.0.0-alt/src/fltselect.c	2013-09-16 11:00:30.529255964 +0200
+@@ -26,7 +26,7 @@
+ #include <sys/stat.h>
+ #include <netinet/udp.h>
+ #include <netinet/in.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+ #include <winops.h>
+ #include <menurt.h>
+ #include <msgboxes.h>
+diff -Naur iptraf-3.0.0/src/hostmon.c iptraf-3.0.0-alt/src/hostmon.c
+--- iptraf-3.0.0/src/hostmon.c	2005-09-13 08:42:54.000000000 +0200
++++ iptraf-3.0.0-alt/src/hostmon.c	2013-09-16 11:00:30.605255966 +0200
+@@ -29,9 +29,9 @@
+ #include <asm/types.h>
+ #include <netinet/in.h>
+ #include <linux/if_packet.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+ #include <linux/if_fddi.h>
+-#include <linux/if_tr.h>
++#include <netinet/if_tr.h>
+ #include <net/if_arp.h>
+ #include <stdlib.h>
+ #include <time.h>
+diff -Naur iptraf-3.0.0/src/ifstats.c iptraf-3.0.0-alt/src/ifstats.c
+--- iptraf-3.0.0/src/ifstats.c	2005-09-13 08:42:54.000000000 +0200
++++ iptraf-3.0.0-alt/src/ifstats.c	2013-09-16 11:00:30.601255966 +0200
+@@ -36,7 +36,7 @@
+ #include <netinet/ip.h>
+ #include <netinet/tcp.h>
+ #include <netinet/udp.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+ #include <winops.h>
+ #include <labels.h>
+ #include <listbox.h>
+diff -Naur iptraf-3.0.0/src/install.sh iptraf-3.0.0-alt/src/install.sh
+--- iptraf-3.0.0/src/install.sh	2002-12-26 04:07:18.000000000 +0100
++++ iptraf-3.0.0-alt/src/install.sh	2013-09-16 12:13:00.481337629 +0200
+@@ -23,6 +23,7 @@
+ echo "*** Installing executable programs and preparing work directories"
+ echo
+ echo ">>> Installing iptraf in $TARGET"
++mkdir -p $TARGET
+ $INSTALL -m 0700 -o root -g root -s iptraf $TARGET
+ echo ">>> Installing rvnamed in $TARGET"
+ $INSTALL -m 0700 -o root -g root -s rvnamed $TARGET
+@@ -82,14 +83,10 @@
+ echo "======================================================================"
+ echo
+ echo "Please read the RELEASE-NOTES file for important new information about"
+-echo "this version. You can view this file now (will require the 'less'"
+-echo "program in /usr/bin.  Press Q to quit when done)."
++echo "this version."
+ echo
+-echo -n "Would you like to view the RELEASE-NOTES file now (Y/N)? "; read YESNO
+ 
+-if [ "$YESNO" = "y" -o "$YESNO" = "Y" ]; then
+-    less ../RELEASE-NOTES
+-fi
++cat ../RELEASE-NOTES
+ 
+ clear
+ echo
+diff -Naur iptraf-3.0.0/src/log.c iptraf-3.0.0-alt/src/log.c
+--- iptraf-3.0.0/src/log.c	2005-09-13 08:42:54.000000000 +0200
++++ iptraf-3.0.0-alt/src/log.c	2013-09-16 11:00:30.553255965 +0200
+@@ -22,7 +22,7 @@
+ #include <time.h>
+ #include <string.h>
+ #include <netinet/in.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+ #include <net/if_arp.h>
+ #include <input.h>
+ #include <msgboxes.h>
+diff -Naur iptraf-3.0.0/src/Makefile iptraf-3.0.0-alt/src/Makefile
+--- iptraf-3.0.0/src/Makefile	2005-09-13 11:11:17.000000000 +0200
++++ iptraf-3.0.0-alt/src/Makefile	2013-09-16 11:57:22.313320016 +0200
+@@ -68,12 +68,12 @@
+ # installation target directory.  The iptraf and rvnamed programs get
+ # stored here.  iptraf also exec's rvnamed from this directory.
+ 
+-TARGET		= /usr/local/bin
++TARGET		= /usr/bin
+ 
+ # The IPTraf working directory; if you change this.  Starting with this
+ # version, this definition overrides dirs.h.
+ 
+-WORKDIR		= /var/local/iptraf
++WORKDIR		= /var/iptraf
+ 
+ # The IPTraf log file directory.  IPTraf log files are placed here.
+ # This definition overrides dirs.h
+@@ -145,7 +145,7 @@
+ # installation rule
+ 
+ install:
+-	@./install.sh $(TARGET) $(WORKDIR) $(LOGDIR) $(LOCKDIR)
++	@./install.sh $(DESTDIR)$(TARGET) $(DESTDIR)$(WORKDIR) $(DESTDIR)$(LOGDIR) $(DESTDIR)$(LOCKDIR)
+ 
+ # Upgrade rule
+ #
+diff -Naur iptraf-3.0.0/src/othptab.c iptraf-3.0.0-alt/src/othptab.c
+--- iptraf-3.0.0/src/othptab.c	2005-09-13 08:42:54.000000000 +0200
++++ iptraf-3.0.0-alt/src/othptab.c	2013-09-16 11:00:30.577255965 +0200
+@@ -17,8 +17,8 @@
+ ***/
+ 
+ #include <asm/types.h>
+-#include <linux/if_ether.h>
+-#include <linux/if_tr.h>
++#include <netinet/if_ether.h>
++#include <netinet/if_tr.h>
+ #include <linux/if_fddi.h>
+ #include <winops.h>
+ #include "arphdr.h"
+diff -Naur iptraf-3.0.0/src/othptab.h iptraf-3.0.0-alt/src/othptab.h
+--- iptraf-3.0.0/src/othptab.h	2005-09-13 08:42:54.000000000 +0200
++++ iptraf-3.0.0-alt/src/othptab.h	2013-09-16 11:00:30.537255965 +0200
+@@ -17,7 +17,7 @@
+ #include <curses.h>
+ #include <panel.h>
+ #include <netdb.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+ #include "servname.h"
+ #include "addproto.h"
+ 
+diff -Naur iptraf-3.0.0/src/packet.c iptraf-3.0.0-alt/src/packet.c
+--- iptraf-3.0.0/src/packet.c	2005-09-13 08:42:54.000000000 +0200
++++ iptraf-3.0.0-alt/src/packet.c	2013-09-16 11:00:30.533255965 +0200
+@@ -34,9 +34,9 @@
+ #include <net/if.h>
+ #include <sys/ioctl.h>
+ #include <linux/if_packet.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+ #include <linux/if_fddi.h>
+-#include <linux/if_tr.h>
++#include <netinet/if_tr.h>
+ #include <linux/isdn.h>
+ #include <linux/sockios.h>
+ #include <msgboxes.h>
+diff -Naur iptraf-3.0.0/src/pktsize.c iptraf-3.0.0-alt/src/pktsize.c
+--- iptraf-3.0.0/src/pktsize.c	2005-09-13 08:42:54.000000000 +0200
++++ iptraf-3.0.0-alt/src/pktsize.c	2013-09-16 11:00:30.569255965 +0200
+@@ -27,7 +27,7 @@
+ #include <sys/socket.h>
+ #include <net/if.h>
+ #include <netinet/in.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+ #include <linux/if_packet.h>
+ #include <winops.h>
+ #include "attrs.h"
+diff -Naur iptraf-3.0.0/src/promisc.c iptraf-3.0.0-alt/src/promisc.c
+--- iptraf-3.0.0/src/promisc.c	2005-09-13 08:42:54.000000000 +0200
++++ iptraf-3.0.0-alt/src/promisc.c	2013-09-16 11:00:30.589255966 +0200
+@@ -33,7 +33,7 @@
+ #include <string.h>
+ #include <netinet/in.h>
+ #include <net/if.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+ #include "ifstats.h"
+ #include "ifaces.h"
+ #include "error.h"
+diff -Naur iptraf-3.0.0/src/serv.c iptraf-3.0.0-alt/src/serv.c
+--- iptraf-3.0.0/src/serv.c	2005-09-13 08:42:54.000000000 +0200
++++ iptraf-3.0.0-alt/src/serv.c	2013-09-16 11:00:30.545255965 +0200
+@@ -33,7 +33,7 @@
+ #include <netinet/ip.h>
+ #include <netinet/udp.h>
+ #include <linux/if_packet.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+ #include <listbox.h>
+ #include <labels.h>
+ #include <winops.h>
+diff -Naur iptraf-3.0.0/src/tcptable.h iptraf-3.0.0-alt/src/tcptable.h
+--- iptraf-3.0.0/src/tcptable.h	2005-09-13 08:42:54.000000000 +0200
++++ iptraf-3.0.0-alt/src/tcptable.h	2013-09-16 11:00:30.541255965 +0200
+@@ -21,9 +21,9 @@
+ #include <net/if_arp.h>
+ #include <asm/types.h>
+ #include <linux/if_packet.h>
+-#include <linux/if_ether.h>
++#include <netinet/if_ether.h>
+ #include <linux/if_fddi.h>
+-#include <linux/if_tr.h>
++#include <netinet/if_tr.h>
+ #include <net/if.h>
+ #include <netinet/ip.h>
+ #include <netinet/udp.h>
+diff -Naur iptraf-3.0.0/src/tr.c iptraf-3.0.0-alt/src/tr.c
+--- iptraf-3.0.0/src/tr.c	2005-09-13 08:42:54.000000000 +0200
++++ iptraf-3.0.0-alt/src/tr.c	2013-09-16 11:00:30.525255964 +0200
+@@ -7,7 +7,7 @@
+  */
+ 
+ #include <asm/types.h>
+-#include <linux/if_tr.h>
++#include <netinet/if_tr.h>
+ #include <netinet/in.h>
+ 
+ unsigned int get_tr_ip_offset(unsigned char *pkt)
-- 
1.8.2.3

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Natanael Copa <[email-masked]>
Date: Mon, 16 Sep 2013 14:19:51 +0200

On Mon, 16 Sep 2013 12:35:00 +0200

>  create mode 100644 testing/iptraf/kernel_install.patch

We used to have iptraf but it got replaced with iptraf-ng.
https://fedorahosted.org/iptraf-ng/

http://git.alpinelinux.org/cgit/aports/commit/?id=61d4acf8298fcbcdb0e57b3a132b16d71edeff57

are there any good reasons to resurrect iptraf?

-nc

---