[alfs-log] r3958 - in jhalfs/trunk: . BLFS BLFS/xsl LFS common common/libs pkgmngt

pierre at higgs.linuxfromscratch.org pierre at higgs.linuxfromscratch.org
Sun Apr 9 03:29:32 PDT 2017


Author: pierre
Date: Sun Apr  9 03:29:32 2017
New Revision: 3958

Log:
Merge the new_features branch (manully, thanks to svn)

Added:
   jhalfs/trunk/pkgmngt/packInstall.sh.porg
   jhalfs/trunk/pkgmngt/packageManager.xml.porg
Modified:
   jhalfs/trunk/BLFS/gen_pkg_book.sh
   jhalfs/trunk/BLFS/xsl/gen_config.xsl
   jhalfs/trunk/BLFS/xsl/scripts.xsl
   jhalfs/trunk/Config.in
   jhalfs/trunk/LFS/lfs.xsl
   jhalfs/trunk/README.PACKAGE_MANAGEMENT
   jhalfs/trunk/common/libs/func_book_parser
   jhalfs/trunk/common/libs/func_install_blfs
   jhalfs/trunk/common/libs/func_validate_configs.sh
   jhalfs/trunk/common/makefile-functions
   jhalfs/trunk/jhalfs

Modified: jhalfs/trunk/BLFS/gen_pkg_book.sh
==============================================================================
--- jhalfs/trunk/BLFS/gen_pkg_book.sh	Sat Apr  8 02:33:44 2017	(r3957)
+++ jhalfs/trunk/BLFS/gen_pkg_book.sh	Sun Apr  9 03:29:32 2017	(r3958)
@@ -26,6 +26,7 @@
 declare -a TARGET
 declare DEP_LEVEL
 declare SUDO
+declare WRAP_INSTALL
 
 #--------------------------#
 parse_configuration() {    #
@@ -44,6 +45,7 @@
       # 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 @@
   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 @@
 rm -rf scripts
 xsltproc --xinclude --nonet \
          --stringparam sudo $SUDO \
+         --stringparam wrap-install $WRAP_INSTALL \
          -o ./scripts/ ${MakeScripts} \
          ${BookXml}
 # Make the scripts executable.

Modified: jhalfs/trunk/BLFS/xsl/gen_config.xsl
==============================================================================
--- jhalfs/trunk/BLFS/xsl/gen_config.xsl	Sat Apr  8 02:33:44 2017	(r3957)
+++ jhalfs/trunk/BLFS/xsl/gen_config.xsl	Sun Apr  9 03:29:32 2017	(r3958)
@@ -58,6 +58,16 @@
         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
 </xsl:text>
   </xsl:template>
 

Modified: jhalfs/trunk/BLFS/xsl/scripts.xsl
==============================================================================
--- jhalfs/trunk/BLFS/xsl/scripts.xsl	Sat Apr  8 02:33:44 2017	(r3957)
+++ jhalfs/trunk/BLFS/xsl/scripts.xsl	Sun Apr  9 03:29:32 2017	(r3958)
@@ -21,6 +21,10 @@
     </xsl:choose>
   </xsl:variable>
 
+  <!-- Wrap "root" commands inside a wrapper function, allowing
+       "porg style" package management -->
+  <xsl:param name="wrap-install" select="'n'"/>
+
   <!-- Build as user (y) or as root (n)? -->
   <xsl:param name="sudo" select="'y'"/>
 
@@ -69,8 +73,10 @@
         <xsl:choose>
           <!-- Package page -->
           <xsl:when test="sect2[@role='package']">
-            <!-- We build in a subdirectory -->
-            <xsl:text>PKG_DIR=</xsl:text>
+            <!-- We build in a subdirectory, whose name may be needed
+                 if using package management (see envars.conf), so
+                 "export" it -->
+            <xsl:text>export PKG_DIR=</xsl:text>
             <xsl:value-of select="$filename"/>
             <xsl:text>
 SRC_DIR=${SRC_ARCHIVE}${SRC_SUBDIRS:+/${PKG_DIR}}
@@ -149,6 +155,7 @@
      cp $(find . -mindepth 1 -maxdepth 1 -type l) $UNPACKDIR
      ;;
 esac
+export UNPACKDIR
 cd $UNPACKDIR&#xA;
 </xsl:text>
         <xsl:apply-templates select=".//screen | .//para/command"/>
@@ -407,12 +414,30 @@
     <xsl:if test="child::* = userinput and not(@role = 'nodump')">
       <xsl:choose>
         <xsl:when test="@role = 'root'">
-          <xsl:if test="$sudo = 'y'">
-            <xsl:text>sudo -E sh << ROOT_EOF&#xA;</xsl:text>
+          <xsl:if test="not(preceding-sibling::screen[1][@role='root'])">
+            <xsl:if test="$sudo = 'y'">
+              <xsl:text>sudo -E sh << ROOT_EOF&#xA;</xsl:text>
+            </xsl:if>
+            <xsl:if test="$wrap-install = 'y' and
+                          ancestor::sect2[@role='installation']">
+              <xsl:text>if [ -r "$PACK_INSTALL" ]; then
+  source $PACK_INSTALL
+  export -f wrapInstall
+  export -f packInstall
+fi
+wrapInstall '
+</xsl:text>
+            </xsl:if>
           </xsl:if>
           <xsl:apply-templates mode="root"/>
-          <xsl:if test="$sudo = 'y'">
-            <xsl:text>&#xA;ROOT_EOF</xsl:text>
+          <xsl:if test="not(following-sibling::screen[1][@role='root'])">
+            <xsl:if test="$wrap-install = 'y' and
+                          ancestor::sect2[@role='installation']">
+              <xsl:text>'&#xA;packInstall</xsl:text>
+            </xsl:if>
+            <xsl:if test="$sudo = 'y'">
+              <xsl:text>&#xA;ROOT_EOF</xsl:text>
+            </xsl:if>
           </xsl:if>
         </xsl:when>
         <xsl:otherwise>
@@ -514,6 +539,8 @@
     </xsl:call-template>
   </xsl:template>
 
+  <xsl:variable name="APOS">'</xsl:variable>
+
   <xsl:template name="output-root">
     <xsl:param name="out-string" select="''"/>
     <xsl:choose>
@@ -561,6 +588,19 @@
                           select="substring-after($out-string,'\')"/>
         </xsl:call-template>
       </xsl:when>
+      <xsl:when test="contains($out-string,string($APOS))
+                      and $wrap-install = 'y'
+                      and ancestor::sect2[@role='installation']">
+        <xsl:call-template name="output-root">
+          <xsl:with-param name="out-string"
+                          select="substring-before($out-string,string($APOS))"/>
+        </xsl:call-template>
+        <xsl:text>'\''</xsl:text>
+        <xsl:call-template name="output-root">
+          <xsl:with-param name="out-string"
+                          select="substring-after($out-string,string($APOS))"/>
+        </xsl:call-template>
+      </xsl:when>
       <xsl:otherwise>
         <xsl:value-of select="$out-string"/>
       </xsl:otherwise>

Modified: jhalfs/trunk/Config.in
==============================================================================
--- jhalfs/trunk/Config.in	Sat Apr  8 02:33:44 2017	(r3957)
+++ jhalfs/trunk/Config.in	Sun Apr  9 03:29:32 2017	(r3958)
@@ -757,13 +757,12 @@
             #
             #  You will have to select between:
             #
-            #  - Only final system Glibc, GCC and Binutils testsuites
+            #  - Only critical final system testsuites
             #  - All final system testsuites
             #  - Both temporary tools and final system testsuites
             #
             #  HLFS and CLFS have no testsuites available in the
             #  temporary tools phase
-
             #  You will be prompted also about the "flavour" of the
             #  testsuites run:
             #
@@ -771,45 +770,54 @@
             #  - Abort the build at the first test suite failure
             #
 
+    menu "Test settings"
+    depends    CONFIG_TESTS
     choice
         prompt    "Tests level"
-        depends     CONFIG_TESTS
         default    TST_1
 
         config  TST_1
-            bool    "Only final critical testsuites" if !BOOK_CLFS2 && !BOOK_CLFS3
+            bool    "Only final system critical testsuites"
+            help
+                #-- Critical tests:
+                # Only Glibc, Binutils, GMP, MPFR, MPC and GCC
+                # testsuites for final system
 
         config    TST_2
             bool    "All final system testsuites"
 
         config    TST_3
-            bool    "Both temporary tools and final system testsuites" if !BOOK_HLFS && !BOOK_CLFS
+            bool    "All testsuites" if !BOOK_HLFS && !BOOK_CLFS
+            help
+                #-- All tests:
+                # Runs all the testsuites for both temporary tools
+                # and final system
     endchoice
 
-    config    TEST
-        int
-        default    "0"    if !CONFIG_TESTS
-        default    "1"    if TST_1
-        default    "2"    if TST_2
-        default    "3"    if TST_3
-
     choice
         prompt    "Flavour"
-        depends    CONFIG_TESTS
 
         config    NO_BOMB
-            bool    "Don't stop on testsuite failures"
+            bool    "Don't stop on test failures"
 
         config    BOMB
-            bool    "Abort the build on the first testsuite failure"
+            bool    "Abort the build on the first test failure"
     endchoice
 
+    config    TEST
+        int
+        default    "0"    if !CONFIG_TESTS
+        default    "1"    if TST_1
+        default    "2"    if TST_2
+        default    "3"    if TST_3
+
     config    BOMB_TEST
         bool
         default    n if NO_BOMB
         default    y if BOMB
 
     #--- End Test Suites
+    endmenu # test settings
 
     #--- Package Management
     config  PKGMNGT
@@ -819,10 +827,18 @@
         help
             #-- Use package management
             #
-            #  If set, the packages in the final phase are built
-            #  in a separate directory, PKG_DEST.
-            #  You should provide a bash function for packing
-            #  and installing the package.
+            #  If set, you'll have to choose between
+            #  two package management styles:
+            #  - Build and install:
+            #    the packages in the final phase are built
+            #    in a separate directory, PKG_DEST.
+            #    You should provide a bash function for
+            #    packaing and installing the package.
+            #  - Preload a library before install:
+            #    Run the install instructions inside a
+            #    wrapper command, which monitors the
+            #    installed files.
+            #
             #  Also, you have to provide the instructions
             #  to build the package manager during the
             #  temporary tools phase, in the form of a
@@ -830,7 +846,22 @@
             #  sect1. See README.PACKAGE_MANAGEMENT
             #
             #  For now, this only works with LFS
+    choice
+        depends PKGMNGT
+        prompt "Package management style"
+        default PKG_PACK
+
+        config PKG_PACK
+            bool "Build and pack (pacman or dpkg style)"
+
+        config LIB_LOAD
+            bool "Preload a library before installing (porg style)"
+    endchoice
 
+    config WRAP_INSTALL
+        bool
+        default y if LIB_LOAD
+        default n if PKG_PACK
     #--- End package management
 
     #--- Installed files logs
@@ -843,13 +874,31 @@
 
     #--- End Installed files logs
 
+    config    STRIP
+        bool "Strip Installed Binaries/Libraries"
+        default n
+        depends on !BOOK_CLFS3
+
+    config    NO_PROGRESS_BAR
+        bool "DO NOT use/display progress_bar "
+        default n
+        help
+            #-- Do not use the progress bar routine. On slower machines
+            #   this function consumes precious CPU cycles.
+
+#--- End Build Settings
+endmenu
+
+menu "System configuration
+    depends !BOOK_BLFS
+
     #--- FSTAB
     config    HAVE_FSTAB
         bool    "Use a custom fstab file"
         default    n
         help
             #-- Select this if you have an fstab file with entries
-                        #   for the target system
+            #   for the target system
 
     config    FSTAB
         string    "Fstab file (optional)"
@@ -880,11 +929,6 @@
             #   and renamed 'kernel-config'
     #--- End Kernel
 
-    config    STRIP
-        bool "Strip Installed Binaries/Libraries"
-        default n
-        depends on !BOOK_CLFS3
-
     config    VIMLANG
         bool "Install vim-lang package"
         default n
@@ -894,13 +938,6 @@
             #   NOTE: This option is obsolete with the 7.3 release of Vim
             #   which is included in all recent releases of LFS.
 
-    config    NO_PROGRESS_BAR
-        bool "DO NOT use/display progress_bar "
-        default n
-        help
-            #-- Do not use the progress bar routine. On slower machines
-            #   this function consumes precious CPU cycles.
-
     config    TIMEZONE
         string "TimeZone"
         default "GMT"
@@ -946,8 +983,53 @@
         default    "A4"        if PAGE_A4
     #--- End Groff page
 
-#--- End Build Settings
-endmenu
+    config    HOSTNAME
+        string "Hostname"
+        default "**EDITME**"
+
+       menu "Network configuration"
+        config INTERFACE
+            string "netword card name"
+            default "eth0"
+        config IP_ADDR
+            string "Static IP address"
+            default "10.0.2.9"
+        config GATEWAY
+            string "Gateway"
+            default "10.0.2.2"
+        config PREFIX
+            string "Subnet prefix"
+            default "24"
+        config BROADCAST
+            string "Broadcast address"
+            default "10.0.2.255"
+        config DOMAIN
+            string "Domain name"
+            default "lfs.org"
+        config DNS1
+            string "Primary Name server"
+            default "10.0.2.3"
+        config DNS2
+            string "Secondary Name server"
+            default "8.8.8.8"
+    endmenu # Network configuration
+
+    menu "Console configuration"
+        config FONT
+            string "Console font"
+            default "lat0-16"
+        config FONTMAP
+            string "Font map (-m option to setfont)"
+            default "8859-1"
+        config UNICODE
+            bool "Unicode mode"
+            default y
+        config KEYMAP
+            string "Keymap name"
+            default "us"
+    endmenu # Console configuration
+
+endmenu        #--- System configuration
 
 menu "Advanced Features"
 depends !BOOK_BLFS

Modified: jhalfs/trunk/LFS/lfs.xsl
==============================================================================
--- jhalfs/trunk/LFS/lfs.xsl	Sat Apr  8 02:33:44 2017	(r3957)
+++ jhalfs/trunk/LFS/lfs.xsl	Sun Apr  9 03:29:32 2017	(r3958)
@@ -8,6 +8,8 @@
       extension-element-prefixes="exsl"
       version="1.0">
 
+<!-- Parameters -->
+
   <!-- which revision attribute to include: can only be sysv or systemd,
        but we leave checking to the caller-->
   <xsl:param name="revision" select="'sysv'"/>
@@ -16,11 +18,18 @@
        n = no, original behavior
        y = yes, add PKG_DEST to scripts in install commands of chapter06-08
   -->
-  <xsl:param name="pkgmngt" select="n"/>
+  <xsl:param name="pkgmngt" select="'n'"/>
+
+  <!-- Package management with "porg style" ?
+       n = no,  same as pkgmngt description above
+       y = yes, wrap install commands of chapter06-08 into a bash function.
+                note that pkgmngt must be 'y' in this case
+  -->
+  <xsl:param name="wrap-install" select='"n"'/>
  
   <!-- Run test suites?
        0 = none
-       1 = only chapter06 Glibc, GCC and Binutils testsuites
+       1 = only chapter06 critical testsuites
        2 = all chapter06 testsuites
        3 = all chapter05 and chapter06 testsuites
   -->
@@ -30,23 +39,39 @@
        n = no, I want to build the full system and review the logs
        y = yes, bomb at the first test suite failure to can review the build dir
   -->
-  <xsl:param name="bomb-testsuite" select="n"/>
+  <xsl:param name="bomb-testsuite" select="'n'"/>
 
   <!-- Install vim-lang package? OBSOLETE should always be 'n'-->
-  <xsl:param name="vim-lang" select="n"/>
+  <xsl:param name="vim-lang" select="'n'"/>
   
   <!-- Time zone -->
-  <xsl:param name="timezone" select="GMT"/>
+  <xsl:param name="timezone" select="'GMT'"/>
   
   <!-- Page size -->
-  <xsl:param name="page" select="letter"/>
+  <xsl:param name="page" select="'letter'"/>
   
   <!-- Locale settings -->
-  <xsl:param name="lang" select="C"/>
+  <xsl:param name="lang" select="'C'"/>
 
   <!-- Install the whole set of locales -->
-  <xsl:param name='full-locale' select='n'/>
+  <xsl:param name='full-locale' select='"n"'/>
   
+  <!-- Hostname -->
+  <xsl:param name='hostname' select='"HOSTNAME"'/>
+
+  <!-- Network parameters: interface, ip, gateway, prefix, broadcast, domain
+       and nameservers -->
+  <xsl:param name='interface'   select="'eth0'"/>
+  <xsl:param name='ip'          select='"10.0.2.9"'/>
+  <xsl:param name='gateway'     select='"10.0.2.2"'/>
+  <xsl:param name='prefix'      select='24'/>
+  <xsl:param name='broadcast'   select='"10.0.2.255"'/>
+  <xsl:param name='domain'      select='"lfs.org"'/>
+  <xsl:param name='nameserver1' select='"10.0.2.3"'/>
+  <xsl:param name='nameserver2' select='"8.8.8.8"'/>
+
+<!-- End parameters -->
+
   <xsl:template match="/">
     <xsl:apply-templates select="//sect1[not(@revision) or
                                          @revision=$revision]"/>
@@ -176,7 +201,13 @@
                descendant::screen[not(@role) or
                                   @role != 'nodump']/userinput[
                                                     @remap='install']">
-      <xsl:text>mkdir -pv $PKG_DEST/{boot,etc,lib,bin,sbin}
+      <xsl:choose>
+        <xsl:when test="$wrap-install='y'">
+          <xsl:text>wrapInstall '
+</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>mkdir -pv $PKG_DEST/{boot,etc,lib,bin,sbin}
 mkdir -pv $PKG_DEST/usr/{lib,bin,sbin,include}
 mkdir -pv $PKG_DEST/usr/share/{doc,info,man}
 mkdir -pv $PKG_DEST/usr/share/man/man{1..8}
@@ -185,10 +216,13 @@
  x86_64) ln -sv lib $PKG_DEST/lib64 && ln -sv lib $PKG_DEST/usr/lib64 ;;
 esac
 </xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
     </xsl:if>
     <xsl:if test="../@id = 'ch-system-glibc' and
                   @role='installation' and
-                  $pkgmngt = 'y'">
+                  $pkgmngt = 'y' and
+                  $wrap-install = 'n'">
       <xsl:text>mkdir -pv $PKG_DEST/usr/include/{rpc,rpcsvc}
 </xsl:text>
     </xsl:if>
@@ -202,27 +236,54 @@
                   descendant::screen[not(@role) or
                                      @role != 'nodump']/userinput[
                                                        @remap='install']">
-      <xsl:if test="../@id = 'ch-system-man-pages'">
+      <xsl:choose>
+        <xsl:when test="$wrap-install='y'">
+          <xsl:if test="../@id = 'ch-system-man-pages'">
 <!-- these files are provided by the shadow package -->
-  <xsl:text>rm -fv $PKG_DEST/usr/share/man/{man3/getspnam.3,man5/passwd.5}
+            <xsl:text>rm -fv /usr/share/man/{man3/getspnam.3,man5/passwd.5}
 </xsl:text>
-      </xsl:if>
+          </xsl:if>
 <!-- Attr man/man2 pages are already installed by man-pages. As of
      March 2013, they are the same pages.
      November 2015: now they are more accurate
      in man-pages, and the man5 section is also in man-pages... -->
-      <xsl:if test="../@id = 'ch-system-attr'">
-        <xsl:text>rm -fv $PKG_DEST/usr/share/man/man2/*
+          <xsl:if test="../@id = 'ch-system-attr'">
+            <xsl:text>rm -fv /usr/share/man/man2/*
+rm -fv /usr/share/man/man5/*
+</xsl:text>
+          </xsl:if>
+<!-- nologin is installed by util-linux. remove it from shadow -->
+          <xsl:if test="../@id = 'ch-system-shadow'">
+            <xsl:text>rm -fv /usr/share/man/man8/nologin.8
+rm -fv /sbin/nologin
+</xsl:text>
+          </xsl:if>
+          <xsl:text>'
+packInstall
+</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:if test="../@id = 'ch-system-man-pages'">
+<!-- these files are provided by the shadow package -->
+            <xsl:text>rm -fv $PKG_DEST/usr/share/man/{man3/getspnam.3,man5/passwd.5}
+</xsl:text>
+          </xsl:if>
+<!-- Attr man/man2 pages are already installed by man-pages. As of
+     March 2013, they are the same pages.
+     November 2015: now they are more accurate
+     in man-pages, and the man5 section is also in man-pages... -->
+          <xsl:if test="../@id = 'ch-system-attr'">
+            <xsl:text>rm -fv $PKG_DEST/usr/share/man/man2/*
 rm -fv $PKG_DEST/usr/share/man/man5/*
 </xsl:text>
-      </xsl:if>
+          </xsl:if>
 <!-- nologin is installed by util-linux. remove it from shadow -->
-      <xsl:if test="../@id = 'ch-system-shadow'">
-        <xsl:text>rm -fv $PKG_DEST/usr/share/man/man8/nologin.8
+          <xsl:if test="../@id = 'ch-system-shadow'">
+            <xsl:text>rm -fv $PKG_DEST/usr/share/man/man8/nologin.8
 rm -fv $PKG_DEST/sbin/nologin
 </xsl:text>
-      </xsl:if>
-      <xsl:text>rm -fv $PKG_DEST/{,usr/}lib64
+          </xsl:if>
+          <xsl:text>rm -fv $PKG_DEST/{,usr/}lib64
 rm -fv $PKG_DEST/usr/{man,doc,info}
 for dir in $PKG_DEST/usr/share/man/man{1..8}; do
   [[ -z $(ls $dir) ]] && rmdir -v $dir
@@ -239,6 +300,8 @@
 packInstall
 rm -rf $PKG_DEST
 </xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
     </xsl:if>
     <xsl:if test="$testsuite='3' and
             ../@id='ch-tools-glibc' and
@@ -309,7 +372,7 @@
            mode="pkgmngt"/>
         <xsl:if test="$dirname = 'chapter06'">
           <xsl:text>packInstall
-rm -rf $PKG_DEST
+rm -rf "$PKG_DEST"
 </xsl:text>
         </xsl:if>
         <xsl:apply-templates
@@ -452,7 +515,26 @@
               </xsl:otherwise>
             </xsl:choose>
           </xsl:when>
-          <xsl:otherwise><!--pkgmngt = 'y'-->
+          <xsl:when test="$wrap-install='y'">
+            <xsl:choose>
+              <xsl:when test="./literal">
+                <xsl:call-template name="output-wrap">
+                  <xsl:with-param name="commands" select="text()[1]"/>
+                </xsl:call-template>
+                <xsl:apply-templates select="literal"/>
+                <xsl:call-template name="output-wrap">
+                  <xsl:with-param name="commands" select="text()[2]"/>
+                </xsl:call-template>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:call-template name="output-wrap">
+                  <xsl:with-param name="commands" select="string()"/>
+                </xsl:call-template>
+              </xsl:otherwise>
+            </xsl:choose>
+            <xsl:text>&#xA;</xsl:text>
+          </xsl:when>
+          <xsl:otherwise><!--pkgmngt = 'y' and wrap-install='n'-->
             <xsl:choose>
               <xsl:when test="./literal">
                 <xsl:call-template name="outputpkgdest">
@@ -476,7 +558,7 @@
            tzdata. -->
       <xsl:when test="contains(string(),'tzdata') and $pkgmngt='y'">
         <xsl:text>
-OLD_PKG_DEST=$PKG_DEST
+OLD_PKG_DEST="$PKG_DEST"
 OLD_PKGDIR=$PKGDIR
 PKG_DEST=$(dirname $OLD_PKG_DEST)/001-tzdata
 PKGDIR=$(dirname $PKGDIR)/tzdata-</xsl:text>
@@ -485,12 +567,28 @@
                                '.tar')"/>
         <xsl:text>
 </xsl:text>
-        <xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
-        <xsl:text>ZONEINFO=$PKG_DEST</xsl:text>
-        <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
-        <xsl:text>
+        <xsl:choose>
+          <xsl:when test="$wrap-install='n'">
+            <xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
+            <xsl:text>ZONEINFO=$PKG_DEST</xsl:text>
+            <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
+            <xsl:text>
 packInstall
 rm -rf $PKG_DEST
+</xsl:text>
+          </xsl:when>
+          <xsl:otherwise><!-- wrap-install='y' -->
+            <xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
+            <xsl:text>
+wrapInstall '
+ZONEINFO=</xsl:text>
+            <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
+            <xsl:text>'
+packInstall
+</xsl:text>
+          </xsl:otherwise>
+        </xsl:choose>
+        <xsl:text>
 PKG_DEST=$OLD_PKG_DEST
 unset OLD_PKG_DEST
 PKGDIR=$OLD_PKGDIR
@@ -517,6 +615,34 @@
       <xsl:when test="contains(string(.),'<ll>_<CC>')">
         <xsl:value-of select="$lang"/>
       </xsl:when>
+      <xsl:when test="contains(string(.),'Domain')">
+        <xsl:value-of select="$domain"/>
+      </xsl:when>
+      <xsl:when test="contains(string(.),'primary')">
+        <xsl:value-of select="$nameserver1"/>
+      </xsl:when>
+      <xsl:when test="contains(string(.),'secondary')">
+        <xsl:value-of select="$nameserver2"/>
+      </xsl:when>
+      <xsl:when test="contains(string(.),'192.168.1.1')">
+        <xsl:value-of select="$ip"/>
+      </xsl:when>
+      <xsl:when test="contains(string(.),'192.168.0.2')">
+        <xsl:value-of select="$ip"/>
+      </xsl:when>
+<!-- Only adapted to LFS-20170310 and later -->
+      <xsl:when test="contains(string(.),'HOSTNAME')">
+        <xsl:value-of select="$hostname"/>
+      </xsl:when>
+      <xsl:when test="contains(string(.),'FQDN')">
+        <xsl:value-of select="$hostname"/>
+        <xsl:text>.</xsl:text>
+        <xsl:value-of select="$domain"/>
+      </xsl:when>
+      <xsl:when test="contains(string(.),'alias')"/>
+      <xsl:when test="contains(string(.),'<lfs>')">
+        <xsl:value-of select="$hostname"/>
+      </xsl:when>
       <xsl:otherwise>
         <xsl:text>**EDITME</xsl:text>
         <xsl:apply-templates/>
@@ -525,6 +651,185 @@
     </xsl:choose>
   </xsl:template>
   
+  <xsl:template match="literal">
+    <xsl:choose>
+      <xsl:when test="contains(string(),'ONBOOT')">
+        <xsl:call-template name="outputnet">
+          <xsl:with-param name="netstring" select="string()"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="contains(string(),'[Match]')">
+        <xsl:call-template name="outputsysdnet">
+          <xsl:with-param name="netstring" select="string()"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="outputnet">
+    <xsl:param name="netstring" select="''"/>
+    <!-- We suppose that book example has the following values:
+         - interface: eth0
+         - ip: 192.168.1.2
+         - gateway: 192.168.1.1
+         - prefix: 24
+         - broadcast: 192.168.1.255
+         Change below if book changes -->
+    <xsl:choose>
+      <xsl:when test="contains($netstring,'eth0')">
+        <xsl:call-template name="outputnet">
+          <xsl:with-param name="netstring"
+                          select="substring-before($netstring,'eth0')"/>
+        </xsl:call-template>
+        <xsl:value-of select="$interface"/>
+        <xsl:call-template name="outputnet">
+          <xsl:with-param name="netstring"
+                          select="substring-after($netstring,'eth0')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="contains($netstring,'192.168.1.1')">
+        <xsl:call-template name="outputnet">
+          <xsl:with-param name="netstring"
+                          select="substring-before($netstring,'192.168.1.1')"/>
+        </xsl:call-template>
+        <xsl:value-of select="$gateway"/>
+        <xsl:call-template name="outputnet">
+          <xsl:with-param name="netstring"
+                          select="substring-after($netstring,'192.168.1.1')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <!-- must test this before the following, because 192.168.1.255 contains
+           192.168.1.2! -->
+      <xsl:when test="contains($netstring,'192.168.1.255')">
+        <xsl:call-template name="outputnet">
+          <xsl:with-param name="netstring"
+                          select="substring-before($netstring,'192.168.1.255')"/>
+        </xsl:call-template>
+        <xsl:value-of select="$broadcast"/>
+        <xsl:call-template name="outputnet">
+          <xsl:with-param name="netstring"
+                          select="substring-after($netstring,'192.168.1.255')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="contains($netstring,'192.168.1.2')">
+        <xsl:call-template name="outputnet">
+          <xsl:with-param name="netstring"
+                          select="substring-before($netstring,'192.168.1.2')"/>
+        </xsl:call-template>
+        <xsl:value-of select="$ip"/>
+        <xsl:call-template name="outputnet">
+          <xsl:with-param name="netstring"
+                          select="substring-after($netstring,'192.168.1.2')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="contains($netstring,'24')">
+        <xsl:call-template name="outputnet">
+          <xsl:with-param name="netstring"
+                          select="substring-before($netstring,'24')"/>
+        </xsl:call-template>
+        <xsl:value-of select="$prefix"/>
+        <xsl:call-template name="outputnet">
+          <xsl:with-param name="netstring"
+                          select="substring-after($netstring,'24')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$netstring"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="outputsysdnet">
+    <xsl:param name="netstring" select="''"/>
+    <!-- We suppose that book example has the following values:
+         - interface: eth0
+         - ip: 192.168.0.2
+         - gateway: 192.168.0.1
+         - prefix: 24
+         - DNS: 192.168.0.1
+         - Domain: <Your Domain Name>
+         and gateway comes before DNS. Change below if book changes -->
+    <xsl:choose>
+      <xsl:when test="contains($netstring,'eth0')">
+        <xsl:call-template name="outputsysdnet">
+          <xsl:with-param name="netstring"
+                          select="substring-before($netstring,'eth0')"/>
+        </xsl:call-template>
+        <xsl:value-of select="$interface"/>
+        <xsl:call-template name="outputsysdnet">
+          <xsl:with-param name="netstring"
+                          select="substring-after($netstring,'eth0')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="contains($netstring,'192.168.0.1') and
+                      contains($netstring,'Gateway')">
+        <xsl:call-template name="outputsysdnet">
+          <xsl:with-param name="netstring"
+                          select="substring-before($netstring,'192.168.0.1')"/>
+        </xsl:call-template>
+        <xsl:value-of select="$gateway"/>
+        <xsl:call-template name="outputsysdnet">
+          <xsl:with-param name="netstring"
+                          select="substring-after($netstring,'192.168.0.1')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="contains($netstring,'192.168.0.1') and
+                      not(contains($netstring,'Gateway'))">
+        <xsl:call-template name="outputsysdnet">
+          <xsl:with-param name="netstring"
+                          select="substring-before($netstring,'192.168.0.1')"/>
+        </xsl:call-template>
+        <xsl:value-of select="$nameserver1"/>
+        <xsl:text>
+DNS=</xsl:text>
+        <xsl:value-of select="$nameserver2"/>
+        <xsl:call-template name="outputsysdnet">
+          <xsl:with-param name="netstring"
+                          select="substring-after($netstring,'192.168.0.1')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="contains($netstring,'192.168.0.2')">
+        <xsl:call-template name="outputsysdnet">
+          <xsl:with-param name="netstring"
+                          select="substring-before($netstring,'192.168.0.2')"/>
+        </xsl:call-template>
+        <xsl:value-of select="$ip"/>
+        <xsl:call-template name="outputsysdnet">
+          <xsl:with-param name="netstring"
+                          select="substring-after($netstring,'192.168.0.2')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="contains($netstring,'24')">
+        <xsl:call-template name="outputsysdnet">
+          <xsl:with-param name="netstring"
+                          select="substring-before($netstring,'24')"/>
+        </xsl:call-template>
+        <xsl:value-of select="$prefix"/>
+        <xsl:call-template name="outputsysdnet">
+          <xsl:with-param name="netstring"
+                          select="substring-after($netstring,'24')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="contains($netstring,'<Your Domain Name>')">
+        <xsl:call-template name="outputsysdnet">
+          <xsl:with-param name="netstring"
+                          select="substring-before($netstring,'<Your Domain Name>')"/>
+        </xsl:call-template>
+        <xsl:value-of select="$domain"/>
+        <xsl:call-template name="outputsysdnet">
+          <xsl:with-param name="netstring"
+                          select="substring-after($netstring,'<Your Domain Name>')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$netstring"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
   <xsl:template name="outputpkgdest">
     <xsl:param name="outputstring" select="foo"/>
     <xsl:choose>
@@ -623,4 +928,26 @@
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
+
+  <xsl:variable name="APOS">'</xsl:variable>
+  <xsl:template name="output-wrap">
+    <xsl:param name="commands" select="''"/>
+    <xsl:choose>
+      <xsl:when test="contains($commands,string($APOS))">
+        <xsl:call-template name="output-wrap">
+          <xsl:with-param name="commands"
+                          select="substring-before($commands,string($APOS))"/>
+        </xsl:call-template>
+        <xsl:text>'\''</xsl:text>
+        <xsl:call-template name="output-wrap">
+          <xsl:with-param name="commands"
+                          select="substring-after($commands,string($APOS))"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$commands"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
 </xsl:stylesheet>

Modified: jhalfs/trunk/README.PACKAGE_MANAGEMENT
==============================================================================
--- jhalfs/trunk/README.PACKAGE_MANAGEMENT	Sat Apr  8 02:33:44 2017	(r3957)
+++ jhalfs/trunk/README.PACKAGE_MANAGEMENT	Sun Apr  9 03:29:32 2017	(r3958)
@@ -6,32 +6,49 @@
 
       There are several hints discussing package management for LFS, but
   nothing under jhalfs. There used to be a patch for PACO that I cannot
-  find now. This is a modification ("DESTDIR install" automation), which
-  allows to use a package manager inside jhalfs. I hope it is flexible enough
-  to support several package managers, at least among those who use DESTDIR
-  install. My initial implementation used dpkg, from Debian, in a very
-  crude way (Debian has a sophisticated package management system, which
-  I have not tried to use here). There is also a port to Pacman from
-  Arch Linux (http://www.archlinux.org). I am sorry to say I have (almost)
-  no experience with rpm, so I cannot tell whether it would fit.
+  find now. So there was a need for such a tool, and an infrastructure,
+  which allows using a package manager inside jhalfs, has been developped.
+  I hope it is flexible enough to support several package managers, at least
+  among those who use DESTDIR install and/or LD_PRELOAD during install.
+  It has been tested with dpkg from Debian, pacman from Arch Linux,
+  and porg. Sample configuration files are given for those three packages.
+  I am sorry to say I have (almost) no experience with rpm, so I cannot
+  tell whether it would fit.
 
 2. OVERVIEW OF THE SYSTEM:
 
-      Presently, package management is only available for LFS. I plan to
-  upgrade BLFS tools, but nothing usable right now. I have not attempted
-  to adapt this tool for the other flavours of LFS.
-
-      To use package management, you need to create the required files in
-  the pkgmngt directory (see below), and to select "package management" in
-  the build settings. Note that this is incompatible with creating an SBU
-  and usage report.
-
-3. DETAILS OF OPERATION:
-
-      This system performs basically a "DESTDIR install" for all pages
-  in chapter 6, 7 and 8 of the book. The name of the DESTDIR directory is the
-  same as the one of the executed script. The path to this directory is
-  made available to the scriplets through the PKG_DEST variable.
+      For now, package management is only available for LFS. The `porg style'
+  (see below) package management has been ported to BLFS, but not the distro
+  style one (the book layout makes it rather difficult). I have not attempted
+  to adapt this tool for the other flavours of LFS (TODO).
+
+      This tool comes in two flavours:
+  - for distros package managers (e.g dpkg or pacman), it basically performs
+    a "DESTDIR install" for all pages in chapter 6, 7 and 8 of the book. The
+    name of the DESTDIR directory is the same as the one of the executed
+    script. The path to this directory is available to the scriplets through
+    the PKG_DEST variable. The details of the DESTDIR part are given below.
+    After the package is installed in $PKG_DEST, a function "packInstall" is
+    called, which is supposed to create a binary package (e.g. make a .deb
+    file), store it to a repository and install it to the system.
+  - for porg style package manager, the install instructions are wrapped
+    between pairs of single quotes ('). This allows passing those instructions
+    to a function ("wrapInstall"), which may itself call porg or another
+    (e.g. fakeroot, not tested) instruction wrapper. Note that if the
+    instructions contain single quote charaters, they are changed to '\'',
+    which pass them literally. At the end of the installation, a function
+    "packInstall" is called, with a slighly different aim compared to the
+    DESTDIR one: it is used to make a tarball of the installed files (e.g.
+    using "porgball") and store them into some repository. But there is no
+    need to install them to the system, since this has already been done.
+
+      Note that with carefully crafted "packInstall" and "wrapInstall"
+  functions, a combination of the two methods could be used, for example for
+  DESTDIR installs using fakeroot. This is work in progress and not fully
+  implemented yet.
+
+3. DETAILS:
+
       The XSL stylesheet used for generating the scriptlets, automatically
   adds DESTDIR install instructions when "package management" is selected.
   Also all the paths beginning with " /" or ">/" (absolute paths) are prepended
@@ -43,6 +60,7 @@
   creates a reasonable subset of the FHS hierarchy into the destination
   directory. Empty directories are then removed before packing the
   binary package.
+
       In order to use the package manager, it has to be installed at the end of
   chapter 5 (temporary installation in /tools) and chapter 6 (final install).
   Furthermore, the administrative files and directories have to be created
@@ -51,20 +69,21 @@
   the necessary instructions and enough information to download the tarball.
   This file should reside in the `pkgmngt' directory and be named
   `packageManager.xml'. A template named `packageManager.xml.template' is
-  provided in the `pkgmngt' subdirectory. There are also two XML files for
-  dpkg and pacman, respectively `packageManager.xml.dpkg' and
-  `packageManager.xml.pacman', that you can copy to `packageManager.xml'.
+  provided in the `pkgmngt' subdirectory. There are also three XML files for
+  dpkg, pacman, and porg, respectively `packageManager.xml.dpkg',
+  `packageManager.xml.pacman',  and `packageManager.xml.porg', that you can
+  copy to `packageManager.xml' and modify to suit your needs.
   They are not updated often, so the versions used can be rather old.
-      The last thing to do is to tell how to use the package manager. When
-  the binary package is ready, the scriptlets call a shell function named
-  `packInstall', which should pack the binary package and install it on the
-  system. Note that nothing has been done to manage configuration files, 
+
+      The last thing to do is to tell how to use the package manager. The user
+  has to provide two functions, "wrapInstall" and "packInstall", as described
+  above. Please note that nothing has been done to manage configuration files, 
   which are ususally treated specially by package managers: depending on
   the book layout, it is sometimes possible to create those files afterwards,
   and sometimes not, which means that you have to check them after each
-  upgrade. The user has to write his own `packInstall' function. The shell
-  function should be defined in a file named `packInstall.sh', residing in
-  the `pkgmngt' directory. A template is provided, as well as two example
-  scripts for dpkg and pacman. Note that, due to the way pacman checks the
-  available space on disk, the root directory in chroot must be a mount point,
-  otherwise the installation of packages fails.
+  upgrade. Both functions should be defined in a file named `packInstall.sh',
+  residing in the `pkgmngt' directory. A template is provided (actually a copy
+  of the file for dpkg), as well as three example scripts for dpkg, pacman,
+  and porg. Pacman Note: due to the way pacman checks the available space on
+  disk, the root directory in chroot must be a mount point, otherwise the
+  installation of packages fails.

Modified: jhalfs/trunk/common/libs/func_book_parser
==============================================================================
--- jhalfs/trunk/common/libs/func_book_parser	Sat Apr  8 02:33:44 2017	(r3957)
+++ jhalfs/trunk/common/libs/func_book_parser	Sun Apr  9 03:29:32 2017	(r3958)
@@ -164,19 +164,29 @@
         fi
         popd > /dev/null
 
-        xsltproc --nonet                                   \
-                 --xinclude                                \
-                 --stringparam revision       $INITSYS     \
-                 --stringparam testsuite      $TEST        \
-                 --stringparam bomb-testsuite $BOMB_TEST   \
-                 --stringparam vim-lang       $VIMLANG     \
-                 --stringparam full-locale    $FULL_LOCALE \
-                 --stringparam timezone       $TIMEZONE    \
-                 --stringparam page           $PAGE        \
-                 --stringparam lang           $LANG        \
-                 --stringparam pkgmngt        $PKGMNGT     \
-                 --output ./${PROGNAME}-commands/          \
-                 $XSL                                      \
+        xsltproc --nonet                                    \
+                 --xinclude                                 \
+                 --stringparam revision       $INITSYS      \
+                 --stringparam testsuite      $TEST         \
+                 --stringparam bomb-testsuite $BOMB_TEST    \
+                 --stringparam vim-lang       $VIMLANG      \
+                 --stringparam full-locale    $FULL_LOCALE  \
+                 --stringparam timezone       $TIMEZONE     \
+                 --stringparam page           $PAGE         \
+                 --stringparam lang           $LANG         \
+                 --stringparam pkgmngt        $PKGMNGT      \
+                 --stringparam wrap-install   $WRAP_INSTALL \
+                 --stringparam hostname       $HOSTNAME     \
+                 --stringparam interface      $INTERFACE    \
+                 --stringparam ip             $IP_ADDR      \
+                 --stringparam gateway        $GATEWAY      \
+                 --stringparam prefix         $PREFIX       \
+                 --stringparam broadcast      $BROADCAST    \
+                 --stringparam domain         $DOMAIN       \
+                 --stringparam nameserver1    $DNS1         \
+                 --stringparam nameserver2    $DNS2         \
+                 --output ./${PROGNAME}-commands/           \
+                 $XSL                                       \
                  $BOOK/index.xml >> $LOGDIR/$LOG 2>&1
       ;;
     *)  echo -n " ${L_arrow}${PROGNAME}${R_arrow} book invalid, terminate build... "

Modified: jhalfs/trunk/common/libs/func_install_blfs
==============================================================================
--- jhalfs/trunk/common/libs/func_install_blfs	Sat Apr  8 02:33:44 2017	(r3957)
+++ jhalfs/trunk/common/libs/func_install_blfs	Sun Apr  9 03:29:32 2017	(r3958)
@@ -12,6 +12,11 @@
 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/' \
+      $PKGMNGTDIR/packInstall.sh > ${BUILDDIR}${BLFS_ROOT}/packInstall.sh
+fi
 
 # Clean-up
 make -C ${BUILDDIR}${BLFS_ROOT}/menu clean
@@ -115,6 +120,7 @@
 MAIL_SERVER=sendmail
 optDependency=2
 SUDO=n
+WRAP_INSTALL=$WRAP_INSTALL
 EOF
 
 # Generates the scripts for the blfs tools dependencies (in ./scripts)

Modified: jhalfs/trunk/common/libs/func_validate_configs.sh
==============================================================================
--- jhalfs/trunk/common/libs/func_validate_configs.sh	Sat Apr  8 02:33:44 2017	(r3957)
+++ jhalfs/trunk/common/libs/func_validate_configs.sh	Sun Apr  9 03:29:32 2017	(r3958)
@@ -41,14 +41,17 @@
   local -r CLFS3_book="$BOOK_common                  $BOOK_clfsX PLATFORM MIPS_LEVEL"
 
   # Build Settings by book
-  local -r   LFS_build="$BUILD_chroot VIMLANG $BUILD_common PKGMNGT FULL_LOCALE"
+  local -r   LFS_build="$BUILD_chroot VIMLANG $BUILD_common PKGMNGT FULL_LOCALE WRAP_INSTALL"
   local -r  HLFS_build="$BUILD_chroot         $BUILD_common"
   local -r  CLFS_build="$BUILD_chroot VIMLANG $BUILD_common"
   local -r CLFS2_build="STRIP         VIMLANG $BUILD_common"
   local -r CLFS3_build="                      $BUILD_common"
 
+  # System Settings by book (only LFS for now)
+  local -r LFS_system="HOSTNAME INTERFACE IP_ADDR GATEWAY PREFIX BROADCAST DOMAIN DNS1 DNS2 FONT CONSOLE_MAP UNICODE KEYMAP"
+
   # Full list of books settings
-  local -r   lfs_PARAM_LIST="$LFS_book   $GENERAL_common $LFS_build   $ADVANCED_chroot $ADVANCED_common"
+  local -r   lfs_PARAM_LIST="$LFS_book   $GENERAL_common $LFS_build $LFS_system  $ADVANCED_chroot $ADVANCED_common"
   local -r  hlfs_PARAM_LIST="$HLFS_book  $GENERAL_common $HLFS_build  $ADVANCED_chroot $ADVANCED_common"
   local -r  clfs_PARAM_LIST="$CLFS_book  $GENERAL_common $CLFS_build  $ADVANCED_chroot $ADVANCED_common"
   local -r clfs2_PARAM_LIST="$CLFS2_book $GENERAL_common $CLFS2_build                  $ADVANCED_common"
@@ -193,6 +196,11 @@
                echo
                ;;
 
+        # Treatment of HOSTNAME
+      HOSTNAME)  echo -e "`eval echo $PARAM_VALS`"
+                 [[ "${!config_param}" = "**EDIT ME**" ]] && write_error_and_die
+                 ;;
+
         # Case of PKGMNGT: two files, packageManager.xml and packInstall.sh
         # must exist in $PKGMNGTDIR if PKGMNGT='y':
       PKGMNGT) echo -e "`eval echo $PARAM_VALS`"

Modified: jhalfs/trunk/common/makefile-functions
==============================================================================
--- jhalfs/trunk/common/makefile-functions	Sat Apr  8 02:33:44 2017	(r3957)
+++ jhalfs/trunk/common/makefile-functions	Sun Apr  9 03:29:32 2017	(r3958)
@@ -115,6 +115,7 @@
     echo "export PKG_DEST=$(SRC)/$@" >> envars; \
     echo "source packInstall.sh" >> envars; \
     echo "export -f packInstall" >> envars; \
+    echo "export -f wrapInstall" >> envars; \
   fi;
 endef
 

Modified: jhalfs/trunk/jhalfs
==============================================================================
--- jhalfs/trunk/jhalfs	Sat Apr  8 02:33:44 2017	(r3957)
+++ jhalfs/trunk/jhalfs	Sun Apr  9 03:29:32 2017	(r3958)
@@ -124,6 +124,7 @@
 RUN_FARCE=${RUN_FARCE:-n}
 RUN_ICA=${RUN_ICA:-n}
 PKGMNGT=${PKGMNGT:-n}
+WRAP_INSTALL=${WRAP_INSTALL:-n}
 BOMB_TEST=${BOMB_TEST:-n}
 STRIP=${STRIP:=n}
 REPORT=${REPORT:=n}
@@ -141,6 +142,7 @@
 SET_WARNINGS=${SET_WARNINGS:=n}
 SET_MISC=${SET_MISC:=n}
 SET_BLOWFISH=${SET_BLOWFISH:=n}
+UNICODE=${UNICODE:=n}
 
 if [[ "${NO_PROGRESS_BAR}" = "y" ]] ; then
 	NO_PROGRESS="#"

Added: jhalfs/trunk/pkgmngt/packInstall.sh.porg
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ jhalfs/trunk/pkgmngt/packInstall.sh.porg	Sun Apr  9 03:29:32 2017	(r3958)
@@ -0,0 +1,104 @@
+# $Id:$
+# functions for recording installation of a package and make a tarball,
+# or using fakeroot type commands for install, then packing and installing
+# the package.
+# We only have access to variables PKGDIR and PKG_DEST. Other variables could
+# be set in the environment
+
+extract_version() {
+local VERSION
+
+case $1 in
+  expect*|tcl*|tk*|mozjs*)
+    VERSION=$(echo $1 | sed 's/^[^0-9]*//')
+    ;;
+  vim*|unzip*|zip*)
+    VERSION=$(echo $1 | sed 's/^[^0-9]*\([0-9]\)\([0-9]\)/\1.\2/')
+    ;;
+  wireless_tools*|LVM2*)
+    VERSION=$(echo $1 | sed 's/^[^.]*\.//')
+    ;;
+  x264*)
+    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
+        # parent dir of the book.
+    local PACKENT=$(dirname $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
+    ;;
+  soundtouch*)
+    local PACKENT=$(dirname $PACK_INSTALL)/blfs-xml/packages.ent
+    VERSION=$(sed -n 's/.*soundtouch[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
+    ;;
+  xf86-video-intel)
+    local PACKENT=$(dirname $PACK_INSTALL)/blfs-xml/x/installing/x7driver-intel.xml
+    VERSION=$(sed -n '/<!--/!s/.*-version[^;][^0-9]*\([^"]*\).*/\1/p' $PACKENT)
+    ;;
+  jdk8*)
+    VERSION=1.8.0.$(echo $1 | sed 's/.*u\([0-9]\+\).*/\1/')
+    ;;
+  docbook-xml)
+    VERSION=4.5
+    ;;
+  cacerts*)
+    VERSION=0.1
+    ;;
+  *)
+    VERSION=$(echo $1 | sed 's/^.*[-_]\([0-9]\)/\1/' | sed 's/_/./g')
+    ;;
+# the last sed above is because some package managers do not want a '_'
+# in version.
+esac
+echo ${VERSION,,}   # convert to lowercase, in case there is a capital letter
+                    # in version
+}
+
+# Export the previous function, since it is used by the others
+export -f extract_version
+# The other "official" functions, wrapInstall and packInstall, are exported
+# by "envars" (in LFS), and the scripts (in BLFS).
+
+wrapInstall() {
+# a bash command is passed as an argument (that may be a compound command).
+# It is executed by this function, after various set-ups...
+
+# Note that PKGDIR is changed to UNPACKDIR
+# and PKG_DEST is changed to PKG_DIR in BLFS tools.
+# The sed for PACKAGE is therefore not needed in BLFS,
+# but it does not hurt, either.
+local PCKGVRS=$(basename $PKGDIR)
+local TGTPKG=$(basename $PKG_DEST)
+local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3\}-//' |
+           sed 's/^[0-9]\{1\}-//')
+# Porg converts package names to lowercase anyway, so do the conversion
+# ourselves
+PACKAGE=${PACKAGE,,}
+# version is only accessible from PKGDIR name. Since the format of the
+# name is not normalized, several hacks are necessary (now in function
+# extract_version)...
+VERSION=$(extract_version $PCKGVRS)
+porg -lp ${PACKAGE}-${VERSION} sh << PORG_EOF
+$*
+PORG_EOF
+}
+
+#----------------
+packInstall() {
+
+# With porg, we need only the package name to make the tarball
+local TGTPKG=$(basename $PKG_DEST)
+local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3\}-//' |
+           sed 's/^[0-9]\{1\}-//')
+local PCKGVRS=$(basename $PKGDIR)
+# Porg converts package names to lowercase anyway, so do the conversion
+# ourselves
+PACKAGE=${PACKAGE,,}
+# Building the binary package
+porgball ${PACKAGE}
+# The package is in the current directory
+VERSION=$(extract_version $PCKGVRS)
+mv -v ${PACKAGE}-${VERSION}.porg* /var/lib/packages
+}

Added: jhalfs/trunk/pkgmngt/packageManager.xml.porg
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ jhalfs/trunk/pkgmngt/packageManager.xml.porg	Sun Apr  9 03:29:32 2017	(r3958)
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" >
+
+<article>
+
+<sect1 id="package">
+  <title>Package Information</title>
+        <para>Download: <ulink url="https://sourceforge.net/projects/porg/files/porg-0.10.tar.gz"/></para>
+        <para>MD5 sum: <literal>2eceb8a73bb188dbb06b12d90cabdbb4</literal></para>
+</sect1>
+
+<sect1 id="ch-tools-pkgmngt" role="wrap">
+  <?dbhtml filename="porg.html"?>
+  <title>Porg in tools</title>
+  <sect2 role="installation">
+    <title>Instructions</title>
+<screen><userinput remap="configure">./configure --prefix=/tools \
+           --disable-grop  \
+           --with-porg-logdir=/tools/var/porg</userinput></screen>
+
+    <para>
+      <parameter>--disable-grop</parameter> is needed to prevent the sytem from
+      trying to build the graphical interface, and
+      <parameter>--with-porg-logdir=...</parameter> is needed because
+      <command>make install</command> insists on creating a directory in
+      <filename class="directory">/var</filename>, where we do not want
+      to write.
+    </para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+<screen><userinput>cat >> /tools/etc/porgrc << EOF
+# Porg logdir on LFS system
+LOGDIR=/var/lib/porg
+EOF
+sed -e '/EXCLUDE/{s/^#//;s@$@:/sources:/home@}' \
+    -i /tools/etc/porgrc</userinput></screen>
+
+  </sect2>
+
+</sect1>
+
+<sect1 id="ch-pkgmngt-creatingdirs">
+
+  <title>Directories</title>
+  <screen><userinput>mkdir -pv /var/lib/porg
+mkdir -pv /var/lib/packages</userinput></screen>
+
+</sect1>
+<sect1 id="ch-pkgmngt-createfiles">
+  <title>Files</title>
+  <para><command>porgball</command> needs <filename>porgrc</filename>
+    in <filename class="directory">/etc</filename>:</para>
+  <screen><userinput>cp /tools/etc/porgrc /etc</userinput></screen>
+</sect1>
+
+<sect1 id="ch-system-pkgmngt" role="wrap">
+  <?dbhtml filename="porg.html"?>
+  <title>Final Porg</title>
+  <sect2 role="installation">
+    <title>Instructions</title>
+
+<screen><userinput remap="configure">./configure --prefix=/usr     \
+            --disable-grop    \
+            --sysconfdir=/etc \
+            --with-porg-logdir=/var/lib/porg</userinput></screen>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+<screen><userinput remap="install">porg -lD "make install"</userinput></screen>
+
+<screen><userinput>sed -e '/EXCLUDE/{s/^#//;s@$@:/sources:/home@}' \
+    -i /etc/porgrc</userinput></screen>
+  </sect2>
+
+</sect1>
+</article>


More information about the alfs-log mailing list