blob: a0d8ff7713dc17ccf9991f6998ecfe15cde88c38 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
#!/bin/sh
#
# $NetBSD: script,v 1.7 2021/11/02 21:55:38 abs Exp $
#
#
# Link this script to /etc/apm/{suspend,standby,resume,line,battery}
# to play some sounds on suspend/resume, and enable/shutdown the
# network card:
#
# mkdir /etc/apm
# cp script /etc/apm/suspend
# cd /etc/apm
# for i in standby resume line battery ; do ln suspend $i ; done
# chmod a+x suspend standby resume line battery
#
# See apmd(8) for more information.
#
PATH=/usr/pkg/bin:/sbin:$PATH
export PATH
# Where some sound files are stored:
S=/usr/pkg/share/kde/sounds
# What my network card's recognized as:
if=ne0
LOGGER='logger -t apm'
noise() {
if [ -f $1 ]; then
audioplay -q -f -s 22050 -c 1 $1
fi
}
case $0 in
*suspend)
$LOGGER 'Suspending...'
noise $S/KDE_Window_UnMaximize.wav
# In case some NFS mounts still exist - we don't want them to hang:
umount -a -t nfs
umount -a -f -t nfs
ifconfig $if down
sh /etc/rc.d/dhcpcd stop
$LOGGER 'Suspending done.'
;;
*standby)
$LOGGER 'Going to standby mode ....'
noise $S/KDE_Window_UnMaximize.wav
# In case some NFS mounts still exist - we don't want them to hang:
umount -a -t nfs
umount -a -f -t nfs
ifconfig $if down
sh /etc/rc.d/dhcpcd stop
$LOGGER 'Standby done.'
;;
*resume)
$LOGGER 'Resuming...'
noise $S/KDE_Startup.wav
sh /etc/rc.d/dhcpcd start
# mount /home
# mount /data
$LOGGER 'Resuming done.'
;;
*line)
# noise $S/KDE_Window_DeIconify.wav
$LOGGER 'Running on power line.'
mount -u -o atime,devmtime -A -t ffs
atactl wd0 setidle 0
;;
*battery)
# noise $S/KDE_Window_DeIconify.wav
$LOGGER 'Running on battery.'
mount -u -o noatime,nodevmtime -A -t ffs
atactl wd0 setidle 5
;;
esac
exit 0
|