commit: 14de3518f17d22f210aa99d1023f13aeaa49c8de Author: Sven Eden <yamakuzure <AT> gmx <DOT> net> AuthorDate: Sat Nov 12 15:23:43 2016 +0000 Commit: David Seifert <soap <AT> gentoo <DOT> org> CommitDate: Sat Nov 12 15:39:11 2016 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=14de3518
sci-misc/boinc: Add suspend/resume to boinc init script, fix null byte input. Gentoo-Bug: 493476 Enable users to suspend/resume all projects without having to start and use the manager GUI. Gentoo-Bug: 584386 (partly) After upgrading to the current app-shells/bash-4.4 the stop command provokes the following warning: "command substitution: ignored null byte in input" This happens due to the usage of "cut" with --output-delimiter=''. Obviously "cut" puts a null byte out if the delimiter was set to nothing. (Checked with hexdump, it does.) The fix is to use "tr -d ." to concatenate the version numbers, and then to compare against an "expr substr". Package-Manager: portage-2.3.2 Closes: https://github.com/gentoo/gentoo/pull/2768 Signed-off-by: David Seifert <soap <AT> gentoo.org> sci-misc/boinc/files/boinc.init | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/sci-misc/boinc/files/boinc.init b/sci-misc/boinc/files/boinc.init index e20c8df..07b8b80 100644 --- a/sci-misc/boinc/files/boinc.init +++ b/sci-misc/boinc/files/boinc.init @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -extra_started_commands="attach" +extra_started_commands="attach resume suspend" depend() { @@ -59,9 +59,9 @@ env_check() { need_passwd_arg() { - local vers=$(${BOINCBIN} --version | cut -d '.' --output-delimiter='' -f 1,2) - [ -z "$vers" ] && vers=0 - [ $vers -lt 74 ] && return 0 + local vers=$(${BOINCBIN} --version | tr -d .) + [ -z "$vers" ] && vers="00" + [ $(expr substr "$vers" 1 2) -lt 74 ] && return 0 # From version 7.4 on, the default is to read # gui_rpc_auth.cfg for the password. @@ -151,3 +151,17 @@ stop() { start-stop-daemon -u ${USER} -q -d "${RUNTIMEDIR}" -x boinccmd -- ${password} --quit eend $? } + + +resume() { + for url in $(boinccmd --get_project_status | sed -n 's/\s*master URL: //p'); do + boinccmd --project ${url} resume + done +} + + +suspend() { + for url in $(boinccmd --get_project_status | sed -n 's/\s*master URL: //p'); do + boinccmd --project ${url} suspend; + done +}
