From owner-freebsd-arch@FreeBSD.ORG Mon Dec 15 01:52:59 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BE9A216A4CE for ; Mon, 15 Dec 2003 01:52:59 -0800 (PST) Received: from telecom.net.et (ns2.telecom.net.et [213.55.64.38]) by mx1.FreeBSD.org (Postfix) with ESMTP id B950243D1F for ; Mon, 15 Dec 2003 01:52:55 -0800 (PST) (envelope-from mtm@identd.net) Received: from [213.55.69.186] (HELO pool-151-200-10-97.res.east.verizon.net) by telecom.net.et (CommuniGate Pro SMTP 3.4.8) with ESMTP-TLS id 32043701; Mon, 15 Dec 2003 12:47:36 +0300 Received: from mobile.acsolutions.com (localhost [127.0.0.1]) ESMTP id hBF9qfUK001492; Mon, 15 Dec 2003 12:52:43 +0300 (EAT) (envelope-from mtm@mobile.acsolutions.com) Received: (from mtm@localhost) by mobile.acsolutions.com (8.12.10/8.12.10/Submit) id hBF9qeck001491; Mon, 15 Dec 2003 12:52:40 +0300 (EAT) (envelope-from mtm) Date: Mon, 15 Dec 2003 12:52:38 +0300 From: Mike Makonnen To: Nate Lawson Message-ID: <20031215095238.GB840@mobile.acsolutions.com> References: <20031213130351.N59162@root.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031213130351.N59162@root.org> User-Agent: Mutt/1.4.1i X-Operating-System: FreeBSD/5.2-CURRENT (i386) cc: arch@FreeBSD.org cc: acpi-jp@jp.freebsd.org Subject: Re: Power profile script X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Dec 2003 09:52:59 -0000 On Sat, Dec 13, 2003 at 01:12:03PM -0800, Nate Lawson wrote: > > I'm mostly looking for style input on the /etc/power_profile script since > I'm not familiar with our scripting guidelines. Note that it's called > from devd (or manually by the user) and is not an rc.d boot-time thing. /etc/rc.d is not just for boot time scripts. You can put 'nostart' in the script's KEYWORD section if you don't want it processed at boot time. My personal feeling is that if it is configured through rc.conf then it should go in /etc/rc.d, but I won't insist on it. > + > +# Pull in default values. > +if [ -r /etc/defaults/rc.conf ]; then > + . /etc/defaults/rc.conf > + source_rc_confs > +elif [ -r /etc/rc.conf ]; then > + . /etc/rc.conf > +fi Please source /etc/rc.subr and use the load_rc_config() routine to do this. Usage: load_rc_config $command. If you don't want it to source a /etc/rc.conf.d/$command file, then just use 'XXX' as its argument. > + > +if [ $# -ne 1 ]; then > + echo "Usage: $0 [0x00|0x01]" > + exit 1 > +fi There are also other convenience routines in that file that you may wish to use. For example the err() routine might be of use in the above situation. Cheers. -- Mike Makonnen | GPG-KEY: http://www.identd.net/~mtm/mtm.asc mtm@identd.net | Fingerprint: 00E8 61BC 0D75 7FFB E4D3 6BF1 B239 D010 3215 D418 mtm@FreeBSD.Org| FreeBSD - Unleash the Daemon !