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 $*
> else su -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