mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-19 14:31:48 +01:00
o Have rc.d/apm report on the status of apm.
o Modify rc.d/apmd to make correct use of this information. Submitted by: Simon L. Nielsen <simon@nitro.dk> (with minor modifications)
This commit is contained in:
parent
5e26dcb560
commit
8d2536a058
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=116102
18
etc/rc.d/apm
18
etc/rc.d/apm
@ -14,7 +14,9 @@ name="apm"
|
||||
rcvar=`set_rcvar`
|
||||
start_precmd="apm_precmd"
|
||||
command="/usr/sbin/${name}"
|
||||
command_args="-e enable"
|
||||
start_cmd="${command} -e enable"
|
||||
stop_cmd="${command} -e disable"
|
||||
status_cmd="apm_status"
|
||||
|
||||
apm_precmd()
|
||||
{
|
||||
@ -26,5 +28,19 @@ apm_precmd()
|
||||
return 1
|
||||
}
|
||||
|
||||
apm_status()
|
||||
{
|
||||
case `${command} -s` in
|
||||
1)
|
||||
echo "APM is enabled."
|
||||
return 0
|
||||
;;
|
||||
0)
|
||||
echo "APM is disabled"
|
||||
;;
|
||||
esac
|
||||
return 1
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
||||
|
@ -25,8 +25,18 @@ apmd_prestart()
|
||||
{
|
||||
case `${SYSCTL_N} hw.machine_arch` in
|
||||
i386)
|
||||
# Start apm if it is not already running
|
||||
/etc/rc.d/apm forcestatus > /dev/null || /etc/rc.d/apm forcestart
|
||||
# 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
|
||||
|
||||
# Warn user about acpi apm compatibility support which
|
||||
# does not work with apmd.
|
||||
if [ ! -e /dev/apmctl ]; then
|
||||
warn "/dev/apmctl not found; kernel is missing apm(4)"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
|
Loading…
Reference in New Issue
Block a user