* Add some cut&paste ready commands for installing this

* Move audioplay to a shell function, to have one location where to
   change the noise-making
 * use /etc/rc.d/dhclient instead of doing it manually
 * when going line->battery and vice versa, adjust idle timeouts of
   harddisk (atactl), and add noatime,nodevmtime mount options.
   Inspired by htdocs/Documentation/power-mgmt/
This commit is contained in:
hubertf 2000-06-18 16:16:34 +00:00
parent 2c8ac0d812
commit 112d4ac068
1 changed files with 27 additions and 10 deletions

View File

@ -1,12 +1,19 @@
#!/bin/sh
#
# $NetBSD: script,v 1.2 2000/06/01 21:54:54 gmcgarry Exp $
# $NetBSD: script,v 1.3 2000/06/18 16:16:34 hubertf 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. See apmd(8) for more information.
# 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
#
# See apmd(8) for more information.
#
@ -20,44 +27,54 @@ S=/usr/X11R6/share/kde/sounds
if=ne0
noise() {
audioplay -q -f -s 22050 -c 1 $1
}
case $0 in
*suspend)
logger 'Suspending...'
audioplay -q -f -s 22050 -c 1 $S/KDE_Window_UnMaximize.wav
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
kill `ps -auxwww | grep dhclient | awk '{print $2}'`
sh /etc/rc.d/dhclient stop
logger 'Suspending done.'
;;
*standby)
logger 'Going to standby mode ....'
audioplay -q -f -s 22050 -c 1 $S/KDE_Window_UnMaximize.wav
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
kill `ps -auxwww | grep dhclient | awk '{print $2}'`
sh /etc/rc.d/dhclient stop
logger 'Standby done.'
;;
*resume)
logger Resuming...
audioplay -q -f -s 22050 $S/KDE_Startup.wav
dhclient $if
noise $S/KDE_Startup.wav
sh /etc/rc.d/dhclient start
# mount /home
# mount /data
logger 'Resuming done.'
;;
*line)
# audioplay -q -f -s 22050 -c 1 $S/KDE_Window_DeIconify.wav
# Running on power line, not battery...
# noise $S/KDE_Window_DeIconify.wav
mount -u -o atime,devmtime -a
atactl wd0 setidle 0
;;
*battery)
# audioplay -q -f -s 22050 -c 1 $S/KDE_Window_DeIconify.wav
# Running on battery...
# noise $S/KDE_Window_DeIconify.wav
mount -u -o noatime,nodevmtime -a
atactl wd0 setidle 5
;;
esac