From 1fa0dee15b66a0286ba4dfa30829c1fcfc6590ae Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Tue, 30 Jan 2018 13:53:34 +0000 Subject: [PATCH] Prepend JH_ to exported variables in jhalfs-blfs, so that collision with build system variables is unlikely --- BLFS/envars.conf | 34 ++++++++++----------- BLFS/xsl/scripts.xsl | 57 +++++++++++++++++------------------ README.BLFS | 4 +-- common/libs/func_install_blfs | 16 +++++----- pkgmngt/packInstall.sh.porg | 14 ++++----- 5 files changed, 61 insertions(+), 64 deletions(-) diff --git a/BLFS/envars.conf b/BLFS/envars.conf index b857443..ec87324 100644 --- a/BLFS/envars.conf +++ b/BLFS/envars.conf @@ -11,22 +11,22 @@ #======== Common envars ========== #--- The build directory: -# - If BUILD_SUBDIRS is set, this directory contains sub directories +# - If JH_BUILD_SUBDIRS is set, this directory contains sub directories # (one for each package), where packages are unpacked, and compiled. -# - If BUILD_SUBDIRS is unset, packages are unpacked, and compiled directly -# in $BUILD_ROOT. -export BUILD_ROOT=/sources -export BUILD_SUBDIRS=1 +# - If JH_BUILD_SUBDIRS is unset, packages are unpacked, and compiled +# directly in $JH_BUILD_ROOT. +export JH_BUILD_ROOT=/sources +export JH_BUILD_SUBDIRS=1 #--- The local repository for packages/file: # Any missing file will be downloaded and archived either: -# - into a subdirectory (one for each page of the book) fo this directory, -# if SRC_SUBDIRS is set. -# - directly into this directory if SRC_SUBDIRS is unset. -# This directory can be the same as $BUILD_ROOT, provided BUILD_SUBDIRS -# and SRC_SUBDIRS are different. -export SRC_ARCHIVE=/sources -unset SRC_SUBDIRS +# - into a subdirectory (one for each page of the book) of this directory, +# if JH_SRC_SUBDIRS is set. +# - directly into this directory if JH_SRC_SUBDIRS is unset. +# This directory can be the same as $JH_BUILD_ROOT, provided JH_BUILD_SUBDIRS +# and JH_SRC_SUBDIRS are different. +export JH_SRC_ARCHIVE=/sources +unset JH_SRC_SUBDIRS #--- Set a well-known working locale when building software # Note that an UTF-8 locale may be needed for some packages, @@ -43,13 +43,13 @@ unset SRC_SUBDIRS # The server path MUST be set as listed in # http://www.linuxfromscratch.org/blfs/download.html. # Note that despite the name of the variable, it can be an http url. -export FTP_SERVER=http://ftp.osuosl.org/pub/blfs/ +export JH_FTP_SERVER=http://ftp.osuosl.org/pub/blfs/ #--- Keep the buid directory to examine it: -# If KEEP_FILES is unset, the extracted tarball is removed after build. +# If JH_KEEP_FILES is unset, the extracted tarball is removed after build. # Otherwise, the build tree is kept for later study. -#export KEEP_FILES=1 -unset KEEP_FILES +#export JH_KEEP_FILES=1 +unset JH_KEEP_FILES ### Currently not used in scripts ### # Use a server close to you for Xorg (see http://wiki.x.org/wiki/Mirrors) @@ -98,4 +98,4 @@ if [ -r /etc/profile ]; then source /etc/profile; fi # where the functions are defined, and we'll source it just before # installing. -export PACK_INSTALL=/blfs_root/packInstall.sh # change as needed +export JH_PACK_INSTALL=/blfs_root/packInstall.sh # change as needed diff --git a/BLFS/xsl/scripts.xsl b/BLFS/xsl/scripts.xsl index ba38e3e..5e2fa67 100644 --- a/BLFS/xsl/scripts.xsl +++ b/BLFS/xsl/scripts.xsl @@ -87,11 +87,11 @@ done - export PKG_DIR= + export JH_PKG_DIR= -SRC_DIR=${SRC_ARCHIVE}${SRC_SUBDIRS:+/${PKG_DIR}} -BUILD_DIR=${BUILD_ROOT}${BUILD_SUBDIRS:+/${PKG_DIR}} +SRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${JH_PKG_DIR}} +BUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${JH_PKG_DIR}} mkdir -p $SRC_DIR mkdir -p $BUILD_DIR @@ -100,13 +100,13 @@ mkdir -p $BUILD_DIR cd $BUILD_DIR -[[ -n "$KEEP_FILES" ]] || +[[ -n "$JH_KEEP_FILES" ]] || sudo - rm -rf $UNPACKDIR unpacked + rm -rf $JH_UNPACKDIR unpacked @@ -143,31 +143,31 @@ find . -maxdepth 1 -mindepth 1 -type d | xargs case $PACKAGE in *.tar.gz|*.tar.bz2|*.tar.xz|*.tgz|*.tar.lzma) tar -xvf $SRC_DIR/$PACKAGE > unpacked - UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'` + JH_UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'` ;; *.tar.lz) bsdtar -xvf $SRC_DIR/$PACKAGE 2> unpacked - UNPACKDIR=`head -n1 unpacked | cut -d" " -f2 | sed 's@^\./@@;s@/.*@@'` + JH_UNPACKDIR=`head -n1 unpacked | cut -d" " -f2 | sed 's@^\./@@;s@/.*@@'` ;; *.zip) zipinfo -1 $SRC_DIR/$PACKAGE > unpacked - UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )" - if test $(wc -w <<< $UNPACKDIR) -eq 1; then + JH_UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )" + if test $(wc -w <<< $JH_UNPACKDIR) -eq 1; then unzip $SRC_DIR/$PACKAGE else - UNPACKDIR=${PACKAGE%.zip} - unzip -d $UNPACKDIR $SRC_DIR/$PACKAGE + JH_UNPACKDIR=${PACKAGE%.zip} + unzip -d $JH_UNPACKDIR $SRC_DIR/$PACKAGE fi ;; *) - UNPACKDIR=$PKG_DIR-build - mkdir $UNPACKDIR - cp $SRC_DIR/$PACKAGE $UNPACKDIR - cp $(find . -mindepth 1 -maxdepth 1 -type l) $UNPACKDIR + JH_UNPACKDIR=$JH_PKG_DIR-build + mkdir $JH_UNPACKDIR + cp $SRC_DIR/$PACKAGE $JH_UNPACKDIR + cp $(find . -mindepth 1 -maxdepth 1 -type l) $JH_UNPACKDIR ;; esac -export UNPACKDIR -cd $UNPACKDIR +export JH_UNPACKDIR +cd $JH_UNPACKDIR @@ -241,10 +241,10 @@ cd $UNPACKDIR if [[ ! -f $ ]] ; then - if [[ -f $SRC_ARCHIVE/$ + if [[ -f $JH_SRC_ARCHIVE/$ ]] ; then - cp $SRC_ARCHIVE/$ + cp $JH_SRC_ARCHIVE/$ $ @@ -263,14 +263,11 @@ cd $UNPACKDIR || - wget -T 30 -t 5 ${FTP_SERVER}svn/ + wget -T 30 -t 5 ${JH_FTP_SERVER}svn/ /$ - + fi fi @@ -431,8 +428,8 @@ fi - if [ -r "$PACK_INSTALL" ]; then - source $PACK_INSTALL + if [ -r "$JH_PACK_INSTALL" ]; then + source $JH_PACK_INSTALL export -f wrapInstall export -f packInstall fi @@ -471,8 +468,8 @@ wrapInstall ' BOOTPKG_DIR=blfs- -BOOTSRC_DIR=${SRC_ARCHIVE}${SRC_SUBDIRS:+/${BOOTPKG_DIR}} -BOOTBUILD_DIR=${BUILD_ROOT}${BUILD_SUBDIRS:+/${BOOTPKG_DIR}} +BOOTSRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${BOOTPKG_DIR}} +BOOTBUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${BOOTPKG_DIR}} mkdir -p $BOOTSRC_DIR mkdir -p $BOOTBUILD_DIR @@ -482,8 +479,8 @@ URL= BOOTPACKG=$(basename $URL) if [[ ! -f $BOOTPACKG ]] ; then - if [[ -f $SRC_ARCHIVE/$BOOTPACKG ]] ; then - cp $SRC_ARCHIVE/$BOOTPACKG $BOOTPACKG + if [[ -f $JH_SRC_ARCHIVE/$BOOTPACKG ]] ; then + cp $JH_SRC_ARCHIVE/$BOOTPACKG $BOOTPACKG else wget -T 30 -t 5 $URL fi diff --git a/README.BLFS b/README.BLFS index 41b9194..b5e78c1 100644 --- a/README.BLFS +++ b/README.BLFS @@ -265,8 +265,8 @@ Working files: several files are generated when first running the tool IMPORTANT: Review and edit envars.conf, at least after installing the tool. This file is used to set global envars needed by the build scripts. - If you use package management, the variable PACK_INSTALL should point to - where the packInstall.sh script resides. + If you use package management, the variable JH_PACK_INSTALL should point to + the directory where the packInstall.sh script resides. 4.4 CREATING THE MAKEFILE:: diff --git a/common/libs/func_install_blfs b/common/libs/func_install_blfs index d8ee939..e86d9e2 100644 --- a/common/libs/func_install_blfs +++ b/common/libs/func_install_blfs @@ -13,8 +13,8 @@ cp -r menu ${BUILDDIR}${BLFS_ROOT} cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT} cp README.BLFS ${BUILDDIR}${BLFS_ROOT} if [ "$WRAP_INSTALL" = y ]; then - sed -e 's/PKGDIR/UNPACKDIR/' \ - -e 's/PKG_DEST/PKG_DIR/' \ + sed -e 's/PKGDIR/JH_UNPACKDIR/' \ + -e 's/PKG_DEST/JH_PKG_DIR/' \ $PKGMNGTDIR/packInstall.sh > ${BUILDDIR}${BLFS_ROOT}/packInstall.sh fi @@ -144,17 +144,17 @@ mv scripts $BUILDDIR$BLFS_ROOT # Generates a list containing download and copying instructions for tarballs echo -e '#!/bin/bash\nset -e\n' > $BUILDDIR$BLFS_ROOT/download_script sed -n -e '/PACKAGE=/,/^fi/{/^fi/a\ -cp $PACKAGE $SRC_ARCHIVE +cp $PACKAGE $JH_SRC_ARCHIVE p}' \ -e '/|[ ]*md5sum/p' \ -e '/PACKAGE1=/,/^fi/{/^fi/a\ -cp $PACKAGE1 $SRC_ARCHIVE +cp $PACKAGE1 $JH_SRC_ARCHIVE p}' \ -e '/PATCH=/,/^fi/{/^fi/a\ -cp $PATCH $SRC_ARCHIVE +cp $PATCH $JH_SRC_ARCHIVE p}' \ -e '/URL=/,/^fi/{/^fi/a\ -cp $BOOTPACKG $SRC_ARCHIVE +cp $BOOTPACKG $JH_SRC_ARCHIVE p}' \ $BUILDDIR$BLFS_ROOT/scripts/* >> $BUILDDIR$BLFS_ROOT/download_script chmod u+x $BUILDDIR$BLFS_ROOT/download_script @@ -164,8 +164,8 @@ pushd $BUILDDIR/sources # Remove `unpacked' files if some have been left sudo find . -name unpacked -exec rm \{\} \; if [ "$GETPKG" = "y" ]; then - FTP_SERVER=$SERVER/pub/blfs/ \ - SRC_ARCHIVE=${SRC_ARCHIVE:-/dev/null} \ + JH_FTP_SERVER=$SERVER/pub/blfs/ \ + JH_SRC_ARCHIVE=${SRC_ARCHIVE:-/dev/null} \ $BUILDDIR$BLFS_ROOT/download_script else # Save the download script in case the user wants to run it later cp $BUILDDIR$BLFS_ROOT/download_script . diff --git a/pkgmngt/packInstall.sh.porg b/pkgmngt/packInstall.sh.porg index 3a906f2..90af859 100644 --- a/pkgmngt/packInstall.sh.porg +++ b/pkgmngt/packInstall.sh.porg @@ -22,31 +22,31 @@ case $1 in VERSION=$(echo $1 | sed 's/.*shot-//') ;; icu*) # No version in PCKGVRS! Use version directly from xml book. - # PACK_INSTALL contains the path to this script, which is in the + # JH_PACK_INSTALL contains the path to this script, which is in the # parent dir of the book. - local PACKENT=$(dirname $PACK_INSTALL)/blfs-xml/packages.ent + local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent local VERSION1=$(sed -n 's/.*icu-major[^0-9]*\([^"]*\).*/\1/p' $PACKENT) local VERSION2=$(sed -n 's/.*icu-minor[^0-9]*\([^"]*\).*/\1/p' $PACKENT) VERSION=$VERSION1.$VERSION2 ;; exiv*) - local PACKENT=$(dirname $PACK_INSTALL)/blfs-xml/packages.ent + local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent VERSION=$(sed -n 's/.*exiv2[^0-9]*\([^"]*\).*/\1/p' $PACKENT) ;; flashplayer*) - local PACKENT=$(dirname $PACK_INSTALL)/blfs-xml/packages.ent + local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent VERSION=$(sed -n 's/.*flashplayer[^0-9]*\([^"]*\).*/\1/p' $PACKENT) ;; soundtouch*) - local PACKENT=$(dirname $PACK_INSTALL)/blfs-xml/packages.ent + local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent VERSION=$(sed -n 's/.*soundtouch[^0-9]*\([^"]*\).*/\1/p' $PACKENT) ;; xvid*) - local PACKENT=$(dirname $PACK_INSTALL)/blfs-xml/packages.ent + local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent VERSION=$(sed -n 's/.*xvid[^0-9]*\([^"]*\).*/\1/p' $PACKENT) ;; xf86-video-intel) - local PACKENT=$(dirname $PACK_INSTALL)/blfs-xml/x/installing/x7driver-intel.xml + local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/x/installing/x7driver-intel.xml VERSION=$(sed -n '/