Don't use /tools for setting the ROOT variable

In the generated scriptlets, we need to know if we are on host
or chrooted. Presently, we
rely on /tools being a symlink or not. But we may want to remove this
ugly symlink in future versions of LFS, so anticipate and use the
chapter ancestor.
This commit is contained in:
Pierre Labastie 2020-03-29 13:24:48 +00:00
parent a131250b6f
commit 1dce18968f

View file

@ -1142,11 +1142,18 @@ LOGLEVEL="</xsl:text>
<!-- save the timer, so that unpacking, and du is not counted -->
PREV_SEC=${SECONDS}
<!-- get the location of the system root -->
if [ -h /tools ]; then
ROOT=$(dirname $(readlink /tools))/
else
ROOT=/
fi
ROOT=</xsl:text>
<xsl:choose>
<xsl:when test="ancestor::chapter/@id = 'chapter-temporary-tools'">
<xsl:text>$LFS/
</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>/
</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>
SCRIPT_ROOT=</xsl:text>
<xsl:copy-of select="$script-root"/>
<xsl:text>