Changeset 945ccaa for LFS/lfs.xsl
- Timestamp:
- 04/09/2017 10:29:32 AM (7 years ago)
- Branches:
- ablfs-more, legacy, trunk
- Children:
- cee84ad
- Parents:
- 909ee37
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LFS/lfs.xsl
r909ee37 r945ccaa 9 9 version="1.0"> 10 10 11 <!-- Parameters --> 12 11 13 <!-- which revision attribute to include: can only be sysv or systemd, 12 14 but we leave checking to the caller--> … … 17 19 y = yes, add PKG_DEST to scripts in install commands of chapter06-08 18 20 --> 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"'/> 20 29 21 30 <!-- Run test suites? 22 31 0 = none 23 1 = only chapter06 Glibc, GCC and Binutilstestsuites32 1 = only chapter06 critical testsuites 24 33 2 = all chapter06 testsuites 25 34 3 = all chapter05 and chapter06 testsuites … … 31 40 y = yes, bomb at the first test suite failure to can review the build dir 32 41 --> 33 <xsl:param name="bomb-testsuite" select=" n"/>42 <xsl:param name="bomb-testsuite" select="'n'"/> 34 43 35 44 <!-- 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'"/> 37 46 38 47 <!-- Time zone --> 39 <xsl:param name="timezone" select=" GMT"/>48 <xsl:param name="timezone" select="'GMT'"/> 40 49 41 50 <!-- Page size --> 42 <xsl:param name="page" select=" letter"/>51 <xsl:param name="page" select="'letter'"/> 43 52 44 53 <!-- Locale settings --> 45 <xsl:param name="lang" select=" C"/>54 <xsl:param name="lang" select="'C'"/> 46 55 47 56 <!-- Install the whole set of locales --> 48 <xsl:param name='full-locale' select=' n'/>57 <xsl:param name='full-locale' select='"n"'/> 49 58 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 50 75 <xsl:template match="/"> 51 76 <xsl:apply-templates select="//sect1[not(@revision) or … … 177 202 @role != 'nodump']/userinput[ 178 203 @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} 180 211 mkdir -pv $PKG_DEST/usr/{lib,bin,sbin,include} 181 212 mkdir -pv $PKG_DEST/usr/share/{doc,info,man} … … 186 217 esac 187 218 </xsl:text> 219 </xsl:otherwise> 220 </xsl:choose> 188 221 </xsl:if> 189 222 <xsl:if test="../@id = 'ch-system-glibc' and 190 223 @role='installation' and 191 $pkgmngt = 'y'"> 224 $pkgmngt = 'y' and 225 $wrap-install = 'n'"> 192 226 <xsl:text>mkdir -pv $PKG_DEST/usr/include/{rpc,rpcsvc} 193 227 </xsl:text> … … 203 237 @role != 'nodump']/userinput[ 204 238 @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'"> 206 242 <!-- 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> 210 246 <!-- Attr man/man2 pages are already installed by man-pages. As of 211 247 March 2013, they are the same pages. 212 248 November 2015: now they are more accurate 213 249 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/* 252 rm -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 258 rm -fv /sbin/nologin 259 </xsl:text> 260 </xsl:if> 261 <xsl:text>' 262 packInstall 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/* 216 277 rm -fv $PKG_DEST/usr/share/man/man5/* 217 278 </xsl:text> 218 </xsl:if>279 </xsl:if> 219 280 <!-- 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.8281 <xsl:if test="../@id = 'ch-system-shadow'"> 282 <xsl:text>rm -fv $PKG_DEST/usr/share/man/man8/nologin.8 222 283 rm -fv $PKG_DEST/sbin/nologin 223 284 </xsl:text> 224 </xsl:if>225 <xsl:text>rm -fv $PKG_DEST/{,usr/}lib64285 </xsl:if> 286 <xsl:text>rm -fv $PKG_DEST/{,usr/}lib64 226 287 rm -fv $PKG_DEST/usr/{man,doc,info} 227 288 for dir in $PKG_DEST/usr/share/man/man{1..8}; do … … 240 301 rm -rf $PKG_DEST 241 302 </xsl:text> 303 </xsl:otherwise> 304 </xsl:choose> 242 305 </xsl:if> 243 306 <xsl:if test="$testsuite='3' and … … 310 373 <xsl:if test="$dirname = 'chapter06'"> 311 374 <xsl:text>packInstall 312 rm -rf $PKG_DEST375 rm -rf "$PKG_DEST" 313 376 </xsl:text> 314 377 </xsl:if> … … 453 516 </xsl:choose> 454 517 </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>
</xsl:text> 536 </xsl:when> 537 <xsl:otherwise><!--pkgmngt = 'y' and wrap-install='n'--> 456 538 <xsl:choose> 457 539 <xsl:when test="./literal"> … … 477 559 <xsl:when test="contains(string(),'tzdata') and $pkgmngt='y'"> 478 560 <xsl:text> 479 OLD_PKG_DEST= $PKG_DEST561 OLD_PKG_DEST="$PKG_DEST" 480 562 OLD_PKGDIR=$PKGDIR 481 563 PKG_DEST=$(dirname $OLD_PKG_DEST)/001-tzdata … … 486 568 <xsl:text> 487 569 </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> 492 576 packInstall 493 577 rm -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> 583 wrapInstall ' 584 ZONEINFO=</xsl:text> 585 <xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/> 586 <xsl:text>' 587 packInstall 588 </xsl:text> 589 </xsl:otherwise> 590 </xsl:choose> 591 <xsl:text> 494 592 PKG_DEST=$OLD_PKG_DEST 495 593 unset OLD_PKG_DEST … … 518 616 <xsl:value-of select="$lang"/> 519 617 </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(.),'<lfs>')"> 644 <xsl:value-of select="$hostname"/> 645 </xsl:when> 520 646 <xsl:otherwise> 521 647 <xsl:text>**EDITME</xsl:text> … … 526 652 </xsl:template> 527 653 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> 787 DNS=</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,'<Your Domain Name>')"> 817 <xsl:call-template name="outputsysdnet"> 818 <xsl:with-param name="netstring" 819 select="substring-before($netstring,'<Your Domain Name>')"/> 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,'<Your Domain Name>')"/> 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 528 833 <xsl:template name="outputpkgdest"> 529 834 <xsl:param name="outputstring" select="foo"/> … … 624 929 </xsl:choose> 625 930 </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 626 953 </xsl:stylesheet>
Note:
See TracChangeset
for help on using the changeset viewer.