Bug 452

Summary: Avoid running "make" as root
Product: Libre-SOC's first SoC Reporter: Cesar Strauss <cestrauss>
Component: Source CodeAssignee: Luke Kenneth Casson Leighton <lkcl>
Status: CONFIRMED ---    
Severity: enhancement CC: libre-soc-bugs
Priority: ---    
Version: unspecified   
Hardware: PC   
OS: Linux   
NLnet milestone: --- total budget (EUR) for completion of task and all subtasks: 0
budget (EUR) for this task, excluding subtasks' budget: 0 parent task for budget allocation:
child tasks for budget allocation: The table of payments (in EUR) for this task; TOML format:
Attachments: proposed fix

Description Cesar Strauss 2020-08-08 15:15:33 BST
Created attachment 96 [details]
proposed fix

In the dev-env-setup repository, the hdl-tool-yosys script insists on
running "git" and "make" as root.

https://git.libre-soc.org/?p=dev-env-setup.git;a=blob;f=hdl-tools-yosys;h=23cbd93304876fa421e537ac7f7d674827c625e5;hb=HEAD

But root is only really needed for "apt-get" and "make install".

I believe it is generally good practice to run software as root as
little as possible.

I suggest removing the root detection guard at the top of the script,
inserting "sudo" at appropriate places, instead. As a bonus, the "chown"
and "chgrp" calls at the end are not longer needed and can be removed.

Relevant mailing list discussion:

http://lists.libre-riscv.org/pipermail/libre-soc-dev/2020-August/000071.html