Gentoo Archives: gentoo-commits

From: "Matthias Schwarzott (zzam)" <zzam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-vdr r641 - in gentoo-vdr-scripts/trunk: . usr/share/vdr/bin
Date: Wed, 30 Jul 2008 15:46:22
Message-Id: E1KODsY-0001Vk-Du@stork.gentoo.org
1 Author: zzam
2 Date: 2008-07-30 15:46:17 +0000 (Wed, 30 Jul 2008)
3 New Revision: 641
4
5 Added:
6 gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-gate.sh
7 Modified:
8 gentoo-vdr-scripts/trunk/ChangeLog
9 gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-really.sh
10 gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-wakeup-helper.sh
11 Log:
12 Add nnew mini-script to call the new root-parts of shutdown.
13
14 Modified: gentoo-vdr-scripts/trunk/ChangeLog
15 ===================================================================
16 --- gentoo-vdr-scripts/trunk/ChangeLog 2008-07-30 15:34:17 UTC (rev 640)
17 +++ gentoo-vdr-scripts/trunk/ChangeLog 2008-07-30 15:46:17 UTC (rev 641)
18 @@ -1,6 +1,12 @@
19 # ChangeLog for gentoo-vdr-scripts
20 # $Id$
21
22 + 30 Jul 2008; Matthias Schwarzott <zzam@g.o>
23 + +usr/share/vdr/bin/vdrshutdown-gate.sh,
24 + usr/share/vdr/bin/vdrshutdown-really.sh,
25 + usr/share/vdr/bin/vdrshutdown-wakeup-helper.sh:
26 + Add nnew mini-script to call the new root-parts of shutdown.
27 +
28 30 Jul 2008; Matthias Schwarzott <zzam@g.o> ++,
29 -usr/share/vdr/bin/vdrshutdown-gate.sh:
30 Move old user-part of shutdown to sudo entry point.
31
32 Added: gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-gate.sh
33 ===================================================================
34 --- gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-gate.sh (rev 0)
35 +++ gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-gate.sh 2008-07-30 15:46:17 UTC (rev 641)
36 @@ -0,0 +1,26 @@
37 +#!/bin/sh
38 +# $Id: vdrshutdown-gate.sh 625 2008-07-06 12:59:34Z zzam $
39 +# Author:
40 +# Matthias Schwarzott <zzam@×××.de>
41 +# Various other contributors from gentoo.de
42 +#
43 +# You have to edit sudo-permissions to grant vdr permission to execute
44 +# privileged commands. Start visudo and add a line like
45 +# vdr ALL= NOPASSWD: /usr/share/vdr/bin/vdrshutdown-really.sh
46 +
47 +#fork to background
48 +if [ -z "${EXECUTED_BY_VDR_BG}" ]; then
49 + exec /usr/share/vdr/bin/vdr-bg.sh "$0" "$@"
50 + exit
51 +fi
52 +
53 +mesg() {
54 + svdrpsend.pl MESG "$@"
55 +}
56 +
57 +sudo /usr/share/vdr/bin/vdrshutdown-really.sh "$@"
58 +
59 +[ $? = 1 ] && mesg "sudo failed: call emerge --config gentoo-vdr-scripts"
60 +
61 +exit 0
62 +
63
64 Modified: gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-really.sh
65 ===================================================================
66 --- gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-really.sh 2008-07-30 15:34:17 UTC (rev 640)
67 +++ gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-really.sh 2008-07-30 15:46:17 UTC (rev 641)
68 @@ -15,10 +15,15 @@
69 # A lot of functions defined in here can be used
70 # from within these scripts.
71
72 -#fork to background
73 -if [ -z "${EXECUTED_BY_VDR_BG}" ]; then
74 - exec /usr/share/vdr/bin/vdr-bg.sh "${0}" "${@}"
75 - exit
76 +#fork to background already done by vdrshutdown-gate.sh for now
77 +#if [ -z "${EXECUTED_BY_VDR_BG}" ]; then
78 +# exec /usr/share/vdr/bin/vdr-bg.sh "${0}" "${@}"
79 +# exit
80 +#fi
81 +
82 +if [ "$UID" != "0" ]; then
83 + echo "This program should be run as root"
84 + exit 99
85 fi
86
87 # should be default paths on a machine build with vdr ebuilds
88 @@ -258,22 +263,15 @@
89 exit_cleanup 0
90 fi
91
92 -# You have to edit sudo-permissions to grant vdr permission to execute
93 -# privileged commands. Start visudo and add a line like
94 -# vdr ALL= NOPASSWD: /usr/share/vdr/bin/vdrshutdown-really.sh
95
96 +# TODO: Integrate code into here (+rewrite)
97 +vdrshutdown-wakeup-helper.sh "$@"
98
99 -sudo /usr/share/vdr/bin/vdrshutdown-really.sh "$@"
100 -case $? in
101 -0) ;;
102 -1) mesg_q "sudo failed"
103 - mesg_q "call emerge --config gentoo-vdr-scripts"
104 +if [ $? != 0 ]; then
105 + mesg_q "setting wakeup time not successful"
106 exit_cleanup 1
107 - ;;
108 -*) mesg_q "setting wakeup time not successful"
109 - exit_cleanup 1
110 - ;;
111 -esac
112 +fi
113 +
114 rm "${shutdown_data_dir}/shutdown-time-written"
115 date +%s > "${shutdown_data_dir}/shutdown-time-written"
116
117
118 Modified: gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-wakeup-helper.sh
119 ===================================================================
120 --- gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-wakeup-helper.sh 2008-07-30 15:34:17 UTC (rev 640)
121 +++ gentoo-vdr-scripts/trunk/usr/share/vdr/bin/vdrshutdown-wakeup-helper.sh 2008-07-30 15:46:17 UTC (rev 641)
122 @@ -14,7 +14,7 @@
123 include shutdown-functions
124 shutdown_script_dir=/usr/share/vdr/shutdown
125
126 -if [ "$(id -u)" != "0" ]; then
127 +if [ "$UID" != "0" ]; then
128 echo "This program should be run as root"
129 exit 99
130 fi