diff --git a/Config.in b/Config.in index c77eff1..25e048b 100644 --- a/Config.in +++ b/Config.in @@ -827,27 +827,50 @@ menu "--- Build Settings" #--- End Test Suites endmenu # test settings - #--- Package Management - config PKGMNGT - bool "Package management" - depends BOOK_LFS || BOOK_LFS_SYSD - default n - 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. - # Also, you have to provide the instructions - # to build the package manager during the - # temporary tools phase, in the form of a - # sect1 of the book identical to a package - # sect1. See README.PACKAGE_MANAGEMENT - # - # For now, this only works with LFS + #--- Package Management + config PKGMNGT + bool "Package management" + depends BOOK_LFS || BOOK_LFS_SYSD + default n + help + #-- Use package management + # + # 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 + # sect1 of the book identical to a package + # sect1. See README.PACKAGE_MANAGEMENT + # + # For now, this only works with LFS + choice + depends PKGMNGT + prompt "Package management style" + default PKG_PACK - #--- End package management + 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 config INSTALL_LOG diff --git a/LFS/lfs.xsl b/LFS/lfs.xsl index c2e4e61..ae625ac 100644 --- a/LFS/lfs.xsl +++ b/LFS/lfs.xsl @@ -14,7 +14,14 @@ n = no, original behavior y = yes, add PKG_DEST to scripts in install commands of chapter06-08 --> - + + + + - + - + - + - + - + - + - + @@ -180,7 +187,13 @@ descendant::screen[not(@role) or @role != 'nodump']/userinput[ @remap='install']"> - mkdir -pv $PKG_DEST/{boot,etc,lib,bin,sbin} + + + wrapInstall ' + + + + 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} @@ -189,10 +202,13 @@ case $(uname -m) in x86_64) ln -sv lib $PKG_DEST/lib64 && ln -sv lib $PKG_DEST/usr/lib64 ;; esac + + + $pkgmngt = 'y' and + $wrap-install = 'n'"> mkdir -pv $PKG_DEST/usr/include/{rpc,rpcsvc} @@ -204,27 +220,54 @@ esac descendant::screen[not(@role) or @role != 'nodump']/userinput[ @remap='install']"> - + + + - rm -fv $PKG_DEST/usr/share/man/{man3/getspnam.3,man5/passwd.5} + rm -fv /usr/share/man/{man3/getspnam.3,man5/passwd.5} - + - - rm -fv $PKG_DEST/usr/share/man/man2/* + + rm -fv /usr/share/man/man2/* +rm -fv /usr/share/man/man5/* + + + + + rm -fv /usr/share/man/man8/nologin.8 +rm -fv /sbin/nologin + + + ' +packInstall + + + + + + rm -fv $PKG_DEST/usr/share/man/{man3/getspnam.3,man5/passwd.5} + + + + + rm -fv $PKG_DEST/usr/share/man/man2/* rm -fv $PKG_DEST/usr/share/man/man5/* - + - - rm -fv $PKG_DEST/usr/share/man/man8/nologin.8 + + rm -fv $PKG_DEST/usr/share/man/man8/nologin.8 rm -fv $PKG_DEST/sbin/nologin - - rm -fv $PKG_DEST/{,usr/}lib64 + + 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 @@ -241,6 +284,8 @@ done packInstall rm -rf $PKG_DEST + + packInstall -rm -rf $PKG_DEST +rm -rf "$PKG_DEST" - + + + + + + + + + + + + + + + + + + + + @@ -476,7 +540,7 @@ exit tzdata. --> -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- @@ -485,12 +549,28 @@ PKGDIR=$(dirname $PKGDIR)/tzdata- '.tar')"/> - - ZONEINFO=$PKG_DEST - - + + + + ZONEINFO=$PKG_DEST + + packInstall rm -rf $PKG_DEST + + + + + +wrapInstall ' +ZONEINFO= + + ' +packInstall + + + + PKG_DEST=$OLD_PKG_DEST unset OLD_PKG_DEST PKGDIR=$OLD_PKGDIR @@ -732,4 +812,26 @@ unset OLD_PKGDIR + + ' + + + + + + + + '\'' + + + + + + + + + + diff --git a/common/libs/func_book_parser b/common/libs/func_book_parser index d92f331..2fb9f39 100644 --- a/common/libs/func_book_parser +++ b/common/libs/func_book_parser @@ -157,26 +157,27 @@ extract_commands() { # $BOOK/stylesheets/lfs-xsl/profile.xsl \ $BOOK/index.xml - xsltproc --nonet \ - --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 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 \ + xsltproc --nonet \ + --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 \ /tmp/lfs-full.xml >>$LOGDIR/$LOG 2>&1 rm /tmp/lfs-full.xml diff --git a/common/libs/func_validate_configs.sh b/common/libs/func_validate_configs.sh index 2220ca3..e7032d8 100644 --- a/common/libs/func_validate_configs.sh +++ b/common/libs/func_validate_configs.sh @@ -41,7 +41,7 @@ inline_doc 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" diff --git a/common/makefile-functions b/common/makefile-functions index f489b40..9e34161 100644 --- a/common/makefile-functions +++ b/common/makefile-functions @@ -115,6 +115,7 @@ define get_pkg_root2 echo "export PKG_DEST=$(SRC)/$@" >> envars; \ echo "source packInstall.sh" >> envars; \ echo "export -f packInstall" >> envars; \ + echo "export -f wrapInstall" >> envars; \ fi; endef diff --git a/jhalfs b/jhalfs index 8a1d03c..ab9b560 100755 --- a/jhalfs +++ b/jhalfs @@ -123,6 +123,7 @@ COMPARE=${COMPARE:-n} 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} diff --git a/pkgmngt/packInstall.sh.porg b/pkgmngt/packInstall.sh.porg new file mode 100644 index 0000000..edd5b01 --- /dev/null +++ b/pkgmngt/packInstall.sh.porg @@ -0,0 +1,56 @@ +# $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 + +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... + +local PCKGVRS=$(basename $PKGDIR) +local TGTPKG=$(basename $PKG_DEST) +local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3\}-//' | + sed 's/^[0-9]\{1\}-//') +# version is only accessible from PKGDIR name. Since the format of the +# name is not normalized, several hacks are necessary... +case $PCKGVRS in + expect*|tcl*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*//') ;; + vim*|unzip*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]\)\([0-9]\)/\1.\2/') ;; + tidy*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]*\)/\1cvs/') ;; + docbook-xml) local VERSION=4.5 ;; + *) local VERSION=$(echo ${PCKGVRS} | sed 's/^.*[-_]\([0-9]\)/\1/' | + sed 's/_/./g');; +# the last sed above is because some package managers do not want a '_' +# in version. +esac + +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) +case $PCKGVRS in + expect*|tcl*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*//') ;; + vim*|unzip*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]\)\([0-9]\)/\1.\2/') ;; + tidy*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]*\)/\1cvs/') ;; + docbook-xml) local VERSION=4.5 ;; + *) local VERSION=$(echo ${PCKGVRS} | sed 's/^.*[-_]\([0-9]\)/\1/' | + sed 's/_/./g');; +# the last sed above is because some package managers do not want a '_' +# in version. +esac +# Building the binary package +porgball ${PACKAGE} +# The package is in the current directory +mv -v ${PACKAGE}-${VERSION}.porg* /var/lib/packages +} diff --git a/pkgmngt/packageManager.xml.porg b/pkgmngt/packageManager.xml.porg new file mode 100644 index 0000000..174bd60 --- /dev/null +++ b/pkgmngt/packageManager.xml.porg @@ -0,0 +1,80 @@ + + + +
+ + + Package Information + Download: + MD5 sum: 2eceb8a73bb188dbb06b12d90cabdbb4 + + + + + Porg in tools + + Instructions +./configure --prefix=/tools \ + --disable-grop \ + --with-porg-logdir=/tools/var/porg + + + --disable-grop is needed to prevent the sytem from + trying to build the graphical interface, and + --with-porg-logdir=... is needed because + make install insists on creating a directory in + /var, where we do not want + to write. + + +make + +make install + +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 + + + + + + + + Directories + mkdir -pv /var/lib/porg +mkdir -pv /var/lib/packages + + + + Files + porgball needs porgrc + in /etc: + cp /tools/etc/porgrc /etc + + + + + Final Porg + + Instructions + +./configure --prefix=/usr \ + --disable-grop \ + --sysconfdir=/etc \ + --with-porg-logdir=/var/lib/porg + +make + +porg -lD "make install" + +sed -e '/EXCLUDE/{s/^#//;s@$@:/sources:/home@}' \ + -i /etc/porgrc + + + +