DragonFly BSD
DragonFly submit List (threaded) for 2005-02
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: battd rcng script


From: "Liam J. Foy" <liamfoy@xxxxxxxxxxxxx>
Date: Thu, 17 Feb 2005 14:30:53 +0000

On Thu(17)/Feb/05 - , Devon H. O'Dell wrote:
> Hey,
> 
> Liam asked if I'd like to write a script to start battd at boot. So I
> did :). Patch is attached.
> 
> --Devon

> diff -urN etc.old/defaults/rc.conf etc/defaults/rc.conf
> --- etc.old/defaults/rc.conf	2005-02-17 13:46:11.000000000 +0100
> +++ etc/defaults/rc.conf	2005-02-17 13:45:45.000000000 +0100
> @@ -27,6 +27,8 @@
>  apm_enable="NO"		# Set to YES to enable APM BIOS functions (or NO).
>  apmd_enable="NO"	# Run apmd to handle APM event from userland.
>  apmd_flags=""		# Flags to apmd (if enabled).
> +battd_enable="NO"	# Set to YES to have battd alert on 10% battery power.
> +battd_flags=""		# Flags to battd (if enabled).
>  devd_enable="NO" 	# Run devd, to trigger programs on device tree changes.
>  kldxref_enable="NO"	# Build linker.hints files with kldxref(8).
>  kldxref_clobber="NO"	# Overwrite old linker.hints at boot.
> diff -urN etc.old/rc.d/battd etc/rc.d/battd
> --- etc.old/rc.d/battd	1970-01-01 01:00:00.000000000 +0100
> +++ etc/rc.d/battd	2005-02-17 13:40:13.000000000 +0100
> @@ -0,0 +1,38 @@
> +#!/bin/sh
> +#
> +# $DragonFly$
> +#
> +
> +# PROVIDE: battd
> +# REQUIRE: DAEMON apm
> +# BEFORE:  LOGIN
> +# KEYWORD: DragonFly 
> +
> +. /etc/rc.subr
> +
> +name="battd"
> +rcvar=`set_rcvar`
> +start_precmd="battd_precmd"
> +command="/usr/sbin/${name}"
> +pidfile="/var/run/${name}.pid"
> +
> +battd_precmd()
> +{
> +	case `${SYSCTL_N} hw.machine_arch` in
> +	i386)
> +		# Enable apm if it is not already enabled
> +		if ! checkyesno apm_enable  && \
> +		    ! /etc/rc.d/apm forcestatus 1>/dev/null 2>&1
> +		then
> +			force_depend apm || return 1
> +		fi
> +		;;
> +	*)
> +		return 1
> +		;;
> +	esac
> +	return 0
> +}
> +
> +load_rc_config $name
> +run_rc_command "$1"
> diff -urN etc.old/rc.d/Makefile etc/rc.d/Makefile
> --- etc.old/rc.d/Makefile.old	Thu Feb 17 14:43:57 2005
> +++ etc/rc.d/Makefile	Thu Feb 17 14:43:44 2005
> @@ -9,7 +9,7 @@
>  FILES=	DAEMON LOGIN NETWORKING SERVERS abi accounting addswap adjkerntz \
>  	altqd amd \
>  	apm apmd archdep atm1 atm2.sh atm3.sh \
> -	bootconf.sh bootparams ccd cleanvar \
> +	battd bootconf.sh bootparams ccd cleanvar \
>  	cleartmp cron dhclient dhcpd dhcrelay diskless dmesg dumpon fsck \
>  	hostname inetd initdiskless initrandom ip6fw ipfilter ipfs ipfw ipmon \
>  	ipnat ipsec ipxrouted isdnd jail \

I have tested this script with no problems. If no one has any objections
I will commit it later tonight.

Cheers,
-- 
			- Liam J. Foy
			<liamfoy@xxxxxxxxxxxxx>
			http://www.bsd-systems.co.uk



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]