Gentoo Archives: gentoo-commits

From: David Seifert <soap@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-misc/boinc/files/, sci-misc/boinc/
Date: Wed, 04 May 2016 22:01:39
Message-Id: 1462399203.77700d6221afc3a293241b8547a9904be2bd434b.soap@gentoo
1 commit: 77700d6221afc3a293241b8547a9904be2bd434b
2 Author: Sven Eden <yamakuzure <AT> gmx <DOT> net>
3 AuthorDate: Fri Apr 29 08:52:09 2016 +0000
4 Commit: David Seifert <soap <AT> gentoo <DOT> org>
5 CommitDate: Wed May 4 22:00:03 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=77700d62
7
8 sci-misc/boinc: Upgraded init script
9
10 Gentoo-Bug: 574260
11
12 After hot-fixing bug 574260, the following fixes/additions, suggested
13 by Jan Chren were made:
14
15 - #!/sbin/runscript -> #!/sbin/openrc-run
16 - Variables from /etc/conf.d/boinc are checked, and empty variables
17 are pre-filled with sane defaults.
18 - split start() to start_pre() and start()
19 - removed check_baselayout()
20 - replaced /etc/init.d/boinc with ${RC_SERVICE}
21 - replaced echo with einfo ""
22 - replaced ${SVCNAME} with ${RC_SVCNAME}
23 - removed unset for local vars
24
25 Package-Manager: portage-2.2.28
26
27 sci-misc/boinc/Manifest | 1 -
28 sci-misc/boinc/files/boinc.init | 94 ++++++++++++++++++++++++++++++-----------
29 2 files changed, 70 insertions(+), 25 deletions(-)
30
31 diff --git a/sci-misc/boinc/Manifest b/sci-misc/boinc/Manifest
32 index 01bb35e..4f1d78d 100644
33 --- a/sci-misc/boinc/Manifest
34 +++ b/sci-misc/boinc/Manifest
35 @@ -1,4 +1,3 @@
36 -DIST boinc-7.2.0.tar.xz 25138432 SHA256 714ac3a10bec41afc224e8343f5bc221a488eefca4592dbc9ce4eea2c10cad5e SHA512 4ee360c14117cf4bbc26dfb48682462cdd15ca04b16f40b76562c0f5fa1a4531775762a1ce1f59960b4d0166a5d429af1279199f5140d3e112c72361ad01c46e WHIRLPOOL 3d41bf1f80d04aa9ec576da18bbb6a8078c98060bd6167dcf6a75fa34619fb95831695fb145a8f4400ec0d99a743f42539751667fcbc505fba7c747c0e0bedfd
37 DIST boinc-7.2.42.tar.gz 45420832 SHA256 c4e9c6aef80db15afa3617804f6cdbf15586865d260b242a06197681a8ac86e6 SHA512 c702597b2469e40cdb1fe4d47ac7b808a2f5702d7199e8bc4f2e50ec7a1058057f4edc6baec9ff64b877da788a13bd74049348286c7cbc98a7f73232f25749d0 WHIRLPOOL ddade063072bef0a9dfcba50ce3878c8d0318e8ed607af045e7c7561296742dd66612d68d013be627692a3dbf54296b02dbc50533cd1d0d4a6b2deb53c99305e
38 DIST boinc-7.4.42.tar.gz 44075908 SHA256 2656727628cae8b15c39e48e08e0521aae345dd1cf4674c6730150500b30145f SHA512 6eabb130d38c55b551ce216afcb8b4a27d9755c4a20dfc30e7ab0c7e8ba5ab5af6995348ec5fee6b9711aa85f7fdbcef78b05894873d8780f20c9e29e17c8ad1 WHIRLPOOL 3b61de0a5a443d457ceda3c01bf824fa5d9a72c7e5d8e8da1bf35f1510a7d3fb72dbbf8ce329b2f8ca18c82afc16852df0cd047d4870b06537ddff473277d655
39 DIST boinc-7.6.31.tar.gz 43534132 SHA256 133490409d4a8513024253dd22ccf6ab26f210226db97f2021fd75eb79a27f08 SHA512 b2f35e7446bf01f4557a0d3c18ccad49a3e71d72fd25d69ff2e023ac51b1293ce3a7066ca0959e35301d1d99fc66eabf11dd89845ac120326f27fcdfa30fcdeb WHIRLPOOL 0d5de909dbe8a7f961d221f01e2ffc57bacc72fc91ac26bdf30fff73f4ce80c1b60f5a7e782da8b8cda222a23455275fd96f18b902c77c971aa86a4c4a010641
40
41 diff --git a/sci-misc/boinc/files/boinc.init b/sci-misc/boinc/files/boinc.init
42 index 6ed9041..1d78d0a 100644
43 --- a/sci-misc/boinc/files/boinc.init
44 +++ b/sci-misc/boinc/files/boinc.init
45 @@ -1,19 +1,21 @@
46 -#!/sbin/runscript
47 +#!/sbin/openrc-run
48 # Copyright 1999-2016 Gentoo Foundation
49 # Distributed under the terms of the GNU General Public License v2
50 # $Id$
51
52 extra_started_commands="attach"
53
54 +
55 depend() {
56 # we can use dns and net, but we can also in most cases live without them
57 use dns net ntp-client ntpd
58 }
59
60 +
61 create_work_directory() {
62 if [ ! -d "${RUNTIMEDIR}" ]; then
63 - einfo "Directory ${RUNTIMEDIR} not existing, creating now."
64 - mkdir "${RUNTIMEDIR}"
65 + einfo "Directory ${RUNTIMEDIR} does not exist, creating now."
66 + mkdir -p "${RUNTIMEDIR}"
67 if [ ! -d "${RUNTIMEDIR}" ]; then
68 eeror "Directory ${RUNTIMEDIR} could not be created!"
69 return 1
70 @@ -22,8 +24,11 @@ create_work_directory() {
71 if [ ! -e "${RUNTIMEDIR}"/ca-bundle.crt ] ; then
72 ln -s /etc/ssl/certs/ca-certificates.crt "${RUNTIMEDIR}"/ca-bundle.crt
73 fi
74 +
75 + return 0
76 }
77
78 +
79 cuda_check() {
80 if [ -f /opt/cuda/lib/libcudart.so ]; then
81 # symlink wont harm :]
82 @@ -31,15 +36,42 @@ cuda_check() {
83 fi
84 }
85
86 -check_baselayout() {
87 - if [ "${RC_VERSION:-0}" = "0" ]; then
88 - eerror "This script cannot be used for baselayout-1."
89 +
90 +env_check() {
91 + # Make sure the configuration is sane
92 + ${USER:="boinc"}
93 + ${GROUP:="boinc"}
94 + ${RUNTIMEDIR:="/var/lib/boinc"}
95 + ${BOINCBIN:="$(which boinc_client)"}
96 + ${ALLOW_REMOTE_RPC:="yes"}
97 + ${NICELEVEL:="19"}
98 + # ARGS is not checked, it could have been explicitly set
99 + # to be empty by the user.
100 +
101 + # If the client was not found (how?) something is seriously wrong
102 + if [ ! -x "$BOINCBIN" ] ; then
103 + eerror "No boinc_client found!"
104 return 1
105 fi
106 +
107 + return 0
108 }
109
110 -start() {
111 - check_baselayout || return 1
112 +
113 +need_passwd_arg() {
114 + local vers=$(${BOINCBIN} --version | cut -d '.' --output-delimiter='' -f 1,2)
115 + [ -z "$vers" ] && vers=0
116 + [ $vers -lt 74 ] && return 0
117 +
118 + # From version 7.4 on, the default is to read
119 + # gui_rpc_auth.cfg for the password.
120 +
121 + return 1
122 +}
123 +
124 +
125 +start_pre() {
126 + env_check || return 1
127 create_work_directory || return 1
128 cuda_check
129
130 @@ -50,24 +82,36 @@ start() {
131 einfo "File \"${RUNTIMEDIR}/lockfile\" does not exist, assuming first run."
132 einfo "You need to setup an account on the BOINC project homepage beforehand!"
133 einfo "Go to http://boinc.berkeley.edu/ and locate your project."
134 - einfo "Then either run /etc/init.d/boinc attach or connect with a gui client"
135 + einfo "Then either run ${RC_SERVICE} attach or connect with a gui client"
136 einfo "and attach to a project with that."
137 - echo
138 + einfo ""
139 ewarn "Note that for attaching to some project you need your network up and running."
140 ewarn "network is needed only for jobs fetching afterwards"
141 fi
142
143 + return 0
144 +}
145 +
146 +
147 +start() {
148 if [ "${ALLOW_REMOTE_RPC}" = "yes" ]; then
149 ARGS="${ARGS} --allow_remote_gui_rpc"
150 fi
151
152 - ebegin "Starting ${SVCNAME}"
153 - start-stop-daemon -S -N ${NICELEVEL} -u ${USER} -q -x "${BOINCBIN}" -- ${ARGS} --daemon --dir "${RUNTIMEDIR}" --redirectio
154 + ARGS="${ARGS} --daemon --dir "${RUNTIMEDIR}" --redirectio"
155 +
156 + ebegin "Starting ${RC_SVCNAME}"
157 + start-stop-daemon -S -N ${NICELEVEL} -u ${USER} -q -x "${BOINCBIN}" -- ${ARGS}
158 eend $?
159 }
160
161 +
162 attach() {
163 - local password url key
164 + local password=""
165 + local url=""
166 + local key=""
167 +
168 + env_check || return 1
169
170 einfo "If you cant find your account key just try to obtain it by using:"
171 einfo " boinccmd --passwd PASSWORD_FROM_GUI_RPC_AUTH --lookup_account URL EMAIL PASSWORD"
172 @@ -81,26 +125,28 @@ attach() {
173 "${RC_SERVICE}" start
174 fi
175
176 - password=$(cat "${RUNTIMEDIR}/gui_rpc_auth.cfg")
177 + if need_passwd_arg; then
178 + password="--passwd \"$(cat "${RUNTIMEDIR}/gui_rpc_auth.cfg")\""
179 + fi
180
181 - ebegin "${SVCNAME}: Attaching to project"
182 - start-stop-daemon -u ${USER} -q -x boinccmd -- --passwd "${password}" --project_attach ${url} ${key}
183 + ebegin "${RC_SVCNAME}: Attaching to project"
184 + start-stop-daemon -u ${USER} -q -d "${RUNTIMEDIR}" -x boinccmd -- ${password} --project_attach ${url} ${key}
185 eend $?
186
187 - unset password url key
188 -
189 sleep 10
190 tail "${RUNTIMEDIR}/stdoutdae.txt"
191 }
192
193 stop() {
194 - local password
195 + local password=""
196
197 - password=$(cat "${RUNTIMEDIR}/gui_rpc_auth.cfg")
198 + env_check || return 1
199
200 - ebegin "Stopping ${SVCNAME}"
201 - start-stop-daemon -u ${USER} -q -x boinccmd -- --passwd "${password}" --quit
202 - eend $?
203 + if need_passwd_arg; then
204 + password="--passwd \"$(cat "${RUNTIMEDIR}/gui_rpc_auth.cfg")\""
205 + fi
206
207 - unset password
208 + ebegin "Stopping ${RC_SVCNAME}"
209 + start-stop-daemon -u ${USER} -q -d "${RUNTIMEDIR}" -x boinccmd -- ${password} --quit
210 + eend $?
211 }