Debian Codegraph @

sbin/drbl-live-boinc

raw symbols SCIP
1 #!/bin/bash
2 # Author: Steven Shiau <steven _at_ clonezilla org>
3 # License: GPL
4 # Description: This program is used to start boinc service in DRBL live environment.
5
6 #
7 DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"
8
9 . $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
10
11 # config file
12 BOINC_CONF=/etc/drbl/boinc-url-authkey.conf
13
14 #
15 if [ ! -e "$BOINC_CONF" ]; then
16 [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
17 echo "BOINC url and authrized key file $BOINC_CONF was not found!"
18 [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
19 echo "Program terminated!"
20 exit 1
21 fi
22
23 #
24 ask_and_load_lang_set
25
26 # config network first:
27 config_drbl_live_network
28
29 #
30 echo "$msg_delimiter_star_line"
31 echo "Now adding BOINC project(s)..."
32 echo "Do you want client to run BOINC computation 'always' ? If not, the mode is 'auto' (Do work only when allowed by preferences)"
33 echo -n "[Y/n] "
34 read run_mode
35 case "$run_mode" in
36 n|N|[nN][oO]) run_boinc_mode="auto" ;;
37 *) run_boinc_mode="always" ;;
38 esac
39
40 while read url auth; do
41 [ -n "$(echo $url | grep -E "^#")" ] && continue # skip the comment lines
42 if [ -n "$url" -a -n "$auth" ]; then
43 echo "Attaching project $url..."
44 boinc_cmd --project_attach $url $auth
45 if [ "$run_boinc_mode" = "always" ]; then
46 boinc_cmd --set_run_mode always
47 boinc_cmd --set_network_mode always
48 fi
49 fi
50 done < $BOINC_CONF
51
52 # TODO: If hostname is changed now, the application in the running X won't work.
53 # echo "$msg_delimiter_star_line"
54 # echo "Hostname for this machine ?"
55 # hostname_def="DRBL$(LC_ALL=C date +%m%d)"
56 # echo -n "[$hostname_def] "
57 # read HN
58 #
59 # [ -z "$HN" ] && HN="$hostname_def"
60 # hostname $HN
61 # echo "$HN" > /etc/hostname
62 # perl -pi -e "s|^127.0.1.1 .*|127.0.1.1 $HN|g" /etc/hosts
63
64 #
65 echo "$msg_delimiter_star_line"
66 echo "Text or graphical mode for DRBL clients ?"
67 echo "0: text mode"
68 echo "1: graphical mode"
69 echo -n "[1] "
70 read mode
71
72 case "$mode" in
73 0) mode=text;;
74 *) mode=graphical;;
75 esac
76
77 #
78 drbl-live --skip-pause-in-the-end start
79
80 # Set all of clients as text mode
81 if [ "$mode" = "text" ]; then
82 echo "Changing clients to text mode..."
83 drbl-client-switch -nl remote-linux-txt
84 fi
85
86 # Turn on boinc-client service
87 drbl-client-service boinc-client on
88
89 #
90 [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
91 echo "$msg_all_set_you_can_turn_on_clients"
92 [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
93 echo -n $msg_press_enter_to_continue
94 # This is a weird problem about tftpd-hpa when it is restared in 'drbl-all-service start' in the above. It's:
95 # -------
96 # /etc/init.d/tftpd-hpa restart
97 # echo -n "press key... "
98 # read
99 # -------
100 # and we always get such an error when running it:
101 # -------
102 # Restarting HPA's tftpd: in.tftpd.
103 # press key... ./td: line 4: read: read error: 0: Resource temporarily unavailable
104 # -------
105 # Therefore we use < /dev/stdin to avoid tihs.
106 read dummy_var < /dev/stdin