diff options
author | Sven Eden <yamakuzure@gmx.net> | 2016-11-12 16:23:43 +0100 |
---|---|---|
committer | David Seifert <soap@gentoo.org> | 2016-11-12 16:39:11 +0100 |
commit | 14de3518f17d22f210aa99d1023f13aeaa49c8de (patch) | |
tree | 875e8436b4980054745eb626503c9a50e2e46fd5 | |
parent | sci-misc/boinc: Fix linker errors with wxGTK for boinc-7.6.33 (diff) | |
download | gentoo-14de3518f17d22f210aa99d1023f13aeaa49c8de.tar.gz gentoo-14de3518f17d22f210aa99d1023f13aeaa49c8de.tar.bz2 gentoo-14de3518f17d22f210aa99d1023f13aeaa49c8de.zip |
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@gentoo.org>
-rw-r--r-- | sci-misc/boinc/files/boinc.init | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/sci-misc/boinc/files/boinc.init b/sci-misc/boinc/files/boinc.init index e20c8dfe423f..07b8b80c411c 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 +} |