Added option to not use sudo.

This commit is contained in:
Manuel Canales Esparcia 2006-08-13 11:58:59 +00:00
parent 8cb88dc5ad
commit c0bc66d960
3 changed files with 13 additions and 6 deletions

View file

@ -10,8 +10,11 @@ declare BLFS_XML
declare VERBOSITY=1
# Grab and name the command line options
optTARGET=$1
optDEPENDENCY=$2
optTARGET=$1 # Package target
optDEPENDENCY=$2 # Dependencies level, 1/2/3
SUDO=$3 # Build as user (y) or as root (n)
[[ -z $SUDO ]] && SUDO=y
#---------------------
@ -113,4 +116,4 @@ validate_dependency "${optDEPENDENCY}"
generate_dependency_tree
generate_TARGET_xml
generate_target_book
create_build_scripts
create_build_scripts "${SUDO}"

View file

@ -126,7 +126,7 @@ create_build_scripts() { #
#-------------------------#
: <<inline_doc
function: Create shell scripts of the requested TARGET.
input vars: nothing
input vars: $1 use sudo n/y
externals: TARGET
modifies: nothing
returns: nothing
@ -140,6 +140,7 @@ inline_doc
echo -en "\n\tGenerating the build scripts ..."
xsltproc --xinclude --nonet \
--stringparam sudo $SUDO \
-o ./scripts/ ../libs/scripts.xsl \
$TARGET-index.xml >> xsltproc.log 2>&1
echo -e "done\n"

View file

@ -9,6 +9,9 @@
<!-- XSLT stylesheet to create shell scripts from "linear build" BLFS books. -->
<!-- Build as user (y) or as root (n)? -->
<xsl:param name="sudo" select="y"/>
<xsl:template match="/">
<xsl:apply-templates select="//sect1"/>
</xsl:template>
@ -344,11 +347,11 @@ cd $UNPACKDIR
<xsl:template match="screen">
<xsl:if test="child::* = userinput and not(@role = 'nodump')">
<xsl:if test="@role = 'root'">
<xsl:if test="@role = 'root' and $sudo = 'y'">
<xsl:text>sudo sh -c "</xsl:text>
</xsl:if>
<xsl:apply-templates select="userinput"/>
<xsl:if test="@role = 'root'">
<xsl:if test="@role = 'root' and $sudo = 'y'">
<xsl:text>"</xsl:text>
</xsl:if>
<xsl:text>&#xA;</xsl:text>