Changeset 945ccaa


Ignore:
Timestamp:
04/09/2017 10:29:32 AM (7 years ago)
Author:
Pierre Labastie <pierre@…>
Branches:
ablfs-more, legacy, trunk
Children:
cee84ad
Parents:
909ee37
Message:

Merge the new_features branch (manully, thanks to svn)

Files:
2 added
11 edited

Legend:

Unmodified
Added
Removed
  • BLFS/gen_pkg_book.sh

    r909ee37 r945ccaa  
    2727declare DEP_LEVEL
    2828declare SUDO
     29declare WRAP_INSTALL
    2930
    3031#--------------------------#
     
    4546      optDependency=* | \
    4647      MAIL_SERVER=*   | \
     48      WRAP_INSTALL=*  | \
    4749      SUDO=*  )  eval ${REPLY} # Define/set a global variable..
    4850                      continue ;;
     
    6365  DEP_LEVEL=$optDependency
    6466  SUDO=${SUDO:-n}
     67  WRAP_INSTALL=${WRAP_INSTALL:-n}
    6568}
    6669
     
    6972#--------------------------#
    7073  local -r dotSTR=".................."
    71   local -r PARAM_LIST="DEP_LEVEL SUDO MAIL_SERVER"
     74  local -r PARAM_LIST="DEP_LEVEL SUDO MAIL_SERVER WRAP_INSTALL"
    7275  local -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
    7376  local config_param
     
    180183xsltproc --xinclude --nonet \
    181184         --stringparam sudo $SUDO \
     185         --stringparam wrap-install $WRAP_INSTALL \
    182186         -o ./scripts/ ${MakeScripts} \
    183187         ${BookXml}
  • BLFS/xsl/gen_config.xsl

    r909ee37 r945ccaa  
    5959                Select if sudo will be used (you build as a normal user)
    6060                        otherwise sudo is not needed (you build as root)
     61
     62
     63config  WRAP_INSTALL
     64        bool "Use `porg style' package management"
     65        default n
     66        help
     67                Select if you want the installation commands to be wrapped
     68                between "wrapInstall '" and "' ; packInstall" functions,
     69                where wrapInstall is used to set up a LD_PRELOAD library (for
     70                example using porg), and packInstall makes the package tarball
    6171</xsl:text>
    6272  </xsl:template>
  • BLFS/xsl/scripts.xsl

    r909ee37 r945ccaa  
    2121    </xsl:choose>
    2222  </xsl:variable>
     23
     24  <!-- Wrap "root" commands inside a wrapper function, allowing
     25       "porg style" package management -->
     26  <xsl:param name="wrap-install" select="'n'"/>
    2327
    2428  <!-- Build as user (y) or as root (n)? -->
     
    7074          <!-- Package page -->
    7175          <xsl:when test="sect2[@role='package']">
    72             <!-- We build in a subdirectory -->
    73             <xsl:text>PKG_DIR=</xsl:text>
     76            <!-- We build in a subdirectory, whose name may be needed
     77                 if using package management (see envars.conf), so
     78                 "export" it -->
     79            <xsl:text>export PKG_DIR=</xsl:text>
    7480            <xsl:value-of select="$filename"/>
    7581            <xsl:text>
     
    150156     ;;
    151157esac
     158export UNPACKDIR
    152159cd $UNPACKDIR&#xA;
    153160</xsl:text>
     
    408415      <xsl:choose>
    409416        <xsl:when test="@role = 'root'">
    410           <xsl:if test="$sudo = 'y'">
    411             <xsl:text>sudo -E sh &lt;&lt; ROOT_EOF&#xA;</xsl:text>
     417          <xsl:if test="not(preceding-sibling::screen[1][@role='root'])">
     418            <xsl:if test="$sudo = 'y'">
     419              <xsl:text>sudo -E sh &lt;&lt; ROOT_EOF&#xA;</xsl:text>
     420            </xsl:if>
     421            <xsl:if test="$wrap-install = 'y' and
     422                          ancestor::sect2[@role='installation']">
     423              <xsl:text>if [ -r "$PACK_INSTALL" ]; then
     424  source $PACK_INSTALL
     425  export -f wrapInstall
     426  export -f packInstall
     427fi
     428wrapInstall '
     429</xsl:text>
     430            </xsl:if>
    412431          </xsl:if>
    413432          <xsl:apply-templates mode="root"/>
    414           <xsl:if test="$sudo = 'y'">
    415             <xsl:text>&#xA;ROOT_EOF</xsl:text>
     433          <xsl:if test="not(following-sibling::screen[1][@role='root'])">
     434            <xsl:if test="$wrap-install = 'y' and
     435                          ancestor::sect2[@role='installation']">
     436              <xsl:text>'&#xA;packInstall</xsl:text>
     437            </xsl:if>
     438            <xsl:if test="$sudo = 'y'">
     439              <xsl:text>&#xA;ROOT_EOF</xsl:text>
     440            </xsl:if>
    416441          </xsl:if>
    417442        </xsl:when>
     
    515540  </xsl:template>
    516541
     542  <xsl:variable name="APOS">'</xsl:variable>
     543
    517544  <xsl:template name="output-root">
    518545    <xsl:param name="out-string" select="''"/>
     
    562589        </xsl:call-template>
    563590      </xsl:when>
     591      <xsl:when test="contains($out-string,string($APOS))
     592                      and $wrap-install = 'y'
     593                      and ancestor::sect2[@role='installation']">
     594        <xsl:call-template name="output-root">
     595          <xsl:with-param name="out-string"
     596                          select="substring-before($out-string,string($APOS))"/>
     597        </xsl:call-template>
     598        <xsl:text>'\''</xsl:text>
     599        <xsl:call-template name="output-root">
     600          <xsl:with-param name="out-string"
     601                          select="substring-after($out-string,string($APOS))"/>
     602        </xsl:call-template>
     603      </xsl:when>
    564604      <xsl:otherwise>
    565605        <xsl:value-of select="$out-string"/>
  • Config.in

    r909ee37 r945ccaa  
    758758            #  You will have to select between:
    759759            #
    760             #  - Only final system Glibc, GCC and Binutils testsuites
     760            #  - Only critical final system testsuites
    761761            #  - All final system testsuites
    762762            #  - Both temporary tools and final system testsuites
     
    764764            #  HLFS and CLFS have no testsuites available in the
    765765            #  temporary tools phase
    766 
    767766            #  You will be prompted also about the "flavour" of the
    768767            #  testsuites run:
     
    772771            #
    773772
     773    menu "Test settings"
     774    depends    CONFIG_TESTS
    774775    choice
    775776        prompt    "Tests level"
    776         depends     CONFIG_TESTS
    777777        default    TST_1
    778778
    779779        config  TST_1
    780             bool    "Only final critical testsuites" if !BOOK_CLFS2 && !BOOK_CLFS3
     780            bool    "Only final system critical testsuites"
     781            help
     782                #-- Critical tests:
     783                # Only Glibc, Binutils, GMP, MPFR, MPC and GCC
     784                # testsuites for final system
    781785
    782786        config    TST_2
     
    784788
    785789        config    TST_3
    786             bool    "Both temporary tools and final system testsuites" if !BOOK_HLFS && !BOOK_CLFS
     790            bool    "All testsuites" if !BOOK_HLFS && !BOOK_CLFS
     791            help
     792                #-- All tests:
     793                # Runs all the testsuites for both temporary tools
     794                # and final system
     795    endchoice
     796
     797    choice
     798        prompt    "Flavour"
     799
     800        config    NO_BOMB
     801            bool    "Don't stop on test failures"
     802
     803        config    BOMB
     804            bool    "Abort the build on the first test failure"
    787805    endchoice
    788806
     
    794812        default    "3"    if TST_3
    795813
    796     choice
    797         prompt    "Flavour"
    798         depends    CONFIG_TESTS
    799 
    800         config    NO_BOMB
    801             bool    "Don't stop on testsuite failures"
    802 
    803         config    BOMB
    804             bool    "Abort the build on the first testsuite failure"
    805     endchoice
    806 
    807814    config    BOMB_TEST
    808815        bool
     
    811818
    812819    #--- End Test Suites
     820    endmenu # test settings
    813821
    814822    #--- Package Management
     
    820828            #-- Use package management
    821829            #
    822             #  If set, the packages in the final phase are built
    823             #  in a separate directory, PKG_DEST.
    824             #  You should provide a bash function for packing
    825             #  and installing the package.
     830            #  If set, you'll have to choose between
     831            #  two package management styles:
     832            #  - Build and install:
     833            #    the packages in the final phase are built
     834            #    in a separate directory, PKG_DEST.
     835            #    You should provide a bash function for
     836            #    packaing and installing the package.
     837            #  - Preload a library before install:
     838            #    Run the install instructions inside a
     839            #    wrapper command, which monitors the
     840            #    installed files.
     841            #
    826842            #  Also, you have to provide the instructions
    827843            #  to build the package manager during the
     
    831847            #
    832848            #  For now, this only works with LFS
    833 
     849    choice
     850        depends PKGMNGT
     851        prompt "Package management style"
     852        default PKG_PACK
     853
     854        config PKG_PACK
     855            bool "Build and pack (pacman or dpkg style)"
     856
     857        config LIB_LOAD
     858            bool "Preload a library before installing (porg style)"
     859    endchoice
     860
     861    config WRAP_INSTALL
     862        bool
     863        default y if LIB_LOAD
     864        default n if PKG_PACK
    834865    #--- End package management
    835866
     
    844875    #--- End Installed files logs
    845876
     877    config    STRIP
     878        bool "Strip Installed Binaries/Libraries"
     879        default n
     880        depends on !BOOK_CLFS3
     881
     882    config    NO_PROGRESS_BAR
     883        bool "DO NOT use/display progress_bar "
     884        default n
     885        help
     886            #-- Do not use the progress bar routine. On slower machines
     887            #   this function consumes precious CPU cycles.
     888
     889#--- End Build Settings
     890endmenu
     891
     892menu "System configuration
     893    depends !BOOK_BLFS
     894
    846895    #--- FSTAB
    847896    config    HAVE_FSTAB
     
    850899        help
    851900            #-- Select this if you have an fstab file with entries
    852                         #   for the target system
     901            #   for the target system
    853902
    854903    config    FSTAB
     
    881930    #--- End Kernel
    882931
    883     config    STRIP
    884         bool "Strip Installed Binaries/Libraries"
    885         default n
    886         depends on !BOOK_CLFS3
    887 
    888932    config    VIMLANG
    889933        bool "Install vim-lang package"
     
    894938            #   NOTE: This option is obsolete with the 7.3 release of Vim
    895939            #   which is included in all recent releases of LFS.
    896 
    897     config    NO_PROGRESS_BAR
    898         bool "DO NOT use/display progress_bar "
    899         default n
    900         help
    901             #-- Do not use the progress bar routine. On slower machines
    902             #   this function consumes precious CPU cycles.
    903940
    904941    config    TIMEZONE
     
    947984    #--- End Groff page
    948985
    949 #--- End Build Settings
    950 endmenu
     986    config    HOSTNAME
     987        string "Hostname"
     988        default "**EDITME**"
     989
     990       menu "Network configuration"
     991        config INTERFACE
     992            string "netword card name"
     993            default "eth0"
     994        config IP_ADDR
     995            string "Static IP address"
     996            default "10.0.2.9"
     997        config GATEWAY
     998            string "Gateway"
     999            default "10.0.2.2"
     1000        config PREFIX
     1001            string "Subnet prefix"
     1002            default "24"
     1003        config BROADCAST
     1004            string "Broadcast address"
     1005            default "10.0.2.255"
     1006        config DOMAIN
     1007            string "Domain name"
     1008            default "lfs.org"
     1009        config DNS1
     1010            string "Primary Name server"
     1011            default "10.0.2.3"
     1012        config DNS2
     1013            string "Secondary Name server"
     1014            default "8.8.8.8"
     1015    endmenu # Network configuration
     1016
     1017    menu "Console configuration"
     1018        config FONT
     1019            string "Console font"
     1020            default "lat0-16"
     1021        config FONTMAP
     1022            string "Font map (-m option to setfont)"
     1023            default "8859-1"
     1024        config UNICODE
     1025            bool "Unicode mode"
     1026            default y
     1027        config KEYMAP
     1028            string "Keymap name"
     1029            default "us"
     1030    endmenu # Console configuration
     1031
     1032endmenu        #--- System configuration
    9511033
    9521034menu "Advanced Features"
  • LFS/lfs.xsl

    r909ee37 r945ccaa  
    99      version="1.0">
    1010
     11<!-- Parameters -->
     12
    1113  <!-- which revision attribute to include: can only be sysv or systemd,
    1214       but we leave checking to the caller-->
     
    1719       y = yes, add PKG_DEST to scripts in install commands of chapter06-08
    1820  -->
    19   <xsl:param name="pkgmngt" select="n"/>
     21  <xsl:param name="pkgmngt" select="'n'"/>
     22
     23  <!-- Package management with "porg style" ?
     24       n = no,  same as pkgmngt description above
     25       y = yes, wrap install commands of chapter06-08 into a bash function.
     26                note that pkgmngt must be 'y' in this case
     27  -->
     28  <xsl:param name="wrap-install" select='"n"'/>
    2029 
    2130  <!-- Run test suites?
    2231       0 = none
    23        1 = only chapter06 Glibc, GCC and Binutils testsuites
     32       1 = only chapter06 critical testsuites
    2433       2 = all chapter06 testsuites
    2534       3 = all chapter05 and chapter06 testsuites
     
    3140       y = yes, bomb at the first test suite failure to can review the build dir
    3241  -->
    33   <xsl:param name="bomb-testsuite" select="n"/>
     42  <xsl:param name="bomb-testsuite" select="'n'"/>
    3443
    3544  <!-- Install vim-lang package? OBSOLETE should always be 'n'-->
    36   <xsl:param name="vim-lang" select="n"/>
     45  <xsl:param name="vim-lang" select="'n'"/>
    3746 
    3847  <!-- Time zone -->
    39   <xsl:param name="timezone" select="GMT"/>
     48  <xsl:param name="timezone" select="'GMT'"/>
    4049 
    4150  <!-- Page size -->
    42   <xsl:param name="page" select="letter"/>
     51  <xsl:param name="page" select="'letter'"/>
    4352 
    4453  <!-- Locale settings -->
    45   <xsl:param name="lang" select="C"/>
     54  <xsl:param name="lang" select="'C'"/>
    4655
    4756  <!-- Install the whole set of locales -->
    48   <xsl:param name='full-locale' select='n'/>
     57  <xsl:param name='full-locale' select='"n"'/>
    4958 
     59  <!-- Hostname -->
     60  <xsl:param name='hostname' select='"HOSTNAME"'/>
     61
     62  <!-- Network parameters: interface, ip, gateway, prefix, broadcast, domain
     63       and nameservers -->
     64  <xsl:param name='interface'   select="'eth0'"/>
     65  <xsl:param name='ip'          select='"10.0.2.9"'/>
     66  <xsl:param name='gateway'     select='"10.0.2.2"'/>
     67  <xsl:param name='prefix'      select='24'/>
     68  <xsl:param name='broadcast'   select='"10.0.2.255"'/>
     69  <xsl:param name='domain'      select='"lfs.org"'/>
     70  <xsl:param name='nameserver1' select='"10.0.2.3"'/>
     71  <xsl:param name='nameserver2' select='"8.8.8.8"'/>
     72
     73<!-- End parameters -->
     74
    5075  <xsl:template match="/">
    5176    <xsl:apply-templates select="//sect1[not(@revision) or
     
    177202                                  @role != 'nodump']/userinput[
    178203                                                    @remap='install']">
    179       <xsl:text>mkdir -pv $PKG_DEST/{boot,etc,lib,bin,sbin}
     204      <xsl:choose>
     205        <xsl:when test="$wrap-install='y'">
     206          <xsl:text>wrapInstall '
     207</xsl:text>
     208        </xsl:when>
     209        <xsl:otherwise>
     210          <xsl:text>mkdir -pv $PKG_DEST/{boot,etc,lib,bin,sbin}
    180211mkdir -pv $PKG_DEST/usr/{lib,bin,sbin,include}
    181212mkdir -pv $PKG_DEST/usr/share/{doc,info,man}
     
    186217esac
    187218</xsl:text>
     219        </xsl:otherwise>
     220      </xsl:choose>
    188221    </xsl:if>
    189222    <xsl:if test="../@id = 'ch-system-glibc' and
    190223                  @role='installation' and
    191                   $pkgmngt = 'y'">
     224                  $pkgmngt = 'y' and
     225                  $wrap-install = 'n'">
    192226      <xsl:text>mkdir -pv $PKG_DEST/usr/include/{rpc,rpcsvc}
    193227</xsl:text>
     
    203237                                     @role != 'nodump']/userinput[
    204238                                                       @remap='install']">
    205       <xsl:if test="../@id = 'ch-system-man-pages'">
     239      <xsl:choose>
     240        <xsl:when test="$wrap-install='y'">
     241          <xsl:if test="../@id = 'ch-system-man-pages'">
    206242<!-- these files are provided by the shadow package -->
    207   <xsl:text>rm -fv $PKG_DEST/usr/share/man/{man3/getspnam.3,man5/passwd.5}
    208 </xsl:text>
    209       </xsl:if>
     243            <xsl:text>rm -fv /usr/share/man/{man3/getspnam.3,man5/passwd.5}
     244</xsl:text>
     245          </xsl:if>
    210246<!-- Attr man/man2 pages are already installed by man-pages. As of
    211247     March 2013, they are the same pages.
    212248     November 2015: now they are more accurate
    213249     in man-pages, and the man5 section is also in man-pages... -->
    214       <xsl:if test="../@id = 'ch-system-attr'">
    215         <xsl:text>rm -fv $PKG_DEST/usr/share/man/man2/*
     250          <xsl:if test="../@id = 'ch-system-attr'">
     251            <xsl:text>rm -fv /usr/share/man/man2/*
     252rm -fv /usr/share/man/man5/*
     253</xsl:text>
     254          </xsl:if>
     255<!-- nologin is installed by util-linux. remove it from shadow -->
     256          <xsl:if test="../@id = 'ch-system-shadow'">
     257            <xsl:text>rm -fv /usr/share/man/man8/nologin.8
     258rm -fv /sbin/nologin
     259</xsl:text>
     260          </xsl:if>
     261          <xsl:text>'
     262packInstall
     263</xsl:text>
     264        </xsl:when>
     265        <xsl:otherwise>
     266          <xsl:if test="../@id = 'ch-system-man-pages'">
     267<!-- these files are provided by the shadow package -->
     268            <xsl:text>rm -fv $PKG_DEST/usr/share/man/{man3/getspnam.3,man5/passwd.5}
     269</xsl:text>
     270          </xsl:if>
     271<!-- Attr man/man2 pages are already installed by man-pages. As of
     272     March 2013, they are the same pages.
     273     November 2015: now they are more accurate
     274     in man-pages, and the man5 section is also in man-pages... -->
     275          <xsl:if test="../@id = 'ch-system-attr'">
     276            <xsl:text>rm -fv $PKG_DEST/usr/share/man/man2/*
    216277rm -fv $PKG_DEST/usr/share/man/man5/*
    217278</xsl:text>
    218       </xsl:if>
     279          </xsl:if>
    219280<!-- nologin is installed by util-linux. remove it from shadow -->
    220       <xsl:if test="../@id = 'ch-system-shadow'">
    221         <xsl:text>rm -fv $PKG_DEST/usr/share/man/man8/nologin.8
     281          <xsl:if test="../@id = 'ch-system-shadow'">
     282            <xsl:text>rm -fv $PKG_DEST/usr/share/man/man8/nologin.8
    222283rm -fv $PKG_DEST/sbin/nologin
    223284</xsl:text>
    224       </xsl:if>
    225       <xsl:text>rm -fv $PKG_DEST/{,usr/}lib64
     285          </xsl:if>
     286          <xsl:text>rm -fv $PKG_DEST/{,usr/}lib64
    226287rm -fv $PKG_DEST/usr/{man,doc,info}
    227288for dir in $PKG_DEST/usr/share/man/man{1..8}; do
     
    240301rm -rf $PKG_DEST
    241302</xsl:text>
     303        </xsl:otherwise>
     304      </xsl:choose>
    242305    </xsl:if>
    243306    <xsl:if test="$testsuite='3' and
     
    310373        <xsl:if test="$dirname = 'chapter06'">
    311374          <xsl:text>packInstall
    312 rm -rf $PKG_DEST
     375rm -rf "$PKG_DEST"
    313376</xsl:text>
    314377        </xsl:if>
     
    453516            </xsl:choose>
    454517          </xsl:when>
    455           <xsl:otherwise><!--pkgmngt = 'y'-->
     518          <xsl:when test="$wrap-install='y'">
     519            <xsl:choose>
     520              <xsl:when test="./literal">
     521                <xsl:call-template name="output-wrap">
     522                  <xsl:with-param name="commands" select="text()[1]"/>
     523                </xsl:call-template>
     524                <xsl:apply-templates select="literal"/>
     525                <xsl:call-template name="output-wrap">
     526                  <xsl:with-param name="commands" select="text()[2]"/>
     527                </xsl:call-template>
     528              </xsl:when>
     529              <xsl:otherwise>
     530                <xsl:call-template name="output-wrap">
     531                  <xsl:with-param name="commands" select="string()"/>
     532                </xsl:call-template>
     533              </xsl:otherwise>
     534            </xsl:choose>
     535            <xsl:text>&#xA;</xsl:text>
     536          </xsl:when>
     537          <xsl:otherwise><!--pkgmngt = 'y' and wrap-install='n'-->
    456538            <xsl:choose>
    457539              <xsl:when test="./literal">
     
    477559      <xsl:when test="contains(string(),'tzdata') and $pkgmngt='y'">
    478560        <xsl:text>
    479 OLD_PKG_DEST=$PKG_DEST
     561OLD_PKG_DEST="$PKG_DEST"
    480562OLD_PKGDIR=$PKGDIR
    481563PKG_DEST=$(dirname $OLD_PKG_DEST)/001-tzdata
     
    486568        <xsl:text>
    487569</xsl:text>
    488         <xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
    489         <xsl:text>ZONEINFO=$PKG_DEST</xsl:text>
    490         <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
    491         <xsl:text>
     570        <xsl:choose>
     571          <xsl:when test="$wrap-install='n'">
     572            <xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
     573            <xsl:text>ZONEINFO=$PKG_DEST</xsl:text>
     574            <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
     575            <xsl:text>
    492576packInstall
    493577rm -rf $PKG_DEST
     578</xsl:text>
     579          </xsl:when>
     580          <xsl:otherwise><!-- wrap-install='y' -->
     581            <xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
     582            <xsl:text>
     583wrapInstall '
     584ZONEINFO=</xsl:text>
     585            <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
     586            <xsl:text>'
     587packInstall
     588</xsl:text>
     589          </xsl:otherwise>
     590        </xsl:choose>
     591        <xsl:text>
    494592PKG_DEST=$OLD_PKG_DEST
    495593unset OLD_PKG_DEST
     
    518616        <xsl:value-of select="$lang"/>
    519617      </xsl:when>
     618      <xsl:when test="contains(string(.),'Domain')">
     619        <xsl:value-of select="$domain"/>
     620      </xsl:when>
     621      <xsl:when test="contains(string(.),'primary')">
     622        <xsl:value-of select="$nameserver1"/>
     623      </xsl:when>
     624      <xsl:when test="contains(string(.),'secondary')">
     625        <xsl:value-of select="$nameserver2"/>
     626      </xsl:when>
     627      <xsl:when test="contains(string(.),'192.168.1.1')">
     628        <xsl:value-of select="$ip"/>
     629      </xsl:when>
     630      <xsl:when test="contains(string(.),'192.168.0.2')">
     631        <xsl:value-of select="$ip"/>
     632      </xsl:when>
     633<!-- Only adapted to LFS-20170310 and later -->
     634      <xsl:when test="contains(string(.),'HOSTNAME')">
     635        <xsl:value-of select="$hostname"/>
     636      </xsl:when>
     637      <xsl:when test="contains(string(.),'FQDN')">
     638        <xsl:value-of select="$hostname"/>
     639        <xsl:text>.</xsl:text>
     640        <xsl:value-of select="$domain"/>
     641      </xsl:when>
     642      <xsl:when test="contains(string(.),'alias')"/>
     643      <xsl:when test="contains(string(.),'&lt;lfs&gt;')">
     644        <xsl:value-of select="$hostname"/>
     645      </xsl:when>
    520646      <xsl:otherwise>
    521647        <xsl:text>**EDITME</xsl:text>
     
    526652  </xsl:template>
    527653 
     654  <xsl:template match="literal">
     655    <xsl:choose>
     656      <xsl:when test="contains(string(),'ONBOOT')">
     657        <xsl:call-template name="outputnet">
     658          <xsl:with-param name="netstring" select="string()"/>
     659        </xsl:call-template>
     660      </xsl:when>
     661      <xsl:when test="contains(string(),'[Match]')">
     662        <xsl:call-template name="outputsysdnet">
     663          <xsl:with-param name="netstring" select="string()"/>
     664        </xsl:call-template>
     665      </xsl:when>
     666      <xsl:otherwise>
     667        <xsl:apply-templates/>
     668      </xsl:otherwise>
     669    </xsl:choose>
     670  </xsl:template>
     671
     672  <xsl:template name="outputnet">
     673    <xsl:param name="netstring" select="''"/>
     674    <!-- We suppose that book example has the following values:
     675         - interface: eth0
     676         - ip: 192.168.1.2
     677         - gateway: 192.168.1.1
     678         - prefix: 24
     679         - broadcast: 192.168.1.255
     680         Change below if book changes -->
     681    <xsl:choose>
     682      <xsl:when test="contains($netstring,'eth0')">
     683        <xsl:call-template name="outputnet">
     684          <xsl:with-param name="netstring"
     685                          select="substring-before($netstring,'eth0')"/>
     686        </xsl:call-template>
     687        <xsl:value-of select="$interface"/>
     688        <xsl:call-template name="outputnet">
     689          <xsl:with-param name="netstring"
     690                          select="substring-after($netstring,'eth0')"/>
     691        </xsl:call-template>
     692      </xsl:when>
     693      <xsl:when test="contains($netstring,'192.168.1.1')">
     694        <xsl:call-template name="outputnet">
     695          <xsl:with-param name="netstring"
     696                          select="substring-before($netstring,'192.168.1.1')"/>
     697        </xsl:call-template>
     698        <xsl:value-of select="$gateway"/>
     699        <xsl:call-template name="outputnet">
     700          <xsl:with-param name="netstring"
     701                          select="substring-after($netstring,'192.168.1.1')"/>
     702        </xsl:call-template>
     703      </xsl:when>
     704      <!-- must test this before the following, because 192.168.1.255 contains
     705           192.168.1.2! -->
     706      <xsl:when test="contains($netstring,'192.168.1.255')">
     707        <xsl:call-template name="outputnet">
     708          <xsl:with-param name="netstring"
     709                          select="substring-before($netstring,'192.168.1.255')"/>
     710        </xsl:call-template>
     711        <xsl:value-of select="$broadcast"/>
     712        <xsl:call-template name="outputnet">
     713          <xsl:with-param name="netstring"
     714                          select="substring-after($netstring,'192.168.1.255')"/>
     715        </xsl:call-template>
     716      </xsl:when>
     717      <xsl:when test="contains($netstring,'192.168.1.2')">
     718        <xsl:call-template name="outputnet">
     719          <xsl:with-param name="netstring"
     720                          select="substring-before($netstring,'192.168.1.2')"/>
     721        </xsl:call-template>
     722        <xsl:value-of select="$ip"/>
     723        <xsl:call-template name="outputnet">
     724          <xsl:with-param name="netstring"
     725                          select="substring-after($netstring,'192.168.1.2')"/>
     726        </xsl:call-template>
     727      </xsl:when>
     728      <xsl:when test="contains($netstring,'24')">
     729        <xsl:call-template name="outputnet">
     730          <xsl:with-param name="netstring"
     731                          select="substring-before($netstring,'24')"/>
     732        </xsl:call-template>
     733        <xsl:value-of select="$prefix"/>
     734        <xsl:call-template name="outputnet">
     735          <xsl:with-param name="netstring"
     736                          select="substring-after($netstring,'24')"/>
     737        </xsl:call-template>
     738      </xsl:when>
     739      <xsl:otherwise>
     740        <xsl:value-of select="$netstring"/>
     741      </xsl:otherwise>
     742    </xsl:choose>
     743  </xsl:template>
     744
     745  <xsl:template name="outputsysdnet">
     746    <xsl:param name="netstring" select="''"/>
     747    <!-- We suppose that book example has the following values:
     748         - interface: eth0
     749         - ip: 192.168.0.2
     750         - gateway: 192.168.0.1
     751         - prefix: 24
     752         - DNS: 192.168.0.1
     753         - Domain: <Your Domain Name>
     754         and gateway comes before DNS. Change below if book changes -->
     755    <xsl:choose>
     756      <xsl:when test="contains($netstring,'eth0')">
     757        <xsl:call-template name="outputsysdnet">
     758          <xsl:with-param name="netstring"
     759                          select="substring-before($netstring,'eth0')"/>
     760        </xsl:call-template>
     761        <xsl:value-of select="$interface"/>
     762        <xsl:call-template name="outputsysdnet">
     763          <xsl:with-param name="netstring"
     764                          select="substring-after($netstring,'eth0')"/>
     765        </xsl:call-template>
     766      </xsl:when>
     767      <xsl:when test="contains($netstring,'192.168.0.1') and
     768                      contains($netstring,'Gateway')">
     769        <xsl:call-template name="outputsysdnet">
     770          <xsl:with-param name="netstring"
     771                          select="substring-before($netstring,'192.168.0.1')"/>
     772        </xsl:call-template>
     773        <xsl:value-of select="$gateway"/>
     774        <xsl:call-template name="outputsysdnet">
     775          <xsl:with-param name="netstring"
     776                          select="substring-after($netstring,'192.168.0.1')"/>
     777        </xsl:call-template>
     778      </xsl:when>
     779      <xsl:when test="contains($netstring,'192.168.0.1') and
     780                      not(contains($netstring,'Gateway'))">
     781        <xsl:call-template name="outputsysdnet">
     782          <xsl:with-param name="netstring"
     783                          select="substring-before($netstring,'192.168.0.1')"/>
     784        </xsl:call-template>
     785        <xsl:value-of select="$nameserver1"/>
     786        <xsl:text>
     787DNS=</xsl:text>
     788        <xsl:value-of select="$nameserver2"/>
     789        <xsl:call-template name="outputsysdnet">
     790          <xsl:with-param name="netstring"
     791                          select="substring-after($netstring,'192.168.0.1')"/>
     792        </xsl:call-template>
     793      </xsl:when>
     794      <xsl:when test="contains($netstring,'192.168.0.2')">
     795        <xsl:call-template name="outputsysdnet">
     796          <xsl:with-param name="netstring"
     797                          select="substring-before($netstring,'192.168.0.2')"/>
     798        </xsl:call-template>
     799        <xsl:value-of select="$ip"/>
     800        <xsl:call-template name="outputsysdnet">
     801          <xsl:with-param name="netstring"
     802                          select="substring-after($netstring,'192.168.0.2')"/>
     803        </xsl:call-template>
     804      </xsl:when>
     805      <xsl:when test="contains($netstring,'24')">
     806        <xsl:call-template name="outputsysdnet">
     807          <xsl:with-param name="netstring"
     808                          select="substring-before($netstring,'24')"/>
     809        </xsl:call-template>
     810        <xsl:value-of select="$prefix"/>
     811        <xsl:call-template name="outputsysdnet">
     812          <xsl:with-param name="netstring"
     813                          select="substring-after($netstring,'24')"/>
     814        </xsl:call-template>
     815      </xsl:when>
     816      <xsl:when test="contains($netstring,'&lt;Your Domain Name&gt;')">
     817        <xsl:call-template name="outputsysdnet">
     818          <xsl:with-param name="netstring"
     819                          select="substring-before($netstring,'&lt;Your Domain Name&gt;')"/>
     820        </xsl:call-template>
     821        <xsl:value-of select="$domain"/>
     822        <xsl:call-template name="outputsysdnet">
     823          <xsl:with-param name="netstring"
     824                          select="substring-after($netstring,'&lt;Your Domain Name&gt;')"/>
     825        </xsl:call-template>
     826      </xsl:when>
     827      <xsl:otherwise>
     828        <xsl:value-of select="$netstring"/>
     829      </xsl:otherwise>
     830    </xsl:choose>
     831  </xsl:template>
     832
    528833  <xsl:template name="outputpkgdest">
    529834    <xsl:param name="outputstring" select="foo"/>
     
    624929    </xsl:choose>
    625930  </xsl:template>
     931
     932  <xsl:variable name="APOS">'</xsl:variable>
     933  <xsl:template name="output-wrap">
     934    <xsl:param name="commands" select="''"/>
     935    <xsl:choose>
     936      <xsl:when test="contains($commands,string($APOS))">
     937        <xsl:call-template name="output-wrap">
     938          <xsl:with-param name="commands"
     939                          select="substring-before($commands,string($APOS))"/>
     940        </xsl:call-template>
     941        <xsl:text>'\''</xsl:text>
     942        <xsl:call-template name="output-wrap">
     943          <xsl:with-param name="commands"
     944                          select="substring-after($commands,string($APOS))"/>
     945        </xsl:call-template>
     946      </xsl:when>
     947      <xsl:otherwise>
     948        <xsl:value-of select="$commands"/>
     949      </xsl:otherwise>
     950    </xsl:choose>
     951  </xsl:template>
     952
    626953</xsl:stylesheet>
  • README.PACKAGE_MANAGEMENT

    r909ee37 r945ccaa  
    77      There are several hints discussing package management for LFS, but
    88  nothing under jhalfs. There used to be a patch for PACO that I cannot
    9   find now. This is a modification ("DESTDIR install" automation), which
    10   allows to use a package manager inside jhalfs. I hope it is flexible enough
    11   to support several package managers, at least among those who use DESTDIR
    12   install. My initial implementation used dpkg, from Debian, in a very
    13   crude way (Debian has a sophisticated package management system, which
    14   I have not tried to use here). There is also a port to Pacman from
    15   Arch Linux (http://www.archlinux.org). I am sorry to say I have (almost)
    16   no experience with rpm, so I cannot tell whether it would fit.
     9  find now. So there was a need for such a tool, and an infrastructure,
     10  which allows using a package manager inside jhalfs, has been developped.
     11  I hope it is flexible enough to support several package managers, at least
     12  among those who use DESTDIR install and/or LD_PRELOAD during install.
     13  It has been tested with dpkg from Debian, pacman from Arch Linux,
     14  and porg. Sample configuration files are given for those three packages.
     15  I am sorry to say I have (almost) no experience with rpm, so I cannot
     16  tell whether it would fit.
    1717
    18182. OVERVIEW OF THE SYSTEM:
    1919
    20       Presently, package management is only available for LFS. I plan to
    21   upgrade BLFS tools, but nothing usable right now. I have not attempted
    22   to adapt this tool for the other flavours of LFS.
     20      For now, package management is only available for LFS. The `porg style'
     21  (see below) package management has been ported to BLFS, but not the distro
     22  style one (the book layout makes it rather difficult). I have not attempted
     23  to adapt this tool for the other flavours of LFS (TODO).
    2324
    24       To use package management, you need to create the required files in
    25   the pkgmngt directory (see below), and to select "package management" in
    26   the build settings. Note that this is incompatible with creating an SBU
    27   and usage report.
     25      This tool comes in two flavours:
     26  - for distros package managers (e.g dpkg or pacman), it basically performs
     27    a "DESTDIR install" for all pages in chapter 6, 7 and 8 of the book. The
     28    name of the DESTDIR directory is the same as the one of the executed
     29    script. The path to this directory is available to the scriplets through
     30    the PKG_DEST variable. The details of the DESTDIR part are given below.
     31    After the package is installed in $PKG_DEST, a function "packInstall" is
     32    called, which is supposed to create a binary package (e.g. make a .deb
     33    file), store it to a repository and install it to the system.
     34  - for porg style package manager, the install instructions are wrapped
     35    between pairs of single quotes ('). This allows passing those instructions
     36    to a function ("wrapInstall"), which may itself call porg or another
     37    (e.g. fakeroot, not tested) instruction wrapper. Note that if the
     38    instructions contain single quote charaters, they are changed to '\'',
     39    which pass them literally. At the end of the installation, a function
     40    "packInstall" is called, with a slighly different aim compared to the
     41    DESTDIR one: it is used to make a tarball of the installed files (e.g.
     42    using "porgball") and store them into some repository. But there is no
     43    need to install them to the system, since this has already been done.
    2844
    29 3. DETAILS OF OPERATION:
     45      Note that with carefully crafted "packInstall" and "wrapInstall"
     46  functions, a combination of the two methods could be used, for example for
     47  DESTDIR installs using fakeroot. This is work in progress and not fully
     48  implemented yet.
    3049
    31       This system performs basically a "DESTDIR install" for all pages
    32   in chapter 6, 7 and 8 of the book. The name of the DESTDIR directory is the
    33   same as the one of the executed script. The path to this directory is
    34   made available to the scriplets through the PKG_DEST variable.
     503. DETAILS:
     51
    3552      The XSL stylesheet used for generating the scriptlets, automatically
    3653  adds DESTDIR install instructions when "package management" is selected.
     
    4461  directory. Empty directories are then removed before packing the
    4562  binary package.
     63
    4664      In order to use the package manager, it has to be installed at the end of
    4765  chapter 5 (temporary installation in /tools) and chapter 6 (final install).
     
    5270  This file should reside in the `pkgmngt' directory and be named
    5371  `packageManager.xml'. A template named `packageManager.xml.template' is
    54   provided in the `pkgmngt' subdirectory. There are also two XML files for
    55   dpkg and pacman, respectively `packageManager.xml.dpkg' and
    56   `packageManager.xml.pacman', that you can copy to `packageManager.xml'.
     72  provided in the `pkgmngt' subdirectory. There are also three XML files for
     73  dpkg, pacman, and porg, respectively `packageManager.xml.dpkg',
     74  `packageManager.xml.pacman',  and `packageManager.xml.porg', that you can
     75  copy to `packageManager.xml' and modify to suit your needs.
    5776  They are not updated often, so the versions used can be rather old.
    58       The last thing to do is to tell how to use the package manager. When
    59   the binary package is ready, the scriptlets call a shell function named
    60   `packInstall', which should pack the binary package and install it on the
    61   system. Note that nothing has been done to manage configuration files,
     77
     78      The last thing to do is to tell how to use the package manager. The user
     79  has to provide two functions, "wrapInstall" and "packInstall", as described
     80  above. Please note that nothing has been done to manage configuration files,
    6281  which are ususally treated specially by package managers: depending on
    6382  the book layout, it is sometimes possible to create those files afterwards,
    6483  and sometimes not, which means that you have to check them after each
    65   upgrade. The user has to write his own `packInstall' function. The shell
    66   function should be defined in a file named `packInstall.sh', residing in
    67   the `pkgmngt' directory. A template is provided, as well as two example
    68   scripts for dpkg and pacman. Note that, due to the way pacman checks the
    69   available space on disk, the root directory in chroot must be a mount point,
    70   otherwise the installation of packages fails.
     84  upgrade. Both functions should be defined in a file named `packInstall.sh',
     85  residing in the `pkgmngt' directory. A template is provided (actually a copy
     86  of the file for dpkg), as well as three example scripts for dpkg, pacman,
     87  and porg. Pacman Note: due to the way pacman checks the available space on
     88  disk, the root directory in chroot must be a mount point, otherwise the
     89  installation of packages fails.
  • common/libs/func_book_parser

    r909ee37 r945ccaa  
    165165        popd > /dev/null
    166166
    167         xsltproc --nonet                                   \
    168                  --xinclude                                \
    169                  --stringparam revision       $INITSYS     \
    170                  --stringparam testsuite      $TEST        \
    171                  --stringparam bomb-testsuite $BOMB_TEST   \
    172                  --stringparam vim-lang       $VIMLANG     \
    173                  --stringparam full-locale    $FULL_LOCALE \
    174                  --stringparam timezone       $TIMEZONE    \
    175                  --stringparam page           $PAGE        \
    176                  --stringparam lang           $LANG        \
    177                  --stringparam pkgmngt        $PKGMNGT     \
    178                  --output ./${PROGNAME}-commands/          \
    179                  $XSL                                      \
     167        xsltproc --nonet                                    \
     168                 --xinclude                                 \
     169                 --stringparam revision       $INITSYS      \
     170                 --stringparam testsuite      $TEST         \
     171                 --stringparam bomb-testsuite $BOMB_TEST    \
     172                 --stringparam vim-lang       $VIMLANG      \
     173                 --stringparam full-locale    $FULL_LOCALE  \
     174                 --stringparam timezone       $TIMEZONE     \
     175                 --stringparam page           $PAGE         \
     176                 --stringparam lang           $LANG         \
     177                 --stringparam pkgmngt        $PKGMNGT      \
     178                 --stringparam wrap-install   $WRAP_INSTALL \
     179                 --stringparam hostname       $HOSTNAME     \
     180                 --stringparam interface      $INTERFACE    \
     181                 --stringparam ip             $IP_ADDR      \
     182                 --stringparam gateway        $GATEWAY      \
     183                 --stringparam prefix         $PREFIX       \
     184                 --stringparam broadcast      $BROADCAST    \
     185                 --stringparam domain         $DOMAIN       \
     186                 --stringparam nameserver1    $DNS1         \
     187                 --stringparam nameserver2    $DNS2         \
     188                 --output ./${PROGNAME}-commands/           \
     189                 $XSL                                       \
    180190                 $BOOK/index.xml >> $LOGDIR/$LOG 2>&1
    181191      ;;
  • common/libs/func_install_blfs

    r909ee37 r945ccaa  
    1313cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
    1414cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
     15if [ "$WRAP_INSTALL" = y ]; then
     16  sed -e 's/PKGDIR/UNPACKDIR/' \
     17      -e 's/PKG_DEST/PKG_DIR/' \
     18      $PKGMNGTDIR/packInstall.sh > ${BUILDDIR}${BLFS_ROOT}/packInstall.sh
     19fi
    1520
    1621# Clean-up
     
    116121optDependency=2
    117122SUDO=n
     123WRAP_INSTALL=$WRAP_INSTALL
    118124EOF
    119125
  • common/libs/func_validate_configs.sh

    r909ee37 r945ccaa  
    4242
    4343  # Build Settings by book
    44   local -r   LFS_build="$BUILD_chroot VIMLANG $BUILD_common PKGMNGT FULL_LOCALE"
     44  local -r   LFS_build="$BUILD_chroot VIMLANG $BUILD_common PKGMNGT FULL_LOCALE WRAP_INSTALL"
    4545  local -r  HLFS_build="$BUILD_chroot         $BUILD_common"
    4646  local -r  CLFS_build="$BUILD_chroot VIMLANG $BUILD_common"
     
    4848  local -r CLFS3_build="                      $BUILD_common"
    4949
     50  # System Settings by book (only LFS for now)
     51  local -r LFS_system="HOSTNAME INTERFACE IP_ADDR GATEWAY PREFIX BROADCAST DOMAIN DNS1 DNS2 FONT CONSOLE_MAP UNICODE KEYMAP"
     52
    5053  # Full list of books settings
    51   local -r   lfs_PARAM_LIST="$LFS_book   $GENERAL_common $LFS_build   $ADVANCED_chroot $ADVANCED_common"
     54  local -r   lfs_PARAM_LIST="$LFS_book   $GENERAL_common $LFS_build $LFS_system  $ADVANCED_chroot $ADVANCED_common"
    5255  local -r  hlfs_PARAM_LIST="$HLFS_book  $GENERAL_common $HLFS_build  $ADVANCED_chroot $ADVANCED_common"
    5356  local -r  clfs_PARAM_LIST="$CLFS_book  $GENERAL_common $CLFS_build  $ADVANCED_chroot $ADVANCED_common"
     
    194197               ;;
    195198
     199        # Treatment of HOSTNAME
     200      HOSTNAME)  echo -e "`eval echo $PARAM_VALS`"
     201                 [[ "${!config_param}" = "**EDIT ME**" ]] && write_error_and_die
     202                 ;;
     203
    196204        # Case of PKGMNGT: two files, packageManager.xml and packInstall.sh
    197205        # must exist in $PKGMNGTDIR if PKGMNGT='y':
  • common/makefile-functions

    r909ee37 r945ccaa  
    116116    echo "source packInstall.sh" >> envars; \
    117117    echo "export -f packInstall" >> envars; \
     118    echo "export -f wrapInstall" >> envars; \
    118119  fi;
    119120endef
  • jhalfs

    r909ee37 r945ccaa  
    125125RUN_ICA=${RUN_ICA:-n}
    126126PKGMNGT=${PKGMNGT:-n}
     127WRAP_INSTALL=${WRAP_INSTALL:-n}
    127128BOMB_TEST=${BOMB_TEST:-n}
    128129STRIP=${STRIP:=n}
     
    142143SET_MISC=${SET_MISC:=n}
    143144SET_BLOWFISH=${SET_BLOWFISH:=n}
     145UNICODE=${UNICODE:=n}
    144146
    145147if [[ "${NO_PROGRESS_BAR}" = "y" ]] ; then
Note: See TracChangeset for help on using the changeset viewer.