From owner-cvs-src@FreeBSD.ORG Thu Sep 29 20:51:29 2005 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BD33316A41F; Thu, 29 Sep 2005 20:51:29 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5AA3543D4C; Thu, 29 Sep 2005 20:51:29 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.13.0/8.13.0) with ESMTP id j8TKpStF018710; Thu, 29 Sep 2005 13:51:28 -0700 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.13.0/8.13.0/Submit) id j8TKpScu018709; Thu, 29 Sep 2005 13:51:28 -0700 Date: Thu, 29 Sep 2005 13:51:28 -0700 From: Brooks Davis To: Hajimu UMEMOTO Message-ID: <20050929205128.GA18164@odin.ac.hmc.edu> References: <200509281959.j8SJxIpD046472@repoman.freebsd.org> <20050928201431.GA18560@odin.ac.hmc.edu> <20050928204145.GA20866@odin.ac.hmc.edu> <20050928220549.GA28378@odin.ac.hmc.edu> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0OAP2g/MAC+5xKAE" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new X-Spam-Status: No, hits=0.0 required=8.0 tests=none autolearn=no version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on odin.ac.hmc.edu Cc: Brooks Davis , cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/etc pccard_ether X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 20:51:30 -0000 --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 29, 2005 at 02:45:25PM +0900, Hajimu UMEMOTO wrote: > Hi, >=20 > >>>>> On Wed, 28 Sep 2005 15:05:49 -0700 > >>>>> Brooks Davis said: >=20 > brooks> How would you feel about a forcestart option as a compromise for = now? > brooks> That would override both the AUTO check and the up check. >=20 > Yes, I'll be happy with your offer. Here's a lightly tested implementation based on rc.subr. It adds support for the force prefix to start and stop as well as a new restart option. It seems to work in limited testing. -- Brooks Index: pccard_ether =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/etc/pccard_ether,v retrieving revision 1.47 diff -u -p -r1.47 pccard_ether --- pccard_ether 28 Sep 2005 19:59:18 -0000 1.47 +++ pccard_ether 29 Sep 2005 20:36:48 -0000 @@ -2,7 +2,7 @@ # # $FreeBSD: src/etc/pccard_ether,v 1.47 2005/09/28 19:59:18 brooks Exp $ # -# pccard_ether interfacename [start|stop] +# pccard_ether interfacename [start|stop|restart] # # example: pccard_ether fxp0 start # @@ -10,10 +10,13 @@ . /etc/rc.subr . /etc/network.subr =20 -usage() -{ - err 3 'USAGE: $0 interface (start|stop)' -} +name=3D"pccard_ether" +start_precmd=3D"checkauto" +start_cmd=3D"pccard_ether_start" +stop_precmd=3D"checkauto" +stop_cmd=3D"pccard_ether_stop" +restart_precmd=3D"checkauto" +restart_cmd=3D"pccard_ether_restart" =20 setup_routes() { @@ -54,23 +57,17 @@ remove_routes() fi } =20 -ifn=3D$1 -shift -startstop=3D$1 -shift - -load_rc_config pccard_ether - -# Ignore interfaces with the NOAUTO keyword -autoif $ifn || exit 0 - -if [ -n "$1" ]; then - usage -fi +checkauto() +{ + if [ -z "$rc_force" ]; then + # Ignore interfaces with the NOAUTO keyword + autoif $ifn || exit 0 + fi +} =20 -case ${startstop} in -[Ss][Tt][Aa][Rr][Tt] | '') - if [ -x /usr/bin/grep ]; then +pccard_ether_start() +{ + if [ -z "$rc_force" -a -x /usr/bin/grep ]; then if ifconfig $ifn | grep -s '[<,]UP[,>]' > /dev/null 2>&1; then # Interface is already up, so ignore it. exit 0 @@ -91,10 +88,10 @@ case ${startstop} in if checkyesno ipv6_enable; then network6_interface_setup $ifn fi - ;; +} =20 -# Stop the interface -[Ss][Tt][Oo][Pp]) +pccard_ether_stop() +{ if [ -n "`ifconfig_getargs $ifn`" ]; then if ! dhcpif $ifn; then remove_routes @@ -110,7 +107,24 @@ case ${startstop} in if checkyesno removable_route_flush; then route -n flush -inet > /dev/null fi - ;; -*) - usage -esac +} + +pccard_ether_restart() +{ + # Hand implemented because the default implementation runs + # the equivalent of "$0 start; $0 stop" and this script + # doesn't support that syntax + pccard_ether_stop + pccard_ether_start +} + +ifn=3D$1 +shift +if [ -z "$*" ]; then + args=3D"start" +else + args=3D$* +fi + +load_rc_config pccard_ether +run_rc_command $args --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --0OAP2g/MAC+5xKAE Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFDPFPPXY6L6fI4GtQRAptSAJ4qW5VTZAx2YQImYx4LXisedqPyJwCeK0PB C+CmILqtK4gfrtwFfMRK5BE= =JOjo -----END PGP SIGNATURE----- --0OAP2g/MAC+5xKAE--