Gentoo Archives: gentoo-commits

From: "Matthias Schwarzott (zzam)" <zzam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-vdr r658 - in gentoo-vdr-scripts/trunk: . usr/share/vdr/bin
Date: Sat, 31 Jan 2009 09:18:22
Message-Id: E1LTBzY-0002S9-QY@stork.gentoo.org
1 Author: zzam
2 Date: 2009-01-31 09:18:20 +0000 (Sat, 31 Jan 2009)
3 New Revision: 658
4
5 Modified:
6 gentoo-vdr-scripts/trunk/ChangeLog
7 gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-wakeup-helper.sh
8 Log:
9 Simplify marking system for reboot. No longer calc timestamps. This will work regardless of timezone settings. Tested by ploto from vdr-portal.de
10
11 Modified: gentoo-vdr-scripts/trunk/ChangeLog
12 ===================================================================
13 --- gentoo-vdr-scripts/trunk/ChangeLog 2008-08-28 09:19:58 UTC (rev 657)
14 +++ gentoo-vdr-scripts/trunk/ChangeLog 2009-01-31 09:18:20 UTC (rev 658)
15 @@ -1,6 +1,11 @@
16 # ChangeLog for gentoo-vdr-scripts
17 # $Id$
18
19 + 31 Jan 2009; Matthias Schwarzott <zzam@g.o>
20 + usr/share/vdr/bin/vdrshutdown-wakeup-helper.sh:
21 + Simplify marking system for reboot. No longer calc timestamps. This will
22 + work regardless of timezone settings. Tested by ploto from vdr-portal.de
23 +
24 *gentoo-vdr-scripts-0.4.5 (28 Aug 2008)
25
26 *gentoo-vdr-scripts-0.4.5_rc2 (14 Aug 2008)
27
28 Modified: gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-wakeup-helper.sh
29 ===================================================================
30 --- gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-wakeup-helper.sh 2008-08-28 09:19:58 UTC (rev 657)
31 +++ gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-wakeup-helper.sh 2009-01-31 09:18:20 UTC (rev 658)
32 @@ -26,6 +26,7 @@
33 set -x
34 fi
35
36 +# fixed variable name, used by wakeup method
37 VDR_WAKEUP_TIME="${1}"
38
39 mesg() {
40 @@ -39,34 +40,13 @@
41 # (when first shutdown-try fails for some reason).
42
43 reboot_mark_file="${shutdown_data_dir}"/shutdown-need-reboot
44 -_need_reboot=0
45
46 # to be called from wakeup-method to signalize need for reboot
47 +# wakeup-method runs in a subshell, so use a file to get result back
48 set_reboot_needed() {
49 - date +%s > "${reboot_mark_file}"
50 - _need_reboot=1
51 + printf "" > "${reboot_mark_file}"
52 }
53
54 -need_reboot() {
55 - local TSTAMP= BOOT=
56 -
57 - # we already know we should reboot
58 - [ "${_need_reboot}" = 1 ] && return 0
59 -
60 - [ -e "${reboot_mark_file}" ] || return 1
61 - read TSTAMP < "${reboot_mark_file}"
62 - BOOT=$(stat -c %Y /proc)
63 -
64 - # requested reboot after last boot
65 - if [ "$BOOT" -lt "$TSTAMP" ]; then
66 - _need_reboot=1
67 - return 0
68 - fi
69 -
70 - return 1
71 -}
72 -
73 -
74 WAKEUP_METHOD="${WAKEUP_METHOD:-rtc acpi nvram none}"
75
76 run_wakeup_method()
77 @@ -92,7 +72,7 @@
78
79 _do_shutdown() {
80 SHUTDOWN_METHOD=halt
81 - if need_reboot; then
82 + if [ -e "${reboot_mark_file}" ]; then
83 SHUTDOWN_METHOD=reboot
84 fi
85
86 @@ -104,6 +84,7 @@
87 fi
88
89 if [ -f "$f" ]; then
90 + rm -f "${reboot_mark_file}"
91 mesg "Executing shutdown-${SHUTDOWN_METHOD}.sh"
92 . "$f"
93 fi