<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2015-08-25 23:52 GMT+02:00 Raffi Enficiaud <span dir="ltr"><<a href="mailto:raffi.enficiaud@mines-paris.org" target="_blank">raffi.enficiaud@mines-paris.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="">Le 25/08/15 16:48, Eric Noulard a écrit :<br>
</span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I would suggest checking (in CPackDeb generator code) whether if CPack<span class=""><br>
has been called in a fakerootED environment. This can be done by<br>
checking whether if "FAKEROOTKEY" env var is defined or not.<br>
If fakeroot is already in action then one should not call fakeroot again<br>
(whatever the fakerootED user is).<br>
</span></blockquote>
<br>
Hmmm, unfortunately it does not work. This variable does not exist on the fakerooted shell. I think there is no "good" way to detect that we are in a fakerooted environment because their purpose is to mimic the commands as if the real root user is entering them (and introspection should not be possible by design).<br></blockquote><div><br></div><div>You are right the design of fakeroot is to mimic...<br><br></div><div>I tested it using<br><br> erk@capitaine:tmp$ fakeroot bash<br>root@capitaine:tmp# echo $FAKEROOTKEY<br>489393277<br><br></div><div>but it does not seem to be set when fakerooting a simple command (outside a shell).<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
I see two technical solutions:<br>
- either using the system tar: this would not work in the case of cross compilation (and in some circumstances only) but would work in the other case. I believe that all the debian packaging tools are just using the system provided tar, so this should closely mimic the debian-packaging machinery better,<br></blockquote><div><br></div><div>Cross-compiling is one thing, cross packaging is another.<br></div><div>I think trying to cross-package is a very hard task (unless you simply create a bare archive (tar, zip, etc...)<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
- or using a CPACK variable to avoid having fakeroot executed<br></blockquote><div><br></div>seems awkward to disable black magic with another black magic spell. <br><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
I see several workarounds/hacks:<br>
- executing with fakeroot in cpack first and in case of failure falling back to run tar without fakeroot<br>
- detect if the current user is root already<span class=""><font color="#888888"><br></font></span></blockquote><br></div><div class="gmail_quote">Detecting if user is already root doesn't seems to be such a big hack<br>it should even be robust as well and should be a 2 line modfication<br></div><div class="gmail_quote">in CPackDeb.cmake protecting it even detecting FAKEROOT alltogether.<br></div><div class="gmail_quote"><br><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Eric<br></div></div></div></div></div>
</div></div>