aboutsummaryrefslogtreecommitdiff
blob: f83a20161e0ddbe881188d5a1b96fb1cdc469c41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#
# Author:
#   Matthias Schwarzott <zzam@gmx.de>
#   Various other contributors from gentoo.de
#

NVRAM_WAKEUP=/usr/bin/nvram-wakeup

CMD="${NVRAM_WAKEUP} --syslog"
if [ ! -x "${NVRAM_WAKEUP}" ]; then
	mesg "no nvram-wakeup installed"
	return 1
fi

[ -n "${NVRAM_CONFIG}" ] && CMD="${CMD} -C ${NVRAM_CONFIG}"

[ -n "${NVRAM_EXTRA_OPTIONS}" ] && CMD="${CMD} ${NVRAM_EXTRA_OPTIONS}"

CMD="${CMD} -s ${VDR_WAKEUP_TIME}"

${CMD}

# 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

	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.

	mesg "Something went wrong, should never happen"
	return 1
	;;
esac