public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-vdr r658 - in gentoo-vdr-scripts/trunk: . usr/share/vdr/bin
@ 2009-01-31  9:18 Matthias Schwarzott (zzam)
  0 siblings, 0 replies; only message in thread
From: Matthias Schwarzott (zzam) @ 2009-01-31  9:18 UTC (permalink / raw
  To: gentoo-commits

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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-01-31  9:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-31  9:18 [gentoo-commits] gentoo-vdr r658 - in gentoo-vdr-scripts/trunk: . usr/share/vdr/bin Matthias Schwarzott (zzam)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox