[blfs-dev] [blfs-book] r10721 - trunk/BOOK/x/installing
Armin K. schrieb: if [ $EUID = 0 ]; then make install elif [ -x /usr/bin/sudo ]; then sudo make install else su -c make install fi Add it by default instead of AS_ROOT make install, but explain how should it be used and what it really does. What do you say? some packages require additional parameters for install or going the DESTDIR way... i'd prefer the function proposed by bruce which allows any command with any parameters. tobias -- http://linuxfromscratch.org/mailman/listinfo/blfs-dev FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
Re: [blfs-dev] [blfs-book] r10721 - trunk/BOOK/x/installing
On 10/10/2012 07:46 PM, Tobias Gasser wrote: Armin K. schrieb: if [ $EUID = 0 ]; then make install elif [ -x /usr/bin/sudo ]; then sudo make install else su -c make install fi Add it by default instead of AS_ROOT make install, but explain how should it be used and what it really does. What do you say? some packages require additional parameters for install or going the DESTDIR way... i'd prefer the function proposed by bruce which allows any command with any parameters. tobias Didn't think of that. I have no obligation of how should it be implemented as long as it works correctly. Bruce, will you make necesary changes as you suggested or you will wait for someone else to speak up? -- http://linuxfromscratch.org/mailman/listinfo/blfs-dev FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
Re: [blfs-dev] [blfs-book] r10721 - trunk/BOOK/x/installing
Armin K. wrote: On 10/10/2012 07:46 PM, Tobias Gasser wrote: Armin K. schrieb: if [ $EUID = 0 ]; then make install elif [ -x /usr/bin/sudo ]; then sudo make install else su -c make install fi Add it by default instead of AS_ROOT make install, but explain how should it be used and what it really does. What do you say? some packages require additional parameters for install or going the DESTDIR way... i'd prefer the function proposed by bruce which allows any command with any parameters. tobias Didn't think of that. I have no obligation of how should it be implemented as long as it works correctly. Bruce, will you make necesary changes as you suggested or you will wait for someone else to speak up? I can do it. -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/blfs-dev FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
Re: [blfs-dev] [blfs-book] r10721 - trunk/BOOK/x/installing
On 10/08/2012 06:47 PM, Bruce Dubbs wrote: Sorry for the delay, I've missed the reply somehow. Well what we have now is wrong and what we had before is also wrong. The above is right, but may not be elegant. It is, however, somewhat educational. From what I see, your command would attempt to use either sudo or su even if ran as root user. Maybe some kind of am I root? checking should be done there before trying to check for sudo or execute su if sudo is not present. It could be collapsed to two physical lines: as_root() { if [ -x /usr/bin/sudo ]; then sudo $* else su -c \\$*\\; fi } We only need to change the entity and then the $AS_ROOT to as_root in the 4 places needed. -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/blfs-dev FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
Re: [blfs-dev] [blfs-book] r10721 - trunk/BOOK/x/installing
Armin K. wrote: On 10/08/2012 06:47 PM, Bruce Dubbs wrote: Sorry for the delay, I've missed the reply somehow. Well what we have now is wrong and what we had before is also wrong. The above is right, but may not be elegant. It is, however, somewhat educational. It could be collapsed to two physical lines: as_root() { if [ -x /usr/bin/sudo ]; then sudo $* else su -c \\$*\\; fi } We only need to change the entity and then the $AS_ROOT to as_root in the 4 places needed. From what I see, your command would attempt to use either sudo or su even if ran as root user. Maybe some kind of am I root? checking should be done there before trying to check for sudo or execute su if sudo is not present. as_root() { if [ $EUID = 0 ];then $* elif [ -x /usr/bin/sudo ]; then sudo $* elsesu -c \\$*\\ fi } export -f as_root The spacing may be slightly overdone. -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/blfs-dev FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
Re: [blfs-dev] [blfs-book] r10721 - trunk/BOOK/x/installing
On 10/09/2012 06:33 PM, Bruce Dubbs wrote: Armin K. wrote: From what I see, your command would attempt to use either sudo or su even if ran as root user. Maybe some kind of am I root? checking should be done there before trying to check for sudo or execute su if sudo is not present. as_root() { if [ $EUID = 0 ];then $* elif [ -x /usr/bin/sudo ]; then sudo $* elsesu -c \\$*\\ fi } export -f as_root The spacing may be slightly overdone. -- Bruce Looks better. But, I have a suggestion. Let's include the script into instructions, for example: if [ $EUID = 0 ]; then make install elif [ -x /usr/bin/sudo ]; then sudo make install else su -c make install fi Add it by default instead of AS_ROOT make install, but explain how should it be used and what it really does. What do you say? -- http://linuxfromscratch.org/mailman/listinfo/blfs-dev FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
Re: [blfs-dev] [blfs-book] r10721 - trunk/BOOK/x/installing
Armin K. wrote: On 10/09/2012 06:33 PM, Bruce Dubbs wrote: Armin K. wrote: From what I see, your command would attempt to use either sudo or su even if ran as root user. Maybe some kind of am I root? checking should be done there before trying to check for sudo or execute su if sudo is not present. as_root() { if [ $EUID = 0 ];then $* elif [ -x /usr/bin/sudo ]; then sudo $* elsesu -c \\$*\\ fi } export -f as_root The spacing may be slightly overdone. Looks better. But, I have a suggestion. Let's include the script into instructions, for example: if [ $EUID = 0 ]; then make install elif [ -x /usr/bin/sudo ]; then sudo make install else su -c make install fi Add it by default instead of AS_ROOT make install, but explain how should it be used and what it really does. What do you say? That would be OK, but I did like the idea of using a bash function from an educational perspective. Perhaps a note describing that in the first instance would provide an option for users. For that matter, the whole script could be made into a function: build() { for package in $(grep -v '^#' $1 | awk '{print $2}') do packagedir=${package%.tar.bz2} tar -xf $package pushd $packagedir ./configure $XORG_CONFIG if [ $EUID = 0 ]; then make install elif [ -x /usr/bin/sudo ]; then sudo make install else su -c make install fi popd rm -r $packagedir done } Then just build ../proto-7.7.md5 The interesting (confusing) thing here is that $1 is the parameter to the build function and $2 is related to the awk command and not the function. The script for the xorg libraries is different and uses AS_ROOT twice, but xorg apps and xorg fonts would use the same function with a different argument. I'm just throwing this out for discussion. -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/blfs-dev FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
Re: [blfs-dev] [blfs-book] r10721 - trunk/BOOK/x/installing
kre...@linuxfromscratch.org wrote: Author: krejzi Date: 2012-10-08 00:05:45 -0600 (Mon, 08 Oct 2012) New Revision: 10721 Modified: trunk/BOOK/x/installing/x7app.xml trunk/BOOK/x/installing/x7font.xml trunk/BOOK/x/installing/x7lib.xml trunk/BOOK/x/installing/x7proto.xml Log: Minor fixups to Xorg section and AS_ROOT stuff. Modified: trunk/BOOK/x/installing/x7app.xml === --- trunk/BOOK/x/installing/x7app.xml 2012-10-07 23:42:03 UTC (rev 10720) +++ trunk/BOOK/x/installing/x7app.xml 2012-10-08 06:05:45 UTC (rev 10721) @@ -258,7 +258,7 @@ pushd $packagedir ./configure $XORG_CONFIG make - $AS_ROOT make install + $AS_ROOT make install We have a problem. The above change works for su -c make install, but fails for sudo make install with sudo: make install: command not found The su variation fails without the quotes, so we need to rework this. Personally, I prefer sudo, but can understand that some will want to use su. The only solution I can come up with is to create a bash function something like: as_root() { if [ -x /usr/bin/sudo ]; then sudo $* else su -c \\$*\\ fi } I can't say I like it, but it works. -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/blfs-dev FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
Re: [blfs-dev] [blfs-book] r10721 - trunk/BOOK/x/installing
On 10/08/2012 06:09 PM, Bruce Dubbs wrote: kre...@linuxfromscratch.org wrote: Author: krejzi Date: 2012-10-08 00:05:45 -0600 (Mon, 08 Oct 2012) New Revision: 10721 Modified: trunk/BOOK/x/installing/x7app.xml trunk/BOOK/x/installing/x7font.xml trunk/BOOK/x/installing/x7lib.xml trunk/BOOK/x/installing/x7proto.xml Log: Minor fixups to Xorg section and AS_ROOT stuff. Modified: trunk/BOOK/x/installing/x7app.xml === --- trunk/BOOK/x/installing/x7app.xml2012-10-07 23:42:03 UTC (rev 10720) +++ trunk/BOOK/x/installing/x7app.xml2012-10-08 06:05:45 UTC (rev 10721) @@ -258,7 +258,7 @@ pushd $packagedir ./configure $XORG_CONFIG make - $AS_ROOT make install + $AS_ROOT make install We have a problem. The above change works for su -c make install, but fails for sudo make install with sudo: make install: command not found The su variation fails without the quotes, so we need to rework this. Personally, I prefer sudo, but can understand that some will want to use su. The only solution I can come up with is to create a bash function something like: as_root() { if [ -x /usr/bin/sudo ]; then sudo $* else su -c \\$*\\ fi } I can't say I like it, but it works. -- Bruce Sorry, I didn't have sudo installed. I have just checked it with su -c or AS_ROOT not set. Should we remove su -c and just leave sudo and installing as root as options? -- http://linuxfromscratch.org/mailman/listinfo/blfs-dev FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page