Skip to content

Commit 6177cf6

Browse files
committed
crosscomp - fix missing PATH= on newer distcc init.d scripts
Older distcc init.d scripts contain a PATH= line which we were replacing. Newer distcc init.d scripts exclude it, so we need to insert it before the DAEMON line
1 parent 532895c commit 6177cf6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

scriptmodules/admin/crosscomp.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,14 @@ function configure_distcc_crosscomp() {
237237
sed -i "s/--daemon\"/--daemon --port $port\"/" "$initd_script"
238238

239239
# add the $dist cross compiler bin path to new init.d
240-
sed -i "s#^PATH=.*#PATH=$bin_dir:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin#" "$initd_script"
240+
local replace="PATH=$bin_dir:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
241+
# if the PATH line exists, replace it (older distcc init.d script)
242+
if grep -q "PATH=" "$initd_script"; then
243+
sed -i "s#^PATH=.*#$replace#" "$initd_script"
244+
# otherwise, insert it before the DAEMON= line (newer distcc init.d script)
245+
else
246+
sed -i "/^DAEMON=.*/i $replace" "$initd_script"
247+
fi
241248

242249
# create log file
243250
local log="/var/log/distccd-$dist.log"

0 commit comments

Comments
 (0)