File: drbl-live-boinc

package info (click to toggle)
drbl 2.8.25-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 6,336 kB
  • ctags: 906
  • sloc: sh: 52,843; perl: 6,941; xml: 867; makefile: 117
file content (106 lines) | stat: -rwxr-xr-x 2,856 bytes parent folder | download | duplicates (3)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
# Author: Steven Shiau <steven _at_ nchc org tw>
# License: GPL
# Description: This program is used to start boinc service in DRBL live environment.

#
DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"

. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions

# config file
BOINC_CONF=/etc/drbl/boinc-url-authkey.conf

#
if [ ! -e "$BOINC_CONF" ]; then
  [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
  echo "BOINC url and authrized key file $BOINC_CONF was not found!"
  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  echo "Program terminated!"
  exit 1
fi

#
ask_and_load_lang_set

# config network first:
config_drbl_live_network

#
echo "$msg_delimiter_star_line"
echo "Now adding BOINC project(s)..."
echo "Do you want client to run BOINC computation 'always' ? If not, the mode is 'auto' (Do work only when allowed by preferences)"
echo -n "[Y/n] "
read run_mode
case "$run_mode" in 
   n|N|[nN][oO]) run_boinc_mode="auto" ;;
   *)		 run_boinc_mode="always" ;;
esac

while read url auth; do
  [ -n "$(echo $url | grep -E "^#")" ] && continue  # skip the comment lines
  if [ -n "$url" -a -n "$auth" ]; then
     echo "Attaching project $url..."
     boinc_cmd --project_attach $url $auth
     if [ "$run_boinc_mode" = "always" ]; then
        boinc_cmd --set_run_mode always
        boinc_cmd --set_network_mode always
     fi
  fi
done < $BOINC_CONF

#  TODO: If hostname is changed now, the application in the running X won't work.
# echo "$msg_delimiter_star_line"
# echo "Hostname for this machine ?"
# hostname_def="DRBL$(LC_ALL=C date +%m%d)"
# echo -n "[$hostname_def] "
# read HN
# 
# [ -z "$HN" ] && HN="$hostname_def"
# hostname $HN
# echo "$HN" > /etc/hostname
# perl -pi -e "s|^127.0.1.1 .*|127.0.1.1 $HN|g" /etc/hosts

# 
echo "$msg_delimiter_star_line"
echo "Text or graphical mode for DRBL clients ?"
echo "0: text mode"
echo "1: graphical mode"
echo -n "[1] "
read mode

case "$mode" in
  0) mode=text;;
  *) mode=graphical;;
esac

#
drbl-live --skip-pause-in-the-end start

# Set all of clients as text mode
if [ "$mode" = "text" ]; then
  echo "Changing clients to text mode..."	 
  drbl-client-switch -nl remote-linux-txt
fi

# Turn on boinc-client service
drbl-client-service boinc-client on

#
[ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
echo "$msg_all_set_you_can_turn_on_clients"
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo -n $msg_press_enter_to_continue
# This is a weird problem about tftpd-hpa when it is restared in 'drbl-all-service start' in the above. It's:
# -------
# /etc/init.d/tftpd-hpa restart
# echo -n "press key... "
# read
# -------
# and we always get such an error when running it:
# -------
# Restarting HPA's tftpd: in.tftpd.
# press key... ./td: line 4: read: read error: 0: Resource temporarily unavailable
# -------
# Therefore we use < /dev/stdin to avoid tihs.
read dummy_var < /dev/stdin