From owner-freebsd-ports-bugs@FreeBSD.ORG Sat Jul 30 07:40:09 2011 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5EB87106566B for ; Sat, 30 Jul 2011 07:40:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 37AA28FC1C for ; Sat, 30 Jul 2011 07:40:09 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p6U7e9gu079452 for ; Sat, 30 Jul 2011 07:40:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p6U7e9Ld079451; Sat, 30 Jul 2011 07:40:09 GMT (envelope-from gnats) Resent-Date: Sat, 30 Jul 2011 07:40:09 GMT Resent-Message-Id: <201107300740.p6U7e9Ld079451@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Zhihao Yuan Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E998106566C for ; Sat, 30 Jul 2011 07:34:58 +0000 (UTC) (envelope-from lichray@gmail.com) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id 1B5438FC08 for ; Sat, 30 Jul 2011 07:34:57 +0000 (UTC) Received: by iyb11 with SMTP id 11so6520576iyb.13 for ; Sat, 30 Jul 2011 00:34:57 -0700 (PDT) Received: by 10.43.134.136 with SMTP id ic8mr783584icc.140.1312011297317; Sat, 30 Jul 2011 00:34:57 -0700 (PDT) Received: from compaq.yuetime (c-98-228-191-105.hsd1.il.comcast.net [98.228.191.105]) by mx.google.com with ESMTPS id h6sm556977icw.7.2011.07.30.00.34.54 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 30 Jul 2011 00:34:56 -0700 (PDT) Received: by compaq.yuetime (sSMTP sendmail emulation); Sat, 30 Jul 2011 02:34:53 -0500 Message-Id: <4e33b420.46982a0a.20d3.1645@mx.google.com> Date: Sat, 30 Jul 2011 02:34:53 -0500 From: Zhihao Yuan To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/159306: multimedia/webcamd: New rc script with $webcamd_device X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Zhihao Yuan List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 07:40:09 -0000 >Number: 159306 >Category: ports >Synopsis: multimedia/webcamd: New rc script with $webcamd_device >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Jul 30 07:40:08 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Zhihao Yuan >Release: FreeBSD 8.2-STABLE amd64 >Organization: Northern Illinois University >Environment: System: FreeBSD compaq.yuetime 8.2-STABLE FreeBSD 8.2-STABLE #4 r224501: Fri Jul 29 22:28:38 CDT 2011 lichray@compaq.yuetime:/usr/obj/home/lichray/devel/freebsd-stable/sys/HOUKAGO amd64 >Description: The current rc script is just unusable. It requires your to pass the device name by hand. >How-To-Repeat: >Fix: I added a $webcamd_device variable, and changes pidfile accordingly. Note that the pid in the $pidfile is wrong, and I fixed it by hacking into the file content. I'm not pro at writing rc script. Please help me improve it, thx. --- webcamd_rc_2.patch begins here --- diff -ruN --exclude=CVS /usr/ports/multimedia/webcamd.orig/Makefile /usr/ports/multimedia/webcamd/Makefile --- /usr/ports/multimedia/webcamd.orig/Makefile 2011-07-16 16:35:48.000000000 -0500 +++ /usr/ports/multimedia/webcamd/Makefile 2011-07-30 01:41:36.768846639 -0500 @@ -7,7 +7,7 @@ PORTNAME= webcamd PORTVERSION= 3.0.0.1 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= multimedia MASTER_SITES= http://www.selasky.org/hans_petter/distfiles/ \ http://hselasky.homeunix.org:8192/distfiles/ diff -ruN --exclude=CVS /usr/ports/multimedia/webcamd.orig/files/webcamd.in /usr/ports/multimedia/webcamd/files/webcamd.in --- /usr/ports/multimedia/webcamd.orig/files/webcamd.in 2011-04-21 04:06:26.000000000 -0500 +++ /usr/ports/multimedia/webcamd/files/webcamd.in 2011-07-30 02:15:45.929261409 -0500 @@ -7,6 +7,7 @@ # Add the following line to /etc/rc.conf[.local] to enable webcamd: # # webcamd_enable="YES" +# webcamd_device="ugenX.X" # webcamd_enable=${webcamd_enable-"NO"} @@ -20,20 +21,35 @@ command_args="-B -U webcamd -G webcamd" start_precmd="${name}_prestart" +start_postcmd="${name}_fixpidfile" +stop_precmd="${name}_check_vars" webcamd_prestart() { if checkyesno hald_enable ; then command_args="$command_args -H" fi + webcamd_check_vars } -pidfile="/var/run/webcamd.*.0.pid" +webcamd_check_vars() +{ + if [ $# -gt 1 ]; then + webcamd_device="$2" + elif [ "x${webcamd_device}" = "x" ]; then + warn "You should set webcamd_device before running this" + return 1 + fi + command_args="$command_args -d ${webcamd_device} -i 0" + pidfile="/var/run/webcamd.${webcamd_device##ugen}.0.pid" +} + +webcamd_fixpidfile() +{ + read pid < $pidfile + pid="$(expr $pid + 1)" + echo -n "$pid" > $pidfile +} load_rc_config $name -if [ $# -gt 1 ]; then - pidfile="webcamd.dummy" - command_args="$command_args -d $2 -i 0" - # Only run the rc command if the appropriate arguments are specified: - run_rc_command $1 -fi +run_rc_command $1 diff -ruN --exclude=CVS /usr/ports/multimedia/webcamd.orig/pkg-message /usr/ports/multimedia/webcamd/pkg-message --- /usr/ports/multimedia/webcamd.orig/pkg-message 2010-03-25 08:56:58.000000000 -0500 +++ /usr/ports/multimedia/webcamd/pkg-message 2011-07-30 02:23:52.540727383 -0500 @@ -12,6 +12,13 @@ 2) Please restart devd as the configuration changed - # /etc/rc.d/devd restart + # /etc/rc.d/devd restart + +3) The rc.d script for webcamd is testing. You can try in by adding + + webcamd_enable="YES" + webcamd_device="ugenX.X" # your webcam device + +to your /etc/rc.conf ********************************************************************* --- webcamd_rc_2.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: