# HG changeset patch # User Michael Schloh von Bennewitz # Date 1231783759 -3600 # Node ID b3a835aa617c0fd117a027ee638f207849f6c41d # Parent 6f9166cf333ab0cb7939c0f023e7b7c5cefdf296 Import new package spec for introduction into repository. diff -r 6f9166cf333a -r b3a835aa617c gmediaserver/fsl.gmediaserver --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gmediaserver/fsl.gmediaserver Mon Jan 12 19:09:19 2009 +0100 @@ -0,0 +1,16 @@ +## +## fsl.gmediaserver -- OSSP fsl configuration +## + +ident (gmediaserver)/.+ q{ + prefix( + prefix="%b %d %H:%M:%S %N <%L> $1[%P]: " + ) + -> { + debug: file( + path="@l_prefix@/var/gmediaserver/log/gmediaserver.log", + perm=0644 + ) + } +}; + diff -r 6f9166cf333a -r b3a835aa617c gmediaserver/gmediaserver.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gmediaserver/gmediaserver.patch Mon Jan 12 19:09:19 2009 +0100 @@ -0,0 +1,82 @@ +Index: src/interface.c +diff -Nau src/interface.c.orig src/interface.c +--- src/interface.c.orig 2005-09-10 09:25:40.000000000 +0200 ++++ src/interface.c 2006-10-30 23:18:46.644745000 +0100 +@@ -28,8 +28,19 @@ + #include /* ? */ + #include /* ? */ + #include /* ? */ ++#if (defined(sun) && defined(__svr4__)) ++#include ++#endif + #include "gmediaserver.h" + ++#ifndef MAX ++#define MAX(a,b) ((a) > (b) ? (a) : (b)) ++#endif ++ ++#ifndef MIN ++#define MIN(a,b) ((a) < (b) ? (a) : (b)) ++#endif ++ + char * + get_ip_by_spec(char *spec) + { +Index: src/metadata.c +diff -Nau src/metadata.c.orig src/metadata.c +--- src/metadata.c.orig 2007-02-27 14:10:38.630894000 +0100 ++++ src/metadata.c 2007-02-27 14:11:50.191849000 +0100 +@@ -1071,6 +1071,7 @@ + uint32_t c; + uint32_t child_count = 0; + ++ root_entry = make_entry(ROOT_ENTRY_NAME, -1, true); + children = xmalloc(sizeof(int32_t) * pathc); + for (c = 0; c < pathc; c++) { + Entry *entry; +@@ -1088,13 +1089,12 @@ + free(tmp); + } + +- entry = scan_entry(pathv[c], name, -1, indent_size, NULL); ++ entry = scan_entry(pathv[c], name, root_entry->id, indent_size, NULL); + if (entry != NULL) + children[child_count++] = entry->id; + free(name); + } + if (child_count != 0) { +- root_entry = make_entry(ROOT_ENTRY_NAME, -1, true); + detail = get_entry_detail(root_entry, DETAIL_CHILDREN); + detail->data.children.count = child_count; + detail->data.children.list = children; +Index: lib/Makefile.in +diff -Nau lib/Makefile.in.orig lib/Makefile.in +--- lib/Makefile.in.orig 2006-08-29 22:53:57.000000000 +0200 ++++ lib/Makefile.in 2006-11-01 10:25:38.000000000 +0100 +@@ -112,7 +112,16 @@ + full-write.$(OBJEXT) getnline.$(OBJEXT) progname.$(OBJEXT) \ + striconv.$(OBJEXT) version-etc.$(OBJEXT) xalloc-die.$(OBJEXT) \ + xgethostname.$(OBJEXT) xstrndup.$(OBJEXT) xvasprintf.$(OBJEXT) \ +- xasprintf.$(OBJEXT) ++ xasprintf.$(OBJEXT) xmalloc.$(OBJEXT) quote.$(OBJEXT) error.$(OBJEXT) \ ++ quotearg.$(OBJEXT) strftime.$(OBJEXT) \ ++ strndup.$(OBJEXT) strnlen.$(OBJEXT) \ ++ getopt.$(OBJEXT) getopt1.$(OBJEXT) \ ++ basename.$(OBJEXT) dirname.$(OBJEXT) \ ++ vasprintf.$(OBJEXT) vasnprintf.$(OBJEXT) \ ++ full-read.$(OBJEXT) safe-read.$(OBJEXT) \ ++ full-write.$(OBJEXT) safe-write.$(OBJEXT) \ ++ printf-args.$(OBJEXT) printf-parse.$(OBJEXT) \ ++ exitfail.$(OBJEXT) getndelim2.$(OBJEXT) sig2str.$(OBJEXT) + libgnu_a_OBJECTS = $(am_libgnu_a_OBJECTS) + LTLIBRARIES = $(noinst_LTLIBRARIES) + DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +@@ -553,7 +562,7 @@ + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + libgnu.a: $(libgnu_a_OBJECTS) $(libgnu_a_DEPENDENCIES) + -rm -f libgnu.a +- $(libgnu_a_AR) libgnu.a $(libgnu_a_OBJECTS) $(libgnu_a_LIBADD) ++ $(libgnu_a_AR) libgnu.a $(libgnu_a_OBJECTS) + $(RANLIB) libgnu.a + + clean-noinstLTLIBRARIES: diff -r 6f9166cf333a -r b3a835aa617c gmediaserver/gmediaserver.spec --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gmediaserver/gmediaserver.spec Mon Jan 12 19:09:19 2009 +0100 @@ -0,0 +1,171 @@ +## +## gmediaserver.spec -- OpenPKG RPM Specification +## Copyright (c) 2009 Michael Schloh von Bennewitz +## +## Permission to use, copy, modify, and distribute this software for +## any purpose with or without fee is hereby granted, provided that +## the above copyright notice and this permission notice appear in all +## copies. +## +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +## SUCH DAMAGE. +## + + +# package information +Name: gmediaserver +Summary: UPnP Media Server +URL: http://www.gnu.org/software/gmediaserver/ +Vendor: Oskar Liljeblad +Packager: Michael Schloh von Bennewitz +Distribution: Michael Schloh von Bennewitz +Class: EVAL +Group: Network +License: GPL +Version: 0.13.0 +Release: 20090106 + +# package options +%option with_fsl yes + +# list of sources +Source0: http://www.very-clever.com/download/nongnu/gmediaserver/gmediaserver-%{version}.tar.gz +Source1: rc.gmediaserver +Source2: fsl.gmediaserver +Patch0: gmediaserver.patch + +# build information +Prefix: %{l_prefix} +BuildRoot: %{l_buildroot} +BuildPreReq: OpenPKG, openpkg >= 20040130, gcc +PreReq: OpenPKG, openpkg >= 20040130, gcc +BuildPreReq: libupnp, file, id3lib, taglib +PreReq: libupnp, file, id3lib, taglib +%if "%{with_fsl}" == "yes" +BuildPreReq: fsl >= 1.2.0 +PreReq: fsl >= 1.2.0 +%endif +AutoReq: no +AutoReqProv: no + +%description + GMediaServer is a console based UPnP compatible media server. + It serves audio and video files to those network connected media + players capable of receiving media over UPnP. + +%track + prog gmediaserver = { + version = %{version} + url = http://www.very-clever.com/download/nongnu/gmediaserver/ + regex = gmediaserver-(__VER__)\.tar\.gz + } + +%prep + # unpack sources + %setup -q + %patch -p0 + + # correct build configuration + %{l_shtool} subst \ + -e 's;\(LIBS="-lupnp\) \(\$LIBS"\);\1 -lixml -lthreadutil \2;' \ + -e 's;\(UPNP_LIBS="\$PTHREAD_LIBS -L\$prefixupnp/lib -lupnp\);\1 -lixml -lthreadutil;' \ + -e 's;\(LIBMAGIC=\)\(-lmagic\);\1"\2 -lz";' \ + configure + %{l_shtool} subst \ + -e 's/tm.tm_zone = "GMT";/tzname[0] = "GMT";/' \ + src/webclient.c + +%build + # prepare configuration + CC="%{l_cc}" \ + CFLAGS="%{l_cflags -O} -pthread" \ + CPPFLAGS="%{l_cppflags}" \ + LDFLAGS="%{l_ldflags} %{l_fsl_ldflags} -pthread" \ + LIBS="%{l_fsl_libs}" \ + GREP="grep" \ + ./configure \ + --prefix=%{l_prefix} \ + --disable-nls + + # use the internal getopt definitions + cd lib && %{l_make} %{l_mflags} getopt.h iconv_.h + + # build using parallel make + %{l_make} %{l_mflags -O} + +%install + # remove previously existing installations + rm -rf $RPM_BUILD_ROOT + + # run the native installation logic + %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT + + # create additional installation paths + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/var/gmediaserver/log \ + $RPM_BUILD_ROOT%{l_prefix}/var/gmediaserver/run + + # correct the installation hierarchy + mv $RPM_BUILD_ROOT%{l_prefix}/share/man \ + $RPM_BUILD_ROOT%{l_prefix}/ + mv $RPM_BUILD_ROOT%{l_prefix}/share/info \ + $RPM_BUILD_ROOT%{l_prefix}/ + rm -rf $RPM_BUILD_ROOT%{l_prefix}/share + + # strip binaries laden with symbols + strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true + + # install runcommand script + %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + %{SOURCE rc.gmediaserver} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ + + # install OSSP fsl configuration + %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl + %{l_shtool} install -c -m 644 %{l_value -s -a} \ + %{SOURCE fsl.gmediaserver} \ + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ + + # determine installation files + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ + %{l_files_std} \ + '%not %dir %{l_prefix}/etc/fsl' \ + '%config %{l_prefix}/etc/fsl/fsl.gmediaserver' + +%files -f files + +%clean + rm -rf $RPM_BUILD_ROOT + +%pre + # before upgrading package, record runtime status and stop service + [ $1 -eq 2 ] || exit 0 + eval `%{l_rc} gmediaserver status 2>/dev/null | tee %{l_tmpfile}` + %{l_rc} gmediaserver stop 2>/dev/null + exit 0 + +%post + if [ $1 -eq 2 ]; then + # after upgrading package, restore runtime status + eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} >/dev/null 2>&1 || true + [ ".$gmediaserver_active" = .yes ] && %{l_rc} gmediaserver start + fi + exit 0 + +%preun + # before removing package, stop service and remove log files + [ $1 -eq 0 ] || exit 0 + %{l_rc} gmediaserver stop 2>/dev/null + rm -f $RPM_INSTALL_PREFIX/var/gmediaserver/log/* >/dev/null 2>&1 || true + exit 0 + diff -r 6f9166cf333a -r b3a835aa617c gmediaserver/rc.gmediaserver --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gmediaserver/rc.gmediaserver Mon Jan 12 19:09:19 2009 +0100 @@ -0,0 +1,86 @@ +#!@l_prefix@/bin/openpkg rc +## +## rc.gmediaserver -- runcommands +## + +%config + gmediaserver_enable="$openpkg_rc_def" + gmediaserver_log_prolog="true" + gmediaserver_log_epilog="true" + gmediaserver_log_numfiles="10" + gmediaserver_log_minsize="1M" + gmediaserver_log_complevel="9" + gmediaserver_name="GMediaServer" + gmediaserver_fschar="ISO-8859-1" + gmediaserver_devchar="ISO-8859-1" + gmediaserver_logchar="ISO-8859-1" + gmediaserver_profile="generic" + gmediaserver_ftypes="mp3,wav,ogg,pls,m3u,jpg,png" + gmediaserver_expire="100" + gmediaserver_iface="lo0" + gmediaserver_port="49152" + gmediaserver_dirs="@l_prefix@/pub" + +%common + gmediaserver_pidfile="@l_prefix@/var/gmediaserver/run/gmediaserver.pid" + gmediaserver_logfile="@l_prefix@/var/gmediaserver/log/gmediaserver.log" + gmediaserver_signal () { + [ -f $gmediaserver_pidfile ] && kill -$1 `cat $gmediaserver_pidfile` + } + +%status -u @l_susr@ -o + gmediaserver_usable="no" + gmediaserver_active="no" + rcService gmediaserver enable yes && \ + gmediaserver_usable="yes" + rcService gmediaserver enable yes && \ + gmediaserver_signal 0 && gmediaserver_active="yes" + echo "gmediaserver_enable=\"$gmediaserver_enable\"" + echo "gmediaserver_usable=\"$gmediaserver_usable\"" + echo "gmediaserver_active=\"$gmediaserver_active\"" + +%start -u @l_susr@ + rcService gmediaserver enable yes || exit 0 + rcService gmediaserver active yes && exit 0 + @l_prefix@/bin/gmediaserver \ + --friendly-name=$gmediaserver_name \ + --fs-charset=$gmediaserver_fschar \ + --device-charset=$gmediaserver_devchar \ + --log-charset=$gmediaserver_logchar \ + --profile=$gmediaserver_profile \ + --file-types=$gmediaserver_ftypes \ + --expire-time=$gmediaserver_expire \ + --interface=$gmediaserver_iface \ + --port=$gmediaserver_port \ + --pid-file=$gmediaserver_pidfile \ + --output=$gmediaserver_logfile \ + --background \ + --timestamp \ + $gmediaserver_dirs + +%stop -u @l_susr@ + rcService gmediaserver enable yes || exit 0 + rcService gmediaserver active no && exit 0 + gmediaserver_signal TERM + +%restart -u @l_susr@ + rcService gmediaserver enable yes || exit 0 + rcService gmediaserver active no && exit 0 + rc gmediaserver stop + sleep 2 + rc gmediaserver start + +%reload -u @l_susr@ + rcService gmediaserver enable yes || exit 0 + rcService gmediaserver active no && exit 0 + gmediaserver_signal USR1 + +%daily -u @l_susr@ + rcService gmediaserver enable yes || exit 0 + shtool rotate -f \ + -n ${gmediaserver_log_numfiles} -s ${gmediaserver_log_minsize} -d \ + -z ${gmediaserver_log_complevel} -o @l_susr@ -g @l_mgrp@ -m 644 \ + -P "${gmediaserver_log_prolog}" \ + -E "${gmediaserver_log_epilog}; rc gmediaserver restart" \ + @l_prefix@/var/gmediaserver/log/gmediaserver.log \ + @l_prefix@/var/gmediaserver/log/arpsnmp.log diff -r 6f9166cf333a -r b3a835aa617c id3lib/id3lib.spec --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/id3lib/id3lib.spec Mon Jan 12 19:09:19 2009 +0100 @@ -0,0 +1,100 @@ +## +## id3lib.spec -- OpenPKG RPM Specification +## Copyright (c) 2009 Michael Schloh von Bennewitz +## +## Permission to use, copy, modify, and distribute this software for +## any purpose with or without fee is hereby granted, provided that +## the above copyright notice and this permission notice appear in all +## copies. +## +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +## SUCH DAMAGE. +## + + +# package information +Name: id3lib +Summary: ID3v1 and ID3v2 SDK +URL: http://id3lib.sourceforge.net/ +Vendor: Thijmen Klok +Packager: Michael Schloh von Bennewitz +Distribution: Michael Schloh von Bennewitz +Class: EVAL +Group: Audio +License: LGPL +Version: 3.8.3 +Release: 20090106 + +# list of sources +Source0: http://switch.dl.sourceforge.net/id3lib/id3lib-%{version}.tar.gz + +# build information +Prefix: %{l_prefix} +BuildRoot: %{l_buildroot} +BuildPreReq: OpenPKG, openpkg >= 20040130, gcc, make +PreReq: OpenPKG, openpkg >= 20040130 +AutoReq: no +AutoReqProv: no + +%description + id3lib is an Opensource, cross platform software development library + for reading, writing, and manipulating ID3v1 and ID3v2 tags. It is + an ongoing project whose primary goals are full compliance with the + ID3v2 standard, portability across several platforms, and providing + a powerful and feature rich API with a highly stable and efficient + implementation. + +%track + prog id3lib = { + version = %{version} + url = http://switch.dl.sourceforge.net/id3lib/ + regex = id3lib-(__VER__)\.tar\.gz + } + +%prep + # unpack sources + %setup -q + +%build + # prepare configuration + CC="%{l_cc}" \ + CXX="%{l_cxx}" \ + CFLAGS="%{l_cflags -O}" \ + CXXFLAGS="%{l_cxxflags -O}" \ + CPPFLAGS="%{l_cppflags}" \ + LDFLAGS="%{l_ldflags}" \ + ./configure \ + --prefix=%{l_prefix} \ + --disable-shared + + # build using parallel make + %{l_make} %{l_mflags -O} + +%install + # remove previously existing installations + rm -rf $RPM_BUILD_ROOT + + # run the native installation logic + %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT + + # strip binaries of symbols + strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true + + # determine installation files + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} + +%files -f files + +%clean + rm -rf $RPM_BUILD_ROOT + diff -r 6f9166cf333a -r b3a835aa617c tun/tun.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tun/tun.patch Mon Jan 12 19:09:19 2009 +0100 @@ -0,0 +1,53 @@ +Index: linux/2.2/tun.c +--- linux/2.2/tun.c.orig 2006-10-10 14:45:00.338589000 +0200 ++++ linux/2.2/tun.c 2006-10-10 14:44:05.695404000 +0200 +@@ -178,10 +178,22 @@ + + DBG( KERN_INFO "%s: tun_chr_poll\n", tun->name); + ++ /* Data written to the /dev/tunX device is immediately placed into a socket buffer, making it ++ * available to networking code at the tunX interface. Writes never block. ++ * Likewise, data flows from the network stack, through the tunX interface and into the /dev/tun* device, ++ * where it is queued, making it available for read(). ++ * Thus the character device /dev/tunX is: ++ * - readable if data was "transmitted" to the tunX interface and is now queued at the /dev/tunX device. ++ * - always writable. ++ * Everything written here is equally true of taps. ++ * The author made a mistake when implementing this routine; he forgot that the device is always writable. ++ * -jeff stearns 22-Dec-2005 ++ */ ++ + poll_wait(file, &tun->read_wait, wait); + + if( skb_queue_len(&tun->txq) ) +- return POLLIN | POLLRDNORM; ++ return POLLIN | POLLRDNORM | POLLOUT | POLLWRNORM; + + return POLLOUT | POLLWRNORM; + } +Index: linux/2.4/tun.c +--- linux/2.4/tun.c.orig 2006-10-10 14:41:57.910408000 +0200 ++++ linux/2.4/tun.c 2006-10-10 14:43:40.067700000 +0200 +@@ -176,9 +176,21 @@ + DBG(KERN_INFO "%s: tun_chr_poll\n", tun->name); + + poll_wait(file, &tun->read_wait, wait); ++ ++ /* Data written to the /dev/tunX device is immediately placed into a socket buffer, making it ++ * available to networking code at the tunX interface. Writes never block. ++ * Likewise, data flows from the network stack, through the tunX interface and into the /dev/tun* device, ++ * where it is queued, making it available for read(). ++ * Thus the character device /dev/tunX is: ++ * - readable if data was "transmitted" to the tunX interface and is now queued at the /dev/tunX device. ++ * - always writable. ++ * Everything written here is equally true of taps. ++ * The author made a mistake when implementing this routine; he forgot that the device is always writable. ++ * -jeff stearns 22-Dec-2005 ++ */ + + if (skb_queue_len(&tun->txq)) +- return POLLIN | POLLRDNORM; ++ return POLLIN | POLLRDNORM | POLLOUT | POLLWRNORM; + + return POLLOUT | POLLWRNORM; + } diff -r 6f9166cf333a -r b3a835aa617c tun/tun.spec --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tun/tun.spec Mon Jan 12 19:09:19 2009 +0100 @@ -0,0 +1,137 @@ +## +## tun.spec -- OpenPKG RPM Specification +## Copyright (c) 2009 Michael Schloh von Bennewitz +## +## Permission to use, copy, modify, and distribute this software for +## any purpose with or without fee is hereby granted, provided that +## the above copyright notice and this permission notice appear in all +## copies. +## +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +## SUCH DAMAGE. +## + +# MSvB Fixme: Device driver could possibly be stripped +# %{l_shtool} install -c -m -s 755 \ +# tun $RPM_BUILD_ROOT%{l_prefix}/lib/tun + +# package information +Name: tun +Summary: Universal TUN/TAP Device Driver +URL: http://vtun.sourceforge.net/tun/ +Vendor: Maxim Krasnyansky +Packager: Michael Schloh von Bennewitz +Distribution: Michael Schloh von Bennewitz +Class: EVAL +Group: Driver +License: GPL +Version: 1.1 +Release: 20090106 + +# list of sources +Source0: http://vtun.sourceforge.net/tun/tun-%{version}.tar.gz +Patch0: tun.patch + +# build information +Prefix: %{l_prefix} +BuildRoot: %{l_buildroot} +BuildPreReq: OpenPKG, openpkg >= 20050726 +PreReq: OpenPKG, openpkg >= 20050726 +AutoReq: no +AutoReqProv: no + +%description + Tun provides packet reception and transmission for user space + programs. It can be viewed as a simple Point-to-Point device, which + instead of receiving packets from a physical media, receives them + from user space program and instead of sending packets via physical + media writes them to the user space program. + +%track + prog tun = { + version = %{version} + url = http://vtun.sourceforge.net/tun/ + regex = tun-(__VER__)\.tar\.gz + } + +%prep + %setup -q -n tun-%{version} + %patch -p0 + +%build + CC="%{l_cc}" \ + CFLAGS="%{l_cflags -O}" \ + ./configure \ + --prefix=%{l_prefix} + locplat=`grep 'OS_DIR *=' Makefile | sed -e 's;OS_DIR[^=][^=]*= *\([^ ][^ ]*\);\1;'` + ( cd $locplat + %{l_make} %{l_mflags -O} + ) || exit $? + +%install + rm -rf $RPM_BUILD_ROOT + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/lib/tun + locplat=`grep 'OS_DIR *=' Makefile | sed -e 's;OS_DIR[^=][^=]*= *\([^ ][^ ]*\);\1;'` + ( cd $locplat + %{l_shtool} install -c -m 644 \ + tun tun.conf if_tun.h $RPM_BUILD_ROOT%{l_prefix}/lib/tun + ) || exit $? + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} + +%files -f files + +%clean + rm -rf $RPM_BUILD_ROOT + +%post + if [ $1 -eq 1 -o $1 -eq 2 ]; then + # announce special nature of this package + ( echo "Attention: The special nature of the package contents require privileged" + echo "interation, and must be carefully copied and nonportably installed to" + echo "system areas outside of the OpenPKG instance." + echo "" + echo "This package therefore does not conform to basic OpenPKG principles, and" + echo "should be removed immediately after its short term utility is exhausted." + echo "" + echo "To complete the installation on a SVR4 style operating system:" + echo "" + echo " $ su -" + echo " # find %{l_prefix}/lib/tun/ -print" + echo " # shtool install -c -m 755 -o root -g sys tun /usr/kernel/drv/" + echo " # shtool install -c -m 644 -o root -g sys tun.conf /usr/kernel/drv/" + echo " # shtool install -c -m 644 -o root -g bin if_tun.h /usr/include/net/" + echo " # /usr/sbin/rem_drv tun" + echo " # /usr/sbin/add_drv tun" + ) | %{l_rpmtool} msg -b -t notice + fi + exit 0 + +%postun + [ $1 -eq 0 ] || exit 0 + # announce special nature of this package on uninstall + ( echo "Attention: The special nature of the package contents require privileged" + echo "interation, and must be carefully deleted and nonportably uninstalled" + echo "from system areas outside of the OpenPKG instance." + echo "" + echo " $ su -" + echo " # ls -ld /usr/kernel/drv/*tun* /usr/include/net/*tun*" + echo " # /usr/sbin/rem_drv tun" + echo " # ls -ld /usr/kernel/drv/*tun*" + echo " # ls -ld /usr/include/net/*tun*" + echo " # rm -f /usr/kernel/drv/tun" + echo " # rm -f /usr/kernel/drv/tun.conf" + echo " # rm -f /usr/include/net/if_tun.h" + ) | %{l_rpmtool} msg -b -t notice + exit 0 +