public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "David Seifert" <soap@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-misc/boinc/files/
Date: Sat, 12 Nov 2016 15:39:57 +0000 (UTC)	[thread overview]
Message-ID: <1478965151.14de3518f17d22f210aa99d1023f13aeaa49c8de.soap@gentoo> (raw)

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
+}


             reply	other threads:[~2016-11-12 15:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-12 15:39 David Seifert [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-02-21 21:30 [gentoo-commits] repo/gentoo:master commit in: sci-misc/boinc/files/ Conrad Kostecki
2017-01-29 20:10 David Seifert
2017-01-04 13:42 David Seifert
2016-04-26  7:23 Patrice Clement

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1478965151.14de3518f17d22f210aa99d1023f13aeaa49c8de.soap@gentoo \
    --to=soap@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox