Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

Use fakeroot to build debs unless run as root #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion deb.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,12 @@ make_subpackage(const char *prodname,
if (Verbosity)
printf("Building Debian %s binary distribution...\n", name);

if (run_command(directory, "dpkg --build %s", name))
// run with 'fakeroot' if command available and epm not run as root
if (geteuid() && !run_command(NULL, "fakeroot --version")) {
if (run_command(directory, "fakeroot dpkg --build %s", name))
return (1);
}
else if (run_command(directory, "dpkg --build %s", name))
return (1);

/*
Expand Down
6 changes: 4 additions & 2 deletions epm.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,9 +558,11 @@ main(int argc, /* I - Number of command-line args */
i = make_slackware(prodname, directory, platname, dist, &platform);
break;
case PACKAGE_DEB :
if (geteuid())
// check whether EPM is run as root or fakeroot is available
if (geteuid() && run_command(NULL, "fakeroot --version"))
fputs("epm: Warning - file permissions and ownership may not be correct\n"
" in Debian packages unless you run EPM as root!\n", stderr);
" in Debian packages unless you run EPM as root or the 'fakeroot'\n"
" command is available!\n", stderr);

i = make_deb(prodname, directory, platname, dist, &platform);
break;
Expand Down