aboutsummaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorMatthias Schwarzott <zzam@gentoo.org>2008-02-13 20:25:17 +0000
committerMatthias Schwarzott <zzam@gentoo.org>2008-02-13 20:25:17 +0000
commit2d824bfd5ce41ed14c122ffbf23ea11740696d80 (patch)
tree2d577a8105b09041534c49348114bc127a7701a2 /usr
parentNow always install wakeup-nvram helper. (diff)
downloadgentoo-vdr-scripts-2d824bfd5ce41ed14c122ffbf23ea11740696d80.tar.gz
gentoo-vdr-scripts-2d824bfd5ce41ed14c122ffbf23ea11740696d80.tar.bz2
gentoo-vdr-scripts-2d824bfd5ce41ed14c122ffbf23ea11740696d80.zip
More wakeup simplifications. Now try more than 1 wakeup-method until one successes.
svn path=/gentoo-vdr-scripts/trunk/; revision=575
Diffstat (limited to 'usr')
-rw-r--r--usr/share/vdr/bin/vdrshutdown-really.sh29
-rw-r--r--usr/share/vdr/inc/shutdown-functions.sh11
-rw-r--r--usr/share/vdr/rcscript/pre-start-50-shutdown.sh20
-rw-r--r--usr/share/vdr/shutdown/wakeup-acpi.sh20
-rw-r--r--usr/share/vdr/shutdown/wakeup-none.sh24
-rw-r--r--usr/share/vdr/shutdown/wakeup-nvram.sh86
-rw-r--r--usr/share/vdr/shutdown/wakeup-rtc.sh20
7 files changed, 96 insertions, 114 deletions
diff --git a/usr/share/vdr/bin/vdrshutdown-really.sh b/usr/share/vdr/bin/vdrshutdown-really.sh
index 7cc6f95..f7a16f0 100644
--- a/usr/share/vdr/bin/vdrshutdown-really.sh
+++ b/usr/share/vdr/bin/vdrshutdown-really.sh
@@ -63,15 +63,28 @@ read_reboot_setting() {
}
+WAKEUP_METHOD="${WAKEUP_METHOD:-rtc acpi nvram none}"
+
+run_wakeup_method()
+{
+ local mod="$1"
+ (
+ if [ -f "${shutdown_script_dir}/wakeup-${mod}.sh" ]; then
+ . ${shutdown_script_dir}/wakeup-${mod}.sh
+ else
+ return 1
+ fi
+ )
+}
-if [ -f "${shutdown_script_dir}/wakeup-${WAKEUP_METHOD}.sh" ]; then
- . ${shutdown_script_dir}/wakeup-${WAKEUP_METHOD}.sh
-
- wakeup_set "${VDR_WAKEUP_TIME}" || exit 99
-else
- exit 98
-fi
-
+wakeup_ok=0
+for method in ${WAKEUP_METHOD}; do
+ if run_wakeup_method; then
+ wakeup_ok=1
+ break
+ fi
+done
+[ ${wakeup_ok} = 0 ] && exit 99
if [ "${DRY_SHUTDOWN_REAL}" = "1" ]; then
mesg "Dry-run - not shutting down"
diff --git a/usr/share/vdr/inc/shutdown-functions.sh b/usr/share/vdr/inc/shutdown-functions.sh
index 0fbc850..101b7bb 100644
--- a/usr/share/vdr/inc/shutdown-functions.sh
+++ b/usr/share/vdr/inc/shutdown-functions.sh
@@ -7,12 +7,9 @@
shutdown_script_dir=/usr/share/vdr/shutdown
shutdown_data_dir=/var/vdr/shutdown-data
-read_shutdown_config() {
- . /etc/conf.d/vdr.shutdown
- SHUTDOWN_ACTIVE="${SHUTDOWN_ACTIVE:-no}"
- WAKEUP_METHOD="${WAKEUP_METHOD:-acpi}"
- SHUTDOWN_FORCE_DETECT_INTERVALL="${SHUTDOWN_FORCE_DETECT_INTERVALL:-60}"
-}
+. /etc/conf.d/vdr.shutdown
-read_shutdown_config
+# set defaults
+SHUTDOWN_ACTIVE="${SHUTDOWN_ACTIVE:-no}"
+SHUTDOWN_FORCE_DETECT_INTERVALL="${SHUTDOWN_FORCE_DETECT_INTERVALL:-60}"
diff --git a/usr/share/vdr/rcscript/pre-start-50-shutdown.sh b/usr/share/vdr/rcscript/pre-start-50-shutdown.sh
index 3ed829a..7b4fe96 100644
--- a/usr/share/vdr/rcscript/pre-start-50-shutdown.sh
+++ b/usr/share/vdr/rcscript/pre-start-50-shutdown.sh
@@ -1,18 +1,5 @@
# $Id$
-list_wakeup_methods() {
- local methods
- local m
- for m in ${shutdown_script_dir}/wakeup-*.sh; do
- m="${m##*wakeup-}"
- m="${m%.sh}"
- methods="${methods} ${m}"
- done
- einfo " Available shutdown methods:${methods}"
- einfo " There are some useflags to enable more shutdown methods."
- einfo " You have to reemerge gentoo-vdr-scripts with the new use-flags set."
-}
-
addon_main() {
include shutdown-functions
[ "${SHUTDOWN_ACTIVE}" = "no" ] && return 0
@@ -35,13 +22,6 @@ addon_main() {
ewarn " or call emerge --config gentoo-vdr-scripts"
ewarn
fi
-
- if [ ! -r "${shutdown_script_dir}/wakeup-${WAKEUP_METHOD}.sh" ]; then
- eerror " Wakeup-Method ${WAKEUP_METHOD} not supported!"
- vdr_log "Wakeup-Method ${WAKEUP_METHOD} not supported!"
- list_wakeup_methods
- fi
-
return 0
}
diff --git a/usr/share/vdr/shutdown/wakeup-acpi.sh b/usr/share/vdr/shutdown/wakeup-acpi.sh
index 8532102..e9c25ee 100644
--- a/usr/share/vdr/shutdown/wakeup-acpi.sh
+++ b/usr/share/vdr/shutdown/wakeup-acpi.sh
@@ -6,16 +6,14 @@
ACPI_WAKEUP=/usr/sbin/acpi-wakeup.sh
-wakeup_set() {
- if [ ! -x "${ACPI_WAKEUP}" ]; then
- error_mesg "acpi-wakeup.sh not found"
- return 1
- fi
+if [ ! -x "${ACPI_WAKEUP}" ]; then
+ error_mesg "acpi-wakeup.sh not found"
+ return 1
+fi
- if [ ! -e /proc/acpi/alarm ]; then
- error_mesg "/proc/acpi/alarm does not exist"
- return 1
- fi
+if [ ! -e /proc/acpi/alarm ]; then
+ error_mesg "/proc/acpi/alarm does not exist"
+ return 1
+fi
- "${ACPI_WAKEUP}" "$1"
-}
+"${ACPI_WAKEUP}" "${VDR_WAKEUP_TIME}"
diff --git a/usr/share/vdr/shutdown/wakeup-none.sh b/usr/share/vdr/shutdown/wakeup-none.sh
index 586fdec..df864f8 100644
--- a/usr/share/vdr/shutdown/wakeup-none.sh
+++ b/usr/share/vdr/shutdown/wakeup-none.sh
@@ -4,18 +4,16 @@
# Various other contributors from gentoo.de
#
-wakeup_set() {
- if [ "${1}" != 0 ]; then
- # it is not possible to wakeup the system!
- if [ "${NONE_WAKEUP_IGNORE_TIMER:-no}" = "yes" ]; then
- # ignoring set timers
- :
- else
- # Aborting
- error_mesg "You have some timer set. System will not wakeup on its own!"
- return 1
- fi
+if [ "${VDR_WAKEUP_TIME}" != 0 ]; then
+ # it is not possible to wakeup the system!
+ if [ "${NONE_WAKEUP_IGNORE_TIMER:-no}" = "yes" ]; then
+ # ignoring set timers
+ :
+ else
+ # Aborting
+ error_mesg "You have some timer set. System will not wakeup on its own!"
+ return 1
fi
+fi
- return 0
-}
+return 0
diff --git a/usr/share/vdr/shutdown/wakeup-nvram.sh b/usr/share/vdr/shutdown/wakeup-nvram.sh
index d70d6db..e595304 100644
--- a/usr/share/vdr/shutdown/wakeup-nvram.sh
+++ b/usr/share/vdr/shutdown/wakeup-nvram.sh
@@ -6,53 +6,51 @@
NVRAM_WAKEUP=/usr/bin/nvram-wakeup
-wakeup_set() {
- local CMD="${NVRAM_WAKEUP} --syslog"
- if [ ! -x "${NVRAM_WAKEUP}" ]; then
- error_mesg "no nvram-wakeup installed"
- return 1
- fi
+CMD="${NVRAM_WAKEUP} --syslog"
+if [ ! -x "${NVRAM_WAKEUP}" ]; then
+ error_mesg "no nvram-wakeup installed"
+ return 1
+fi
- [ -n "${NVRAM_CONFIG}" ] && CMD="${CMD} -C ${NVRAM_CONFIG}"
+[ -n "${NVRAM_CONFIG}" ] && CMD="${CMD} -C ${NVRAM_CONFIG}"
- [ -n "${NVRAM_EXTRA_OPTIONS}" ] && CMD="${CMD} ${NVRAM_EXTRA_OPTIONS}"
+[ -n "${NVRAM_EXTRA_OPTIONS}" ] && CMD="${CMD} ${NVRAM_EXTRA_OPTIONS}"
- CMD="${CMD} -s ${1}"
+CMD="${CMD} -s ${VDR_WAKEUP_TIME}"
- ${CMD}
+${CMD}
- # analyse
- case $PIPESTATUS in
- 0)
- # all went ok
- return 0
- ;;
+# analyse
+case $PIPESTATUS in
+ 0)
+ # all went ok
+ return 0
+ ;;
- 1)
- # all went ok - new date and time set.
- #
- # *** but we need to reboot. ***
- #
- # for some boards this is needed after every change.
- #
- # for some other boards, we only need this after changing the
- # status flag, i.e. from enabled to disabled or the other way.
- set_reboot_needed
- return 0
- ;;
-
- 2)
- # something went wrong
-
- error_mesg "Something went wrong, please check your config files of nvram-wakeup"
- # don't do anything - just exit with status 1
- return 1
- ;;
- *)
- # should not happen anyway.
-
- error_mesg "Something went wrong, should never happen"
- return 1
- ;;
- esac
-}
+ 1)
+ # all went ok - new date and time set.
+ #
+ # *** but we need to reboot. ***
+ #
+ # for some boards this is needed after every change.
+ #
+ # for some other boards, we only need this after changing the
+ # status flag, i.e. from enabled to disabled or the other way.
+ set_reboot_needed
+ return 0
+ ;;
+
+ 2)
+ # something went wrong
+
+ error_mesg "Something went wrong, please check your config files of nvram-wakeup"
+ # don't do anything - just exit with status 1
+ return 1
+ ;;
+ *)
+ # should not happen anyway.
+
+ error_mesg "Something went wrong, should never happen"
+ return 1
+ ;;
+esac
diff --git a/usr/share/vdr/shutdown/wakeup-rtc.sh b/usr/share/vdr/shutdown/wakeup-rtc.sh
index 4e290f4..5bd94b1 100644
--- a/usr/share/vdr/shutdown/wakeup-rtc.sh
+++ b/usr/share/vdr/shutdown/wakeup-rtc.sh
@@ -6,16 +6,14 @@
RTC_WAKEUP=/usr/sbin/rtc-wakeup.sh
-wakeup_set() {
- if [ ! -x "${RTC_WAKEUP}" ]; then
- error_mesg "acpi-wakeup.sh not found"
- return 1
- fi
+if [ ! -x "${RTC_WAKEUP}" ]; then
+ error_mesg "acpi-wakeup.sh not found"
+ return 1
+fi
- if [ ! -e /sys/class/rtc/rtc0/wakealarm ]; then
- error_mesg "/sys/class/rtc/rtc0/wakealarm does not exist"
- return 1
- fi
+if [ ! -e /sys/class/rtc/rtc0/wakealarm ]; then
+ error_mesg "/sys/class/rtc/rtc0/wakealarm does not exist"
+ return 1
+fi
- "${RTC_WAKEUP}" "$1"
-}
+"${RTC_WAKEUP}" "${VDR_WAKEUP_TIME}"