mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-22 08:58:47 +00:00
83eb2c3700
literal name_enable wherever possible, and ${name}_enable when it's not, to prepare for the demise of set_rcvar(). In cases where I had to hand-edit unusual instances also modify formatting slightly to be more uniform (and in some cases, correct). This includes adding some $FreeBSD$ tags, and most importantly moving rcvar= to right after name= so it's clear that one is derived from the other.
52 lines
1.0 KiB
Bash
52 lines
1.0 KiB
Bash
#!/bin/sh
|
|
|
|
# PROVIDE: ataidle
|
|
# BEFORE: LOGIN
|
|
|
|
#
|
|
# Add the following lines to /etc/rc.conf to enable ataidle:
|
|
#
|
|
# ataidle_enable (bool): set to NO by default.
|
|
# Set to YES to enable ataidle.
|
|
# ataidle_devices: list of devices on which to run ataidle
|
|
# ataidle_adaX: parameters to pass to ataidle(8)
|
|
|
|
# Example:
|
|
# Put the disks ada0, ada1 and ada2 into Standby mode after 60 minutes:
|
|
#
|
|
# ataidle_devices="ada0 ada1 ada2"
|
|
# ataidle_ada0="-S 60"
|
|
# ataidle_ada1="-S 60"
|
|
# ataidle_ada2="-S 60"
|
|
#
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="ataidle"
|
|
rcvar=ataidle_enable
|
|
|
|
command=%%PREFIX%%/sbin/${name}
|
|
start_cmd=ataidle_start
|
|
|
|
load_rc_config $name
|
|
|
|
: ${ataidle_enable="NO"}
|
|
|
|
ataidle_start()
|
|
{
|
|
if [ -n "${ataidle_device}" -a -z "${ataidle_devices}" ]; then
|
|
echo "warning: old ataidle rc settings found"
|
|
ataidle_devices=${ataidle_device}
|
|
fi
|
|
|
|
if [ -n "${ataidle_devices}" ]; then
|
|
for i in ${ataidle_devices}; do
|
|
eval ataidle_args=\$ataidle_${i}
|
|
echo "ataidle: configuring device /dev/${i}"
|
|
${command} ${ataidle_args} /dev/${i}
|
|
done
|
|
fi
|
|
}
|
|
|
|
run_rc_command "$1"
|