Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 263956 - media-tv/gentoo-vdr-scripts-0.4.6: Add option to run hwclock --systohc during shutdown
Summary: media-tv/gentoo-vdr-scripts-0.4.6: Add option to run hwclock --systohc during...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo VDR Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-27 10:39 UTC by Stefan Bauer
Modified: 2011-01-25 00:05 UTC (History)
1 user (show)

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


Attachments
Version 1 of patch, against v0.4.6 (systohc-1.diff,758 bytes, patch)
2009-03-28 12:14 UTC, Stefan Bauer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Bauer 2009-03-27 10:39:43 UTC
Hi,

this is a feature request: It would be nice to have the possibility to run hwclock --systohc during shutdown.

Background: The option CLOCK_SYSTOHC provided by /etc/conf.d/clock is not applicable to most vdr systems, because setting system clock _after_ setting the wake up time breaks most wakeup-methods - the system won't wake up.

My approach would be to add a option to /etc/conf.d/vdr.shutdown and add the hwclock-call to /usr/share/vdr/bin/vdrshutdown-really.sh. If that's ok I'm going to post a patch, otherwise advice is appreciated :)
Comment 1 Stefan Bauer 2009-03-28 12:14:44 UTC
Created attachment 186528 [details, diff]
Version 1 of patch, against v0.4.6

This is my first proposal, I hope using the hook mechanism was the right decision. Works for me.

Please note that there is currently no gentooish header for the new file pre-shutdown-98-systohc.sh as I'm unsure what to put there.
Comment 2 Joerg Bornkessel (RETIRED) gentoo-dev 2010-09-24 08:57:38 UTC
Why should we blow up the code of gentoo-vdr-scripts?

You can find the same feature in 

Baselayout 1
/etc/conf.d/clock
# If you want to set the Hardware Clock to the current System Time
# during shutdown, then say "yes" here.

CLOCK_SYSTOHC="no"

or Baselayout 2
/etc/conf.d/hwclock
# If you want to set the Hardware Clock to the current System Time
# during shutdown, then say "YES" here.
# You normally don't need to do this if you run a ntp daemon.
clock_systohc="NO"

???
Comment 3 Stefan Bauer 2010-09-24 09:20:13 UTC
(In reply to comment #2)
> Why should we blow up the code of gentoo-vdr-scripts?

Currently, the process of shutting down is the following:
1. VDR shutdown scripts set wakeup time via ACPI or nvram-wakeup
2. VDR shutdown scripts call halt or shutdown or whatever
3a. /etc/init.d/clock stop runs hwclock --systohc if CLOCK_SYSTOHC is enabled
--or--
3b. /etc/init.d/clock stop does nothing if CLOCK_SYSTOHC is disabled

On some systems (like mine), 3a. erases the wakeup times set in 1 (system won't wake up). 3b is not desirable, because I want to have an exact host clock.
So my proposal is to change the order:

1. VDR shutdown scripts calls hwclock --systohc
2. VDR shutdown scripts set wakeup time
3. VDR shutdown scripts call halt or shutdown or whatever

Of course, CLOCK_SYSTOHC has to be set to false in /etc/conf.d/clock for this approach.
Comment 4 Joerg Bornkessel (RETIRED) gentoo-dev 2010-12-07 01:38:49 UTC
@ Stefan

plz. unmask gentoo-vdr-scripts-0.4.8_rc2 for testing

echo "=media-tv/gentoo-vdr-scripts-0.4.8_rc" >> /etc/portage/package.unmask

--

added test that CLOCK_SYSTOHC="no" or  clock_systohc="NO"
is set on NO/no.

plz. leave a short note after testing
Comment 5 Stefan Bauer 2010-12-10 13:34:41 UTC
I emerged media-tv/gentoo-vdr-scripts-0.4.8_rc2 and it works fine, thank you for including it!
Comment 6 Matthias Schwarzott gentoo-dev 2010-12-20 15:47:55 UTC
We could try a new approach on this:
Just add some init-script that runs at shutdown after(!) clock is stopped.

That script then can write the wakeup-time.
Comment 7 Stefan Bauer 2010-12-20 16:00:56 UTC
(In reply to comment #6)
> We could try a new approach on this:
> Just add some init-script that runs at shutdown after(!) clock is stopped.
> 
> That script then can write the wakeup-time.

Interesting idea, but passing the wake-up time to an init script seems more complicated and error-prone than necessary to me.

(Currently I can only imagine that the VDR shutdown scripts write the time to a file that is later read by the init-script. Maybe there's a simpler way.)
Comment 8 Matthias Schwarzott gentoo-dev 2010-12-20 20:47:10 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > We could try a new approach on this:
> > Just add some init-script that runs at shutdown after(!) clock is stopped.
> > 
> > That script then can write the wakeup-time.
> 
> Interesting idea, but passing the wake-up time to an init script seems more
> complicated and error-prone than necessary to me.
> 
> (Currently I can only imagine that the VDR shutdown scripts write the time to a
> file that is later read by the init-script. Maybe there's a simpler way.)
> 

Well, as the scripts already pass times around through files I think that could not be worse.
Besides I think this is close to the unix concept, to not duplicate stuff but make it clean so that all pieces work together.

So we should not duplicate parts of /etc/init.d/clock but just let it work and later save the wakeup time (We also could call "/etc/init.d/hwclock save" instead of coding that).
Comment 9 Joerg Bornkessel (RETIRED) gentoo-dev 2011-01-25 00:05:43 UTC
fixed in

media-tv/gentoo-vdr-scripts-0.4.8