Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 69198 - there is no apm init script system to handle apm resume/standy
Summary: there is no apm init script system to handle apm resume/standy
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Default Assignee for New Packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-27 16:52 UTC by Michael Forbes
Modified: 2016-04-21 08:53 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Fedora apm event script (/etc/sysconfig/apm-scripts/apmscript) (apmscript,12.67 KB, text/plain)
2004-10-27 16:54 UTC, Michael Forbes
Details
my bash script for apm clock restore (/etc/apm/event.d/clock) (clock,378 bytes, text/plain)
2004-10-27 16:56 UTC, Michael Forbes
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Forbes 2004-10-27 16:52:29 UTC
The gentoo init system is pretty darn nice.  It has nice integration with /etc/conf.d and such.  I am a laptop user (Dell Inspirion 7500) and frequently use the apm standby option by closing my lid.  However, it messes up my clock.  I researched the issue and it turns out that other distributions (fedora) handle this as well as other issues (sound, X, pcmcia).  I would like to integrate the conf.d system with the /etc/apm/script.d so that things can be suspended/resumed properly in apm.  However, my knowledge of the gentoo init system is a little weak, and my efforts to use it as a black box restarted many boot level systems, screwing up stuff.  Using the fedora script as a template and pulling information from gentoo forums, I created a small, bash based script for storing and restoring my system clock similar to /etc/init.d/clock.  However, it does not read any of the config in /etc/conf.d

Reproducible: Always
Steps to Reproduce:
1. suspend computer
2. resume computer
3. watch how the clock is hours off

Actual Results:  
clock says quarter to three

Expected Results:  
clock should say quarter after seven

Portage 2.0.51 (default-x86-2004.2, gcc-3.3.4, glibc-2.3.3.20040420-r1,
2.4.26-gentoo-r9 i686)
=================================================================
System uname: 2.4.26-gentoo-r9 i686 Pentium III (Coppermine)
Gentoo Base System version 1.4.16
distcc 2.16 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.3 [disabled]
Autoconf: sys-devel/autoconf-2.59-r4
Automake: sys-devel/automake-1.8.5-r1
Binutils: sys-devel/binutils-2.14.90.0.8-r1
Headers:  sys-kernel/linux-headers-2.4.21-r1
Libtools: sys-devel/libtool-1.5.2-r5
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -march=pentium3 -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER=""
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3.2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config
/usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref
/usr/share/config /usr/share/texmf/dvipdfm/config/
/usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/
/usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O3 -march=pentium3 -fomit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs distlocks sandbox"
GENTOO_MIRRORS="http://gentoo.osuosl.org
http://distro.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acpi aim alsa apm arts avi berkdb bitmap-fonts bonobo cdparanoia cdr
crypt cups dga dio directfb doc dvd encode esd f77 fbcon foomaticdb gdbm gif gpm
gtk gtk2 gtkhtml guile imlib java jpeg kde ldap libg++ libwww mad mikmod mmx
motif mozcalendar mozdevelop mozilla mozsvg mozxmlterm mpeg mysql ncurses nls
objc oggvorbis opengl oss pam pcmcia pdflib perl pic plotutils png python qt
quicktime readline samba sdl slang spell sse ssl svga tcltk tcpd tetex tiff
truetype x86 xine xml2 xmms xprint xv zlib"


Bash script I made (/etc/apm/events.d/clock):
#!/bin/bash

STATE=$1

case "$STATE" in
        resume)
                if [ ! -f /etc/adjtime ]
                then
                        echo "0.0 0 0.0" > /etc/adjtime
                fi
                if [ -x /sbin/hwclock ]
                then
                        /sbin/hwclock --adjust 2>&1 >/dev/null
                        /sbin/hwclock --hctosys 2>&1 >/dev/null
                fi
                ;;
        suspend|standby)
                if [ -x /sbin/hwclock ]
                then
                        /sbin/hwclock --systohc 2>&1 >/dev/null
                fi
                ;;
esac
exit 0
# vim:ts=4


A copy of the Fedora bash script (/etc/sysconfig/apm-scripts/apmscript):
http://mbhs.edu/~miforbes/gentoo/apmscript
Comment 1 Michael Forbes 2004-10-27 16:54:19 UTC
Created attachment 42731 [details]
Fedora apm event script (/etc/sysconfig/apm-scripts/apmscript)

This script is very long and monolithic. It would make more sense to have many
small scripts in gentoo.
Comment 2 Michael Forbes 2004-10-27 16:56:36 UTC
Created attachment 42732 [details]
my bash script for apm clock restore (/etc/apm/event.d/clock)

This is my small bash apm resume/standby script.  Ideally, it would use
/sbin/runscript.sh for parsing so it could include /etc/conf.d stuff as well as
priority ranking like the "need", "use" and "provide" stuff.
Comment 3 Roy Marples (RETIRED) gentoo-dev 2006-02-07 03:17:57 UTC
This bug has nothing todo with baselayout, please don't assign it to us again.
Comment 4 Stefan Schweizer (RETIRED) gentoo-dev 2007-05-09 20:47:37 UTC
we have no one to maintain apm stuff :(
Comment 5 kundarsa@gmail.com 2016-04-21 08:48:10 UTC
Records of this functioning correctly (lid close event activating standby in APM) leads me to believe this request (or a similar one) has already been applied to Gentoo. If i am mistaken and this is still an issue please reopen this bug. This is a non issue for systems supporting ACPI.

https://forums.gentoo.org/viewtopic-t-46289-view-previous.html?sid=efb9dbba625f166aebdb8445023171be
Comment 6 Ian Delaney (RETIRED) gentoo-dev 2016-04-21 08:53:08 UTC
I endorse these findings