-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathboinc-manager
executable file
·57 lines (51 loc) · 2.28 KB
/
boinc-manager
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
#
# boinc-manager - wrapper for boincmgr to auto-start boinc and fix some issues
#
# Copyright (C) 2012 Rodrigo Silva (MestreLion) <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. See <http://www.gnu.org/licenses/gpl.html>
#
# Workaround the annoying bug where boinc client daemon starts too soon in the
# boot sequence, before GPU driver (or X, or DE) is active, causing boinc not
# to find the GPU.
#
# Also fixes a Manager limitation of not starting the client daemon by itself.
#
# It is recommended to change the Manager launcher at
# /usr/share/applications/boinc-manager.desktop to execute this script instead
# of /usr/bin/boincmgr. Or, better yet, copy the .desktop file to
# ~/.local/share/applications and edit it there. Use the following commands:
# desktop="share/applications/boinc-manager.desktop"
# sed '/^Exec=/s/=.*/=boinc-manager/' "/usr/$desktop" > "$HOME/.local/$desktop"
boinc=/etc/init.d/boinc-client
boincdir=/var/lib/boinc-client
cd "$boincdir"
if "$boinc" status | grep -q 'stopped$' ||
{ boinccmd --get_messages | grep -qi "No usable GPUs found" &&
lsmod | grep -qi "fglrx" ; }
then
pkexec "$boinc" restart
fi
/usr/bin/boincmgr "$@"
exit
# For reference: a test for boinc restart to fix 'AMD GPU not found' bug
boinc=/etc/init.d/boinc-client
if [ -x "$boinc" ] && # init script exists and is enabled
"$boinc" status | grep -qi ': running$' && # boinc client is running
lsmod | grep -qi "fglrx" && # AMD/ATI proprietary driver is enabled
boinccmd --get_messages | grep -qi "No usable GPUs found" ; # but GPU is not detected by boinc
then
pkexec "$boinc" restart
fi