Fortify unpacking in the scripts generated for BLFS, see ticket #1693
This commit is contained in:
parent
4a03ca1421
commit
67992a0559
1 changed files with 24 additions and 13 deletions
|
@ -98,19 +98,30 @@
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="@role = 'installation'">
|
<xsl:when test="@role = 'installation'">
|
||||||
<xsl:text>
|
<xsl:text>
|
||||||
if [ "${PACKAGE%.zip}" = "${PACKAGE}" ]; then
|
find . -maxdepth 1 -mindepth 1 -type d | xargs sudo rm -rf
|
||||||
if [[ -e unpacked ]] ; then
|
case $PACKAGE in
|
||||||
UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^./@@;s@/.*@@'`
|
*.tar.gz|*.tar.bz2|*.tar.xz|*.tgz)
|
||||||
[[ -n $UNPACKDIR ]] && [[ -d $UNPACKDIR ]] && rm -rf $UNPACKDIR
|
tar -xvf $PACKAGE > unpacked
|
||||||
fi
|
UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^./@@;s@/.*@@'`
|
||||||
tar -xvf $PACKAGE > unpacked
|
;;
|
||||||
UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^./@@;s@/.*@@'`
|
*.zip)
|
||||||
else
|
zipinfo -1 $PACKAGE > unpacked
|
||||||
UNPACKDIR=${PACKAGE%.zip}
|
UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
|
||||||
[[ -n $UNPACKDIR ]] && [[ -d $UNPACKDIR ]] && rm -rf $UNPACKDIR
|
if test $(wc -w <<< $UNPACKDIR) -eq 1; then
|
||||||
unzip -d $UNPACKDIR ${PACKAGE}
|
unzip $PACKAGE
|
||||||
fi
|
else
|
||||||
cd $UNPACKDIR

</xsl:text>
|
UNPACKDIR=${PACKAGE%.zip}
|
||||||
|
unzip -d $UNPACKDIR $PACKAGE
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
UNPACKDIR=$PKG_DIR-build
|
||||||
|
mkdir $UNPACKDIR
|
||||||
|
cp $PACKAGE $UNPACKDIR
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
cd $UNPACKDIR

|
||||||
|
</xsl:text>
|
||||||
<xsl:apply-templates select=".//screen | .//para/command"/>
|
<xsl:apply-templates select=".//screen | .//para/command"/>
|
||||||
<xsl:if test="$sudo = 'y'">
|
<xsl:if test="$sudo = 'y'">
|
||||||
<xsl:text>sudo /sbin/</xsl:text>
|
<xsl:text>sudo /sbin/</xsl:text>
|
||||||
|
|
Reference in a new issue