From: "Matthias Schwarzott (zzam)" <zzam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] gentoo-vdr r658 - in gentoo-vdr-scripts/trunk: . usr/share/vdr/bin
Date: Sat, 31 Jan 2009 09:18:20 +0000 [thread overview]
Message-ID: <E1LTBzY-0002S9-QY@stork.gentoo.org> (raw)
Author: zzam
Date: 2009-01-31 09:18:20 +0000 (Sat, 31 Jan 2009)
New Revision: 658
Modified:
gentoo-vdr-scripts/trunk/ChangeLog
gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-wakeup-helper.sh
Log:
Simplify marking system for reboot. No longer calc timestamps. This will work regardless of timezone settings. Tested by ploto from vdr-portal.de
Modified: gentoo-vdr-scripts/trunk/ChangeLog
===================================================================
--- gentoo-vdr-scripts/trunk/ChangeLog 2008-08-28 09:19:58 UTC (rev 657)
+++ gentoo-vdr-scripts/trunk/ChangeLog 2009-01-31 09:18:20 UTC (rev 658)
@@ -1,6 +1,11 @@
# ChangeLog for gentoo-vdr-scripts
# $Id$
+ 31 Jan 2009; Matthias Schwarzott <zzam@gentoo.org>
+ usr/share/vdr/bin/vdrshutdown-wakeup-helper.sh:
+ Simplify marking system for reboot. No longer calc timestamps. This will
+ work regardless of timezone settings. Tested by ploto from vdr-portal.de
+
*gentoo-vdr-scripts-0.4.5 (28 Aug 2008)
*gentoo-vdr-scripts-0.4.5_rc2 (14 Aug 2008)
Modified: gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-wakeup-helper.sh
===================================================================
--- gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-wakeup-helper.sh 2008-08-28 09:19:58 UTC (rev 657)
+++ gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-wakeup-helper.sh 2009-01-31 09:18:20 UTC (rev 658)
@@ -26,6 +26,7 @@
set -x
fi
+# fixed variable name, used by wakeup method
VDR_WAKEUP_TIME="${1}"
mesg() {
@@ -39,34 +40,13 @@
# (when first shutdown-try fails for some reason).
reboot_mark_file="${shutdown_data_dir}"/shutdown-need-reboot
-_need_reboot=0
# to be called from wakeup-method to signalize need for reboot
+# wakeup-method runs in a subshell, so use a file to get result back
set_reboot_needed() {
- date +%s > "${reboot_mark_file}"
- _need_reboot=1
+ printf "" > "${reboot_mark_file}"
}
-need_reboot() {
- local TSTAMP= BOOT=
-
- # we already know we should reboot
- [ "${_need_reboot}" = 1 ] && return 0
-
- [ -e "${reboot_mark_file}" ] || return 1
- read TSTAMP < "${reboot_mark_file}"
- BOOT=$(stat -c %Y /proc)
-
- # requested reboot after last boot
- if [ "$BOOT" -lt "$TSTAMP" ]; then
- _need_reboot=1
- return 0
- fi
-
- return 1
-}
-
-
WAKEUP_METHOD="${WAKEUP_METHOD:-rtc acpi nvram none}"
run_wakeup_method()
@@ -92,7 +72,7 @@
_do_shutdown() {
SHUTDOWN_METHOD=halt
- if need_reboot; then
+ if [ -e "${reboot_mark_file}" ]; then
SHUTDOWN_METHOD=reboot
fi
@@ -104,6 +84,7 @@
fi
if [ -f "$f" ]; then
+ rm -f "${reboot_mark_file}"
mesg "Executing shutdown-${SHUTDOWN_METHOD}.sh"
. "$f"
fi
reply other threads:[~2009-01-31 9:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1LTBzY-0002S9-QY@stork.gentoo.org \
--to=zzam@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox