Gentoo Archives: gentoo-commits

From: "Matthias Schwarzott (zzam)" <zzam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-vdr r639 - in gentoo-vdr-scripts/trunk: . usr/share/vdr/bin
Date: Wed, 30 Jul 2008 15:33:24
Message-Id: E1KODg0-0000pX-V3@stork.gentoo.org
1 Author: zzam
2 Date: 2008-07-30 15:33:20 +0000 (Wed, 30 Jul 2008)
3 New Revision: 639
4
5 Added:
6 gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-wakeup-helper.sh
7 Removed:
8 gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-really.sh
9 Modified:
10 gentoo-vdr-scripts/trunk/ChangeLog
11 Log:
12 Moved old root-part of shutdown to temp name.
13
14 Modified: gentoo-vdr-scripts/trunk/ChangeLog
15 ===================================================================
16 --- gentoo-vdr-scripts/trunk/ChangeLog 2008-07-30 13:54:36 UTC (rev 638)
17 +++ gentoo-vdr-scripts/trunk/ChangeLog 2008-07-30 15:33:20 UTC (rev 639)
18 @@ -1,6 +1,10 @@
19 # ChangeLog for gentoo-vdr-scripts
20 # $Id$
21
22 + 30 Jul 2008; Matthias Schwarzott <zzam@g.o> ++,
23 + -usr/share/vdr/bin/vdrshutdown-really.sh:
24 + Moved old root-part of shutdown to temp name.
25 +
26 30 Jul 2008; Matthias Schwarzott <zzam@g.o>
27 usr/share/vdr/rcscript/pre-start-45-locales.sh:
28 Check locale setup as does all users of it, checking LC_ALL LC_CTYPE LANG.
29
30 Deleted: gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-really.sh
31 ===================================================================
32 --- gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-really.sh 2008-07-30 13:54:36 UTC (rev 638)
33 +++ gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-really.sh 2008-07-30 15:33:20 UTC (rev 639)
34 @@ -1,98 +0,0 @@
35 -#!/bin/sh
36 -# $Id$
37 -# Author:
38 -# Matthias Schwarzott <zzam@×××.de>
39 -#
40 -
41 -#
42 -# This script is called from vdrshutdown-gate.sh over sudo to
43 -# have root-permissions for setting wakeup-time and triggering
44 -# real shutdown/reboot.
45 -#
46 -
47 -. /usr/share/vdr/inc/functions.sh
48 -include shutdown-functions
49 -shutdown_script_dir=/usr/share/vdr/shutdown
50 -
51 -if [ "$(id -u)" != "0" ]; then
52 - echo "This program should be run as root"
53 - exit 99
54 -fi
55 -
56 -if [ "${DEBUG}" -ge 1 ]; then
57 - exec >/tmp/vdrshutdown-real-log 2>&1
58 - echo Started debug output of $0 $@
59 - set -x
60 -fi
61 -
62 -VDR_WAKEUP_TIME="${1}"
63 -
64 -SVDRPCMD=/usr/bin/svdrpsend.pl
65 -
66 -mesg() {
67 - if type logger >/dev/null 2>&1; then
68 - logger "$@"
69 - fi
70 -}
71 -
72 -# A little bit complicated, but this is used to really check if a reboot is needed
73 -# nvram gets confused when setting the same time a second time
74 -# (when first shutdown-try fails for some reason).
75 -
76 -# to be called from wakeup-method to signalize need for reboot
77 -set_reboot_needed() {
78 - date +%s > ${shutdown_data_dir}/shutdown-need-reboot
79 -}
80 -
81 -read_reboot_setting() {
82 - NEED_REBOOT=0
83 - [ -e "${shutdown_data_dir}/shutdown-need-reboot" ] || return
84 - local TSTAMP=$(cat ${shutdown_data_dir}/shutdown-need-reboot)
85 - local NOW=$(date +%s)
86 -
87 - local REBOOT_SET_AGO=$(( $NOW-$TSTAMP ))
88 - local UPTIME=$(cat /proc/uptime)
89 - UPTIME=${UPTIME%%.*}
90 -
91 - if [ "${REBOOT_SET_AGO}" -lt "${UPTIME}" ]; then
92 - NEED_REBOOT=1
93 - fi
94 -}
95 -
96 -
97 -WAKEUP_METHOD="${WAKEUP_METHOD:-rtc acpi nvram none}"
98 -
99 -run_wakeup_method()
100 -{
101 - local mod="$1"
102 - (
103 - if [ -f "${shutdown_script_dir}/wakeup-${mod}.sh" ]; then
104 - . ${shutdown_script_dir}/wakeup-${mod}.sh
105 - else
106 - return 1
107 - fi
108 - )
109 -}
110 -
111 -wakeup_ok=0
112 -for method in ${WAKEUP_METHOD}; do
113 - if run_wakeup_method "${method}"; then
114 - wakeup_ok=1
115 - break
116 - fi
117 -done
118 -[ ${wakeup_ok} = 0 ] && exit 99
119 -
120 -if [ "${DRY_SHUTDOWN}" = "1" ]; then
121 - exit 0
122 -fi
123 -
124 -read_reboot_setting
125 -
126 -case "${NEED_REBOOT}" in
127 - 1) . ${shutdown_script_dir}/shutdown-reboot.sh ;;
128 - 0) . ${shutdown_script_dir}/shutdown-halt.sh ;;
129 -esac
130 -
131 -exit 0
132 -
133
134 Copied: gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-wakeup-helper.sh (from rev 638, gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-really.sh)
135 ===================================================================
136 --- gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-wakeup-helper.sh (rev 0)
137 +++ gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-wakeup-helper.sh 2008-07-30 15:33:20 UTC (rev 639)
138 @@ -0,0 +1,98 @@
139 +#!/bin/sh
140 +# $Id$
141 +# Author:
142 +# Matthias Schwarzott <zzam@×××.de>
143 +#
144 +
145 +#
146 +# This script is called from vdrshutdown-gate.sh over sudo to
147 +# have root-permissions for setting wakeup-time and triggering
148 +# real shutdown/reboot.
149 +#
150 +
151 +. /usr/share/vdr/inc/functions.sh
152 +include shutdown-functions
153 +shutdown_script_dir=/usr/share/vdr/shutdown
154 +
155 +if [ "$(id -u)" != "0" ]; then
156 + echo "This program should be run as root"
157 + exit 99
158 +fi
159 +
160 +if [ "${DEBUG}" -ge 1 ]; then
161 + exec >/tmp/vdrshutdown-real-log 2>&1
162 + echo Started debug output of $0 $@
163 + set -x
164 +fi
165 +
166 +VDR_WAKEUP_TIME="${1}"
167 +
168 +SVDRPCMD=/usr/bin/svdrpsend.pl
169 +
170 +mesg() {
171 + if type logger >/dev/null 2>&1; then
172 + logger "$@"
173 + fi
174 +}
175 +
176 +# A little bit complicated, but this is used to really check if a reboot is needed
177 +# nvram gets confused when setting the same time a second time
178 +# (when first shutdown-try fails for some reason).
179 +
180 +# to be called from wakeup-method to signalize need for reboot
181 +set_reboot_needed() {
182 + date +%s > ${shutdown_data_dir}/shutdown-need-reboot
183 +}
184 +
185 +read_reboot_setting() {
186 + NEED_REBOOT=0
187 + [ -e "${shutdown_data_dir}/shutdown-need-reboot" ] || return
188 + local TSTAMP=$(cat ${shutdown_data_dir}/shutdown-need-reboot)
189 + local NOW=$(date +%s)
190 +
191 + local REBOOT_SET_AGO=$(( $NOW-$TSTAMP ))
192 + local UPTIME=$(cat /proc/uptime)
193 + UPTIME=${UPTIME%%.*}
194 +
195 + if [ "${REBOOT_SET_AGO}" -lt "${UPTIME}" ]; then
196 + NEED_REBOOT=1
197 + fi
198 +}
199 +
200 +
201 +WAKEUP_METHOD="${WAKEUP_METHOD:-rtc acpi nvram none}"
202 +
203 +run_wakeup_method()
204 +{
205 + local mod="$1"
206 + (
207 + if [ -f "${shutdown_script_dir}/wakeup-${mod}.sh" ]; then
208 + . ${shutdown_script_dir}/wakeup-${mod}.sh
209 + else
210 + return 1
211 + fi
212 + )
213 +}
214 +
215 +wakeup_ok=0
216 +for method in ${WAKEUP_METHOD}; do
217 + if run_wakeup_method "${method}"; then
218 + wakeup_ok=1
219 + break
220 + fi
221 +done
222 +[ ${wakeup_ok} = 0 ] && exit 99
223 +
224 +if [ "${DRY_SHUTDOWN}" = "1" ]; then
225 + exit 0
226 +fi
227 +
228 +read_reboot_setting
229 +
230 +case "${NEED_REBOOT}" in
231 + 1) . ${shutdown_script_dir}/shutdown-reboot.sh ;;
232 + 0) . ${shutdown_script_dir}/shutdown-halt.sh ;;
233 +esac
234 +
235 +exit 0
236 +
237
238
239 Property changes on: gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-wakeup-helper.sh
240 ___________________________________________________________________
241 Name: svn:keywords
242 + Id
243 Name: svn:mergeinfo
244 +