diff --git a/BLFS/envars.conf b/BLFS/envars.conf index de899f0..c9a4979 100644 --- a/BLFS/envars.conf +++ b/BLFS/envars.conf @@ -150,3 +150,16 @@ export MAKEFLAGS="-j5" # up to date if [ -r /etc/profile ]; then source /etc/profile; fi + +#======== Package management ======== + +# We need the functions in "packInstall.sh" when installing a package, +# if package management is requested. Note that we have no way to know +# whether package management is requested for a given build. +# Furthermore, "sudo -E" exports varaubales, but not functions from +# the environment, and sudo needs to be called before porg, due +# to porg limitations. So we just export the location of the file +# where the functions are dfined, and we'll source it just before +# installing. + +export PACK_INSTALL=${HOME}/blfs_root/packInstall.sh # change as needed diff --git a/BLFS/gen_pkg_book.sh b/BLFS/gen_pkg_book.sh index f0165d9..f5c8109 100755 --- a/BLFS/gen_pkg_book.sh +++ b/BLFS/gen_pkg_book.sh @@ -26,6 +26,7 @@ declare BLFS_XML="${TOPDIR}/blfs-xml" declare -a TARGET declare DEP_LEVEL declare SUDO +declare WRAP_INSTALL #--------------------------# parse_configuration() { # @@ -44,6 +45,7 @@ parse_configuration() { # # Create global variables for these parameters. optDependency=* | \ MAIL_SERVER=* | \ + WRAP_INSTALL=* | \ SUDO=* ) eval ${REPLY} # Define/set a global variable.. continue ;; esac @@ -62,13 +64,14 @@ parse_configuration() { # TARGET=(${optTARGET[*]}) DEP_LEVEL=$optDependency SUDO=${SUDO:-n} + WRAP_INSTALL=${WRAP_INSTALL:-n} } #--------------------------# validate_configuration() { # #--------------------------# local -r dotSTR=".................." - local -r PARAM_LIST="DEP_LEVEL SUDO MAIL_SERVER" + local -r PARAM_LIST="DEP_LEVEL SUDO MAIL_SERVER WRAP_INSTALL" local -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}' local config_param local -i index @@ -179,6 +182,7 @@ echo -en "\n\tGenerating the build scripts ...\n" rm -rf scripts xsltproc --xinclude --nonet \ --stringparam sudo $SUDO \ + --stringparam wrap-install $WRAP_INSTALL \ -o ./scripts/ ${MakeScripts} \ ${BookXml} # Make the scripts executable. diff --git a/BLFS/xsl/gen_config.xsl b/BLFS/xsl/gen_config.xsl index c846c95..1373b11 100644 --- a/BLFS/xsl/gen_config.xsl +++ b/BLFS/xsl/gen_config.xsl @@ -58,6 +58,16 @@ config SUDO help Select if sudo will be used (you build as a normal user) otherwise sudo is not needed (you build as root) + + +config WRAP_INSTALL + bool "Use `porg style' package management" + default n + help + Select if you want the installation commands to be wrapped + between "wrapInstall '" and "' ; packInstall" functions, + where wrapInstall is used to set up a LD_PRELOAD library (for + example using porg), and packInstall makes the package tarball diff --git a/BLFS/xsl/scripts.xsl b/BLFS/xsl/scripts.xsl index 433278b..46cbc51 100644 --- a/BLFS/xsl/scripts.xsl +++ b/BLFS/xsl/scripts.xsl @@ -9,6 +9,10 @@ + + + @@ -57,8 +61,10 @@ - - PKG_DIR= + + export PKG_DIR= @@ -124,6 +130,7 @@ case $PACKAGE in cp $PACKAGE $UNPACKDIR ;; esac +export UNPACKDIR cd $UNPACKDIR @@ -380,12 +387,30 @@ fi - - sudo -E sh << ROOT_EOF + + + sudo -E sh << ROOT_EOF + + + if [ -r "$PACK_INSTALL" ]; then + source $PACK_INSTALL + export -f wrapInstall + export -f packInstall +fi +wrapInstall ' + + - - ROOT_EOF + + + ' packInstall + + + ROOT_EOF + @@ -462,6 +487,8 @@ popd + ' + @@ -509,6 +536,18 @@ popd select="substring-after($out-string,'\')"/> + + + + + '\'' + + + +