1999-12-29 07:16:21 +03:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2000-11-05 06:30:51 +03:00
|
|
|
# $NetBSD: script,v 1.4 2000/11/05 03:30:51 lukem Exp $
|
1999-12-29 07:16:21 +03:00
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# Link this script to /etc/apm/{suspend,standby,resume,line,battery}
|
|
|
|
# to play some sounds on suspend/resume, and enable/shutdown the
|
2000-06-18 20:16:34 +04:00
|
|
|
# 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.
|
1999-12-29 07:16:21 +03:00
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
PATH=/usr/pkg/bin:/sbin:$PATH
|
|
|
|
export PATH
|
|
|
|
|
|
|
|
# Where some sound files are stored:
|
|
|
|
S=/usr/X11R6/share/kde/sounds
|
|
|
|
|
|
|
|
# What my network card's recognized as:
|
|
|
|
if=ne0
|
|
|
|
|
2000-11-05 06:30:51 +03:00
|
|
|
LOGGER='logger -t apm'
|
|
|
|
|
1999-12-29 07:16:21 +03:00
|
|
|
|
2000-06-18 20:16:34 +04:00
|
|
|
noise() {
|
2000-11-05 06:30:51 +03:00
|
|
|
if [ -f $1 ]; then
|
|
|
|
audioplay -q -f -s 22050 -c 1 $1
|
|
|
|
fi
|
2000-06-18 20:16:34 +04:00
|
|
|
}
|
|
|
|
|
1999-12-29 07:16:21 +03:00
|
|
|
case $0 in
|
|
|
|
*suspend)
|
2000-11-05 06:30:51 +03:00
|
|
|
$LOGGER 'Suspending...'
|
2000-06-18 20:16:34 +04:00
|
|
|
noise $S/KDE_Window_UnMaximize.wav
|
1999-12-29 07:16:21 +03:00
|
|
|
# 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
|
2000-06-18 20:16:34 +04:00
|
|
|
sh /etc/rc.d/dhclient stop
|
2000-11-05 06:30:51 +03:00
|
|
|
$LOGGER 'Suspending done.'
|
1999-12-29 07:16:21 +03:00
|
|
|
;;
|
|
|
|
|
|
|
|
*standby)
|
2000-11-05 06:30:51 +03:00
|
|
|
$LOGGER 'Going to standby mode ....'
|
2000-06-18 20:16:34 +04:00
|
|
|
noise $S/KDE_Window_UnMaximize.wav
|
1999-12-29 07:16:21 +03:00
|
|
|
# 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
|
2000-06-18 20:16:34 +04:00
|
|
|
sh /etc/rc.d/dhclient stop
|
2000-11-05 06:30:51 +03:00
|
|
|
$LOGGER 'Standby done.'
|
1999-12-29 07:16:21 +03:00
|
|
|
;;
|
|
|
|
|
|
|
|
*resume)
|
2000-11-05 06:30:51 +03:00
|
|
|
$LOGGER 'Resuming...'
|
2000-06-18 20:16:34 +04:00
|
|
|
noise $S/KDE_Startup.wav
|
|
|
|
sh /etc/rc.d/dhclient start
|
1999-12-29 07:16:21 +03:00
|
|
|
# mount /home
|
|
|
|
# mount /data
|
2000-11-05 06:30:51 +03:00
|
|
|
$LOGGER 'Resuming done.'
|
1999-12-29 07:16:21 +03:00
|
|
|
;;
|
|
|
|
|
|
|
|
*line)
|
2000-06-18 20:16:34 +04:00
|
|
|
# noise $S/KDE_Window_DeIconify.wav
|
2000-11-05 06:30:51 +03:00
|
|
|
$LOGGER 'Running on power line.'
|
|
|
|
mount -u -o atime,devmtime -A -t ffs
|
2000-06-18 20:16:34 +04:00
|
|
|
atactl wd0 setidle 0
|
1999-12-29 07:16:21 +03:00
|
|
|
;;
|
|
|
|
|
|
|
|
*battery)
|
2000-06-18 20:16:34 +04:00
|
|
|
# noise $S/KDE_Window_DeIconify.wav
|
2000-11-05 06:30:51 +03:00
|
|
|
$LOGGER 'Running on battery.'
|
|
|
|
mount -u -o noatime,nodevmtime -A -t ffs
|
2000-06-18 20:16:34 +04:00
|
|
|
atactl wd0 setidle 5
|
1999-12-29 07:16:21 +03:00
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|