ports/101958: RCify misc/zaptel and cleanup
Anish Mistry
amistry at am-productions.biz
Sun Aug 13 06:10:17 UTC 2006
>Number: 101958
>Category: ports
>Synopsis: RCify misc/zaptel and cleanup
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Sun Aug 13 06:10:11 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator: Anish Mistry
>Release: FreeBSD 6.1-RELEASE-p1 i386
>Organization:
AM Productions
>Environment:
System: FreeBSD 6.1-RELEASE-p1 #0: Thu Jun 1 21:16:20 EDT 2006
amistry at bigguy.am-productions.biz:/usr/obj/usr/src/sys/BIGGUY
>Description:
RCify the startup so we can allow other scripts to depend on zaptel loading first. Make use of SUB_FILES for pkg-message. Also included is patch to fix the panic: sleeping without a mutex problem on CURRENT. This should probably should have been submitted separately.
>How-To-Repeat:
>Fix:
--- zaptel-rcify.patch begins here ---
diff -ruN zaptel.orig/Makefile zaptel/Makefile
--- zaptel.orig/Makefile Sun Aug 13 00:29:52 2006
+++ zaptel/Makefile Sun Aug 13 01:34:42 2006
@@ -20,13 +20,14 @@
ONLY_FOR_ARCHS= i386
-PKGMESSAGE= ${WRKSRC}/.MESSAGE
MAKE_ENV= KMODDIR=${PREFIX}/lib/zaptel
+SUB_FILES= pkg-message
+USE_RC_SUBR= zaptel
.include <bsd.port.pre.mk>
.if ${OSVERSION} < 500000
-IGNORE= "does not build on FreeBSD \< 5.x"
+IGNORE= does not build on FreeBSD \< 5.x
.endif
pre-everything::
@@ -42,15 +43,10 @@
${WRKSRC}/ztcfg/ztcfg.c
pre-su-install:
- @${SED} 's|%%PREFIX%%|${PREFIX}|g' ${PKGDIR}/pkg-message > \
- ${PKGMESSAGE}
- @${SED} 's|%%PREFIX%%|${PREFIX}|g' ${FILESDIR}/zaptel.sh > \
- ${WRKDIR}/zaptel.sh.sample
@${MKDIR} ${PREFIX}/lib/zaptel
post-install:
@${TOUCH} ${PREFIX}/lib/zaptel/linker.hints
- @${INSTALL_SCRIPT} ${WRKDIR}/zaptel.sh.sample ${PREFIX}/etc/rc.d
@${CAT} ${PKGMESSAGE}
.include <bsd.port.post.mk>
diff -ruN zaptel.orig/files/patch-zaptel_zaptel.c zaptel/files/patch-zaptel_zaptel.c
--- zaptel.orig/files/patch-zaptel_zaptel.c Wed Dec 31 19:00:00 1969
+++ zaptel/files/patch-zaptel_zaptel.c Fri Aug 11 11:57:02 2006
@@ -0,0 +1,11 @@
+--- zaptel/zaptel.c.orig Sun Jun 25 14:21:49 2006
++++ zaptel/zaptel.c Fri Aug 11 11:56:20 2006
+@@ -397,7 +397,7 @@
+
+ int schluffen(void *q)
+ {
+- int rc = tsleep(q, PZERO | PCATCH, "schluffen", 0);
++ int rc = tsleep(q, PZERO | PCATCH, "schluffen", 10);
+ switch(rc)
+ {
+ case EINTR:
diff -ruN zaptel.orig/files/pkg-message.in zaptel/files/pkg-message.in
--- zaptel.orig/files/pkg-message.in Wed Dec 31 19:00:00 1969
+++ zaptel/files/pkg-message.in Sun Aug 13 01:09:17 2006
@@ -0,0 +1,27 @@
+-------------------------------------------------------------------------------
+IMPORTANT! MAKE SURE TO READ THE FOLLOWING!
+
+To use the driver set zaptel_enable="YES" in your rc.conf.
+
+To load the driver run (as root):
+
+# %%PREFIX%%/etc/rc.d/zaptel start
+
+To unload it:
+
+# %%PREFIX%%/etc/rc.d/zaptel stop
+
+It'll also load the driver automatically when the system is started.
+
+Report problems to Alexander Timoshenko <gonzo at pbxpress.com>. Please note that
+it is still "work in progress" so that your bug reports are welcome and will
+help to improve quality of the drivers.
+
+Great thanks to all companies and individuals who made this driver happen,
+including but not limited to, John Todd, Chris Coleman, Alexander Timoshenko,
+PBXpress, Inc, Max Khon, LF.net, Luigi Rizzo and others contributors.
+
+Thanks and enjoy!
+
+-Maxim
+-------------------------------------------------------------------------------
diff -ruN zaptel.orig/files/zaptel.in zaptel/files/zaptel.in
--- zaptel.orig/files/zaptel.in Wed Dec 31 19:00:00 1969
+++ zaptel/files/zaptel.in Sun Aug 13 01:49:33 2006
@@ -0,0 +1,51 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: zaptel
+# REQUIRE: NETWORKING
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# zaptel_enable (bool): Set to NO by default.
+# Set it to YES to enable zaptel.
+#
+
+. %%RC_SUBR%%
+
+kmod_dir=%%PREFIX%%/lib/zaptel
+
+kmod_load="qozap.ko wcfxs.ko wcfxo.ko wct1xxp.ko wct4xxp.ko wcte11xp.ko"
+name="zaptel"
+rcvar=${name}_enable
+
+start_cmd="zaptel_start"
+stop_cmd="zaptel_stop"
+
+zaptel_start()
+{
+ echo "Starting ${name}."
+ kldload ${kmod_dir}/${name}.ko
+ for kmod in ${kmod_load}
+ do
+ kldload ${kmod_dir}/${kmod}
+ done
+}
+
+zaptel_stop()
+{
+ echo "Stopping ${name}."
+ for kmod in ${kmod_load}
+ do
+ kldunload ${kmod}
+ done
+ kldunload ${name}.ko
+}
+load_rc_config $name
+
+: ${zaptel_enable="NO"}
+
+run_rc_command "$1"
+
diff -ruN zaptel.orig/files/zaptel.sh zaptel/files/zaptel.sh
--- zaptel.orig/files/zaptel.sh Sun Aug 13 00:29:46 2006
+++ zaptel/files/zaptel.sh Wed Dec 31 19:00:00 1969
@@ -1,36 +0,0 @@
-#!/bin/sh
-
-PREFIX=%%PREFIX%%
-LIBDIR=${PREFIX}/lib/zaptel
-
-case "$1" in
- start)
- /sbin/kldload ${LIBDIR}/zaptel.ko || exit 1
- /sbin/kldload ${LIBDIR}/qozap.ko || exit 1
- /sbin/kldload ${LIBDIR}/wcfxo.ko || exit 1
- /sbin/kldload ${LIBDIR}/wcfxs.ko || exit 1
- /sbin/kldload ${LIBDIR}/wct1xxp.ko || exit 1
- /sbin/kldload ${LIBDIR}/wct4xxp.ko || exit 1
- /sbin/kldload ${LIBDIR}/wcte11xp.ko || exit 1
- ${PREFIX}/bin/ztcfg
- echo -n " zaptel"
- ;;
-
- stop)
- /sbin/kldunload qozap.ko || exit 1
- /sbin/kldunload wcfxs.ko || exit 1
- /sbin/kldunload wcfxo.ko || exit 1
- /sbin/kldunload wct1xxp.ko || exit 1
- /sbin/kldunload wct4xxp.ko || exit 1
- /sbin/kldunload wcte11xp.ko || exit 1
- /sbin/kldunload zaptel.ko || exit 1
- echo -n " zaptel"
- ;;
-
- *)
- echo ""
- echo "Usage: `basename $0` { start | stop }"
- echo ""
- exit 64
- ;;
-esac
diff -ruN zaptel.orig/pkg-message zaptel/pkg-message
--- zaptel.orig/pkg-message Sun Aug 13 00:29:52 2006
+++ zaptel/pkg-message Wed Dec 31 19:00:00 1969
@@ -1,28 +0,0 @@
--------------------------------------------------------------------------------
-IMPORTANT! MAKE SURE TO READ THE FOLLOWING!
-
-To use the driver, make a copy of %%PREFIX%%/etc/rc.d/zaptel.sh.sample
-under %%PREFIX%%/etc/rc.d/zaptel.sh.
-
-To load the driver run (as root):
-
-# %%PREFIX%%/etc/rc.d/zaptel.sh start
-
-To unload it:
-
-# %%PREFIX%%/etc/rc.d/zaptel.sh stop
-
-It'll also load the driver automatically when the system is started.
-
-Report problems to Alexander Timoshenko <gonzo at pbxpress.com>. Please note that
-it is still "work in progress" so that your bug reports are welcome and will
-help to improve quality of the drivers.
-
-Great thanks to all companies and individuals who made this driver happen,
-including but not limited to, John Todd, Chris Coleman, Alexander Timoshenko,
-PBXpress, Inc, Max Khon, LF.net, Luigi Rizzo and others contributors.
-
-Thanks and enjoy!
-
--Maxim
--------------------------------------------------------------------------------
diff -ruN zaptel.orig/pkg-plist zaptel/pkg-plist
--- zaptel.orig/pkg-plist Sun Aug 13 00:29:52 2006
+++ zaptel/pkg-plist Sun Aug 13 00:52:56 2006
@@ -3,7 +3,6 @@
bin/ztmonitor
bin/zttest
bin/zttool
-etc/rc.d/zaptel.sh.sample
include/tonezone.h
include/zaptel.h
lib/libtonezone.a
--- zaptel-rcify.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list