1 |
#!/bin/bash |
#!/bin/bash |
2 |
#distcc-config bash |
# distcc-config bash |
3 |
|
|
4 |
#needed variables |
# needed variables |
5 |
ENVFILE="/etc/env.d/02distcc" |
ENVFILE="/etc/env.d/02distcc" |
6 |
|
|
|
|
|
7 |
print_usage() |
print_usage() |
8 |
{ |
{ |
9 |
echo |
echo |
23 |
do |
do |
24 |
case "$opt" in |
case "$opt" in |
25 |
|
|
26 |
#sets hosts |
# sets hosts |
27 |
s) |
s) |
28 |
[ ! -d /etc/distcc ] && install -d /etc/distcc |
[ ! -d /etc/distcc ] && install -d /etc/distcc |
29 |
echo "${OPTARG}" > /etc/distcc/hosts |
echo "${OPTARG}" > /etc/distcc/hosts |
30 |
exit 0 |
exit 0 |
31 |
;; |
;; |
32 |
|
|
33 |
# #sets logfile |
# # sets logfile |
34 |
# l) |
# l) |
35 |
# echo ${OPTARG} |
# echo ${OPTARG} |
36 |
# exit 0 |
# exit 0 |
37 |
# ;; |
# ;; |
38 |
# |
# |
39 |
# #set verbose |
# # set verbose |
40 |
# v) |
# v) |
41 |
# echo ${OPTARG} |
# echo ${OPTARG} |
42 |
# exit 0 |
# exit 0 |
43 |
# ;; |
# ;; |
44 |
|
|
45 |
#print config |
# print config |
46 |
p) |
p) |
47 |
echo "Configured hosts:" |
echo "Configured hosts:" |
48 |
declare -i x=0 |
declare -i x=0 |
59 |
[ "$(stat -c %s /etc/distcc/hosts)" -ne 0 ] |
[ "$(stat -c %s /etc/distcc/hosts)" -ne 0 ] |
60 |
then |
then |
61 |
echo " /etc/distcc/hosts:" |
echo " /etc/distcc/hosts:" |
62 |
for i in $(cat /etc/distcc/hosts) |
(cat /etc/distcc/hosts; echo) | # make sure there is a LF at the end |
63 |
|
while read line |
64 |
do |
do |
65 |
|
case "${line}" in |
66 |
|
\#*|"") continue ;; |
67 |
|
esac |
68 |
((x++)) |
((x++)) |
69 |
echo " ${x}. ${i}" |
echo " ${x}. ${line}" |
70 |
done |
done < /etc/distcc/hosts |
71 |
else |
else |
72 |
echo " None. Please run distcc-config." |
echo " None. Please run distcc-config." |
73 |
echo " e.g. distcc-config -s \"host1 host2\"" |
echo " e.g. distcc-config -s \"host1 host2\"" |
75 |
echo |
echo |
76 |
exit 0 |
exit 0 |
77 |
;; |
;; |
78 |
|
|
79 |
#install compiler symlinks |
# install compiler symlinks |
80 |
i) |
i) |
81 |
source /etc/mage.rc |
source /etc/mage.rc |
82 |
for file in gcc cc c++ g++ |
for file in gcc cc c++ g++ |
101 |
done |
done |
102 |
exit 0 |
exit 0 |
103 |
;; |
;; |
104 |
|
|
105 |
#show help |
#show help |
106 |
h) |
h) |
107 |
print_usage |
print_usage |
108 |
exit 0 |
exit 0 |
109 |
;; |
;; |
110 |
|
|
111 |
-) |
-) |
112 |
break |
break |
113 |
;; |
;; |
114 |
|
|
115 |
*) |
*) |
116 |
echo "Run '/usr/bin/distcc-config -h' for help." 1>&2 |
echo "Run '/usr/bin/distcc-config -h' for help." 1>&2 |
117 |
exit 1 |
exit 1 |
118 |
;; |
;; |