diff --git a/BLFS/Makefile b/BLFS/Makefile index 1f75180..210791a 100644 --- a/BLFS/Makefile +++ b/BLFS/Makefile @@ -4,6 +4,8 @@ # $Id$ +LANG=C +LC_ALL=C TOPDIR=$(shell pwd) CONFIG_CONFIG_IN = Config.in CONFIG = menu @@ -11,10 +13,10 @@ CONFIG = menu all: menuconfig $(CONFIG)/conf: - $(MAKE) -C $(CONFIG) conf + $(MAKE) -B -C $(CONFIG) conf $(CONFIG)/mconf: - $(MAKE) -C $(CONFIG) ncurses conf mconf + $(MAKE) -B -C $(CONFIG) ncurses conf mconf menuconfig: $(CONFIG)/mconf @./update_book.sh none @@ -35,4 +37,4 @@ clean-target: rm -f error - $(MAKE) -C $(CONFIG) clean -.PHONY: all menuconfig config clean clean-target +.PHONY: all menuconfig config clean clean-target $(CONFIG)/conf $(CONFIG)/mconf diff --git a/BLFS/TODO b/BLFS/TODO index 1bf7326..b2d5ee0 100644 --- a/BLFS/TODO +++ b/BLFS/TODO @@ -15,4 +15,6 @@ This is an on-going and never-end task due that, ideally, each commit to the BLFS book should be revised and validated, but our time is limited. --- Bugs hunting. \ No newline at end of file +-- Bugs hunting. + +-- Find a better way to define circular dependencies. \ No newline at end of file diff --git a/BLFS/envars.conf b/BLFS/envars.conf index ea5bebf..d3b8986 100644 --- a/BLFS/envars.conf +++ b/BLFS/envars.conf @@ -10,6 +10,9 @@ #======== Common envars ========== +#--- Set a well-known working locale when building software +export LC_ALL=C + #--- The local repository for packages/file # Any missing file will be downloaded and archived here, # if the user has the right priviledges. @@ -35,7 +38,7 @@ export SRC_DIR=$HOME/sources export XORG_PREFIX=/usr #--- Configure switches -export XORG_CONFIG="--prefix=$XORG_PREFIX --sysconfdir=/etc --localstatedir=/var --datadir=$XORG_PREFIX/lib" +export XORG_CONFIG="--prefix=$XORG_PREFIX --sysconfdir=/etc --mandir=$XORG_PREFIX/share/man --localstatedir=/var" #======== GNOME envars =========== @@ -76,13 +79,13 @@ export KDE_PREFIX=/usr # expected, please rebuild without optimizations before # asking for support. -#MAKEFLAGS="-j3" +#export MAKEFLAGS="-j3" -#CFLAGS="-O3 -pipe" -#CXXFLAGS=$CFLAGS -#LDFLAGS="-s" +#export CFLAGS="-O3 -pipe" +#export CXXFLAGS=$CFLAGS +#export LDFLAGS="-s" -#OTHER_CFLAGS=$CFLAGS -#OTHER_CXXFLAGS=$CXXFLAGS -#OTHER_LDFLAGS=$LDFLAGS +#export OTHER_CFLAGS=$CFLAGS +#export OTHER_CXXFLAGS=$CXXFLAGS +#export OTHER_LDFLAGS=$LDFLAGS diff --git a/BLFS/gen-makefile.sh b/BLFS/gen-makefile.sh index f4e9e04..936ce49 100755 --- a/BLFS/gen-makefile.sh +++ b/BLFS/gen-makefile.sh @@ -26,7 +26,7 @@ cat << EOF $i: $PREV @\$(call echo_message, Building) - @./progress_bar.sh \$@ \$\$PPID & + @/bin/bash progress_bar.sh \$@ \$\$PPID & EOF ) >> $MKFILE.tmp } diff --git a/BLFS/gen_config.sh b/BLFS/gen_config.sh index 29dc097..f05d347 100755 --- a/BLFS/gen_config.sh +++ b/BLFS/gen_config.sh @@ -47,7 +47,11 @@ do if [ $PKG_DIR = "." ]; then SET_COMMENT=y # Do not include previously installed packages - if [ -n "${PKG_VER}" ] && [ "x${PKG_VER}" = "x${INST_VER}" ]; then + if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" = "x${INST_VER}" ]]; then + continue + fi + # Do not include installed packages newer than the book ones + if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" < "x${INST_VER}" ]]; then continue fi # Set installed version for updated meta-packages @@ -75,7 +79,11 @@ EOF PKG_VER=$(grep "^${PKG_NAME}[[:space:]]" $inFile | cut -f3) INST_VER=$(grep "^${PKG_NAME}[[:space:]]" $inFile | cut -f4) # Skip installed meta-package components - if [ -n "${PKG_VER}" ] && [ "x${PKG_VER}" = "x${INST_VER}" ]; then + if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" = "x${INST_VER}" ]]; then + continue + fi + # Do not include installed packages newer than the book ones + if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" < "x${INST_VER}" ]]; then continue fi # Set installed version for updated meta-packages components @@ -95,15 +103,30 @@ EOF fi [[ "${SET_COMMENT}" = "y" ]] && echo "comment \"\"" >>$outFile; unset SET_COMMENT - # Deal with a few unusable (at target level) package names + # Deal with targets that are part of a meta-package but that are in the same + # directory that non meta-package targets case ${PKG_NAME} in - xorg7-* ) continue ;; - alsa-* ) continue ;; - x-config | x-setup ) continue ;; + alsa-* | \ + xorg7-* | \ + x-config | \ + x-setup | \ + libXau | \ + libxcb | \ + libXdmcp | \ + luit | \ + xbitmaps | \ + xcb-proto | \ + xkeyboard-config | \ + mesalib | \ + libdrm ) continue ;; esac # Skip installed packages - if [ -n "${PKG_VER}" ] && [ "x${PKG_VER}" = "x${INST_VER}" ]; then + if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" = "x${INST_VER}" ]]; then + continue + fi + # Do not include installed packages newer than the book ones + if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" < "x${INST_VER}" ]]; then continue fi # Set installed version for updated packages @@ -222,15 +245,12 @@ choice prompt "Window package" config WIN_xorg7 bool "Xorg7" - config WIN_xorg - bool "Xorg" config WIN_xfree86 bool "xfree86" endchoice config X11 string default xorg7 if WIN_xorg7 - default xorg if WIN_xorg default xfree86 if WIN_xfree86 endmenu diff --git a/BLFS/gen_pkg_book.sh b/BLFS/gen_pkg_book.sh index 17452ce..9d720b2 100755 --- a/BLFS/gen_pkg_book.sh +++ b/BLFS/gen_pkg_book.sh @@ -56,7 +56,7 @@ parse_configuration() { # continue ;; esac - if [[ "${REPLY}" =~ "^CONFIG_" ]]; then + if [[ "${REPLY}" =~ ^CONFIG_ ]]; then echo -n "$REPLY" if [[ $((++cntr)) > 1 ]]; then echo " <<-- ERROR SELECT ONLY 1 PACKAGE AT A TIME, WILL NOT BUILD" @@ -107,7 +107,7 @@ regenerate_deps() { # # Drop the "=y" REPLY=${REPLY%=*} - if [[ "${REPLY}" =~ "^DEP_" ]]; then + if [[ "${REPLY}" =~ ^DEP_ ]]; then META_PACKAGE=$(echo $REPLY | cut -d "_" -f2 | tr [A-Z] [a-z]) DEP_FNAME=$(echo $REPLY | cut -d "_" -f3) echo "${DEP_FNAME}" >>libs/${META_PACKAGE}.dep-MOD @@ -131,7 +131,7 @@ regenerate_deps() { # clean_configuration() { # #--------------------------# -tail -n 30 configuration > configuration.tmp +tail -n 29 configuration > configuration.tmp mv configuration.tmp configuration } diff --git a/BLFS/libs/func_dependencies b/BLFS/libs/func_dependencies index b6fa35f..c92416e 100644 --- a/BLFS/libs/func_dependencies +++ b/BLFS/libs/func_dependencies @@ -186,6 +186,9 @@ inline_doc # Don't have their own XML file hal-requirements | hal-runtime-dependencies ) continue ;; perl-* | tk-perl ) DEP=perl-modules ;; + dbus-* ) DEP=dbus-bindings ;; + pyxml | pycairo | pygobject | pygtk | pyorbit | \ + gnome-python | gnome-python-desktop ) DEP=python-modules ;; # Orphan links (proper link must be created when generating the book) arts ) DEP=aRts ;; @@ -202,7 +205,8 @@ inline_doc * ) pkg_ver=$(grep "^${X11}[[:space:]]" ../packages | cut -f3) inst_ver=$(grep "^${X11}[[:space:]]" ../packages | cut -f4) - [ -n "${pkg_ver}" ] && [ "x${pkg_ver}" = "x${inst_ver}" ] && continue + [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" = "x${inst_ver}" ]] && continue + [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" < "x${inst_ver}" ]] && continue ;; esac ;; @@ -211,7 +215,8 @@ inline_doc # If DEP has been previouly installed, skip it pkg_ver=$(grep "^${DEP}[[:space:]]" ../packages | cut -f3) inst_ver=$(grep "^${DEP}[[:space:]]" ../packages | cut -f4) - [ -n "${pkg_ver}" ] && [ "x${pkg_ver}" = "x${inst_ver}" ] && continue + [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" = "x${inst_ver}" ]] && continue + [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" < "x${inst_ver}" ]] && continue #------------------ # Prevent circular dependencies @@ -219,37 +224,114 @@ inline_doc # must be skipped, not placed here, to avoid that the script will bomb # due empty *.xinc files case $DEP in - jadetex | perl-* | lynx | Links | w3m ) - # Optional dependencies are runtime only - [[ "$PKG" = "docbook-utils" ]] && continue - ;; - libxslt ) - # libxml2-->libxslt-->libxml2 - [[ "$PKG" = "libxml2" ]] && continue - ;; - openldap | postgresql | $KBR5 ) - # cyrus-sasl-->several-->cyrus-sasl - [[ "$PKG" = "cyrus-sasl" ]] && continue - ;; - espgs ) - # sendmail-->espgs-->cups-->php-->sendmail - [[ "$PKG" = "$MAIL_SERVER" ]] && continue + akode ) + # Both are in the same page + [[ "$PKG" = "kdemultimedia" ]] && continue ;; aRts ) # esound-->aRts-->esound [[ "$PKG" = "esound" ]] && continue ;; - gimp | sane ) - # imagemagick-->{sane}-->gimp-->imagemagick - [[ "$PKG" = "imagemagick" ]] && continue + dbus-bindings ) + # True circular dependecy + [[ "$PKG" = "dbus-bindings" ]] && continue + ;; + DocBook ) + # Used to rebuild the documentation + [[ "$PKG" = "linux-pam" ]] && continue + ;; + docbook-xsl ) + # Used to rebuild the documentation + [[ "$PKG" = "linux-pam" ]] && continue + ;; + doxygen ) + # Used to rebuild the documentation + [[ "$PKG" = "dbus" ]] && continue + [[ "$PKG" = "libdvdcss" ]] && continue + [[ "$PKG" = "libusb" ]] && continue + [[ "$PKG" = "libxcb" ]] && continue + ;; + espgs ) + # Used to rebuild the documentation + [[ "$PKG" = "$MAIL_SERVER" ]] && continue ;; ffmpeg ) # alsa-plugins-->ffmpeg-->several-->alsa-plugins [[ "$PKG" = "alsa-plugins" ]] && continue ;; - akode ) - # Both are in the same page - [[ "$PKG" = "kdemultimedia" ]] && continue + fop ) + # Used to rebuild the documentation + [[ "$PKG" = "linux-pam" ]] && continue + ;; + graphviz ) + # Used to build the API documentation + [[ "$PKG" = "libusb" ]] && continue + ;; + GTK ) + # deprecated GTK version + [[ "$PKG" = "alsa-tools" ]] && continue + ;; + gtk2 ) + # Testsuite only + [[ "$PKG" = "cairo" ]] && continue + ;; + jadetex ) + # Runtime only + [[ "$PKG" = "docbook-utils" ]] && continue + ;; + $KBR5 ) + # cyrus-sasl-->postgresql-->$KBR5-->openldap-->cyrus-sasl + [[ "$PKG" = "cyrus-sasl" ]] && continue + ;; + librsvg ) + # Testsuite only + [[ "$PKG" = "cairo" ]] && continue + ;; + libxslt ) + # libxml2-->libxslt-->libxml2 + [[ "$PKG" = "libxml2" ]] && continue + ;; + Links ) + # Runtime only + [[ "$PKG" = "docbook-utils" ]] && continue + ;; + lynx ) + # Runtime only + [[ "$PKG" = "docbook-utils" ]] && continue + ;; + openldap ) + # cyrus-sasl-->postgresql-->$KBR5-->openldap-->cyrus-sasl + [[ "$PKG" = "cyrus-sasl" ]] && continue + ;; + poppler ) + # Testsuite only + [[ "$PKG" = "cairo" ]] && continue + ;; + postgresql ) + # cyrus-sasl-->postgresql-->$KBR5-->openldap-->cyrus-sasl + [[ "$PKG" = "cyrus-sasl" ]] && continue + ;; + python-modules ) + # True circular dependecy + [[ "$PKG" = "python-modules" ]] && continue + # libgsf-->python-modules-->several combinations-->libgsf + [[ "$PKG" = "libgsf" ]] && continue + # gimp-->python-modules-->several combinations-->gimp + [[ "$PKG" = "gimp" ]] && continue + # Used to rebuild the documentation + [[ "$PKG" = "gstreamer" ]] && continue + [[ "$PKG" = "gst-plugins-base" ]] && continue + [[ "$PKG" = "gst-plugins-good" ]] && continue + ;; + tk ) + # python-->tk-->xorg7-->several combinations-->libxslt-->python + [[ "$PKG" = "python" ]] && continue + ;; + w3m ) + # Runtime only + [[ "$PKG" = "docbook-utils" ]] && continue + # Used to rebuild the documentation + [[ "$PKG" = "linux-pam" ]] && continue ;; esac diff --git a/BLFS/libs/func_packages b/BLFS/libs/func_packages index 93f2740..c3d20ae 100644 --- a/BLFS/libs/func_packages +++ b/BLFS/libs/func_packages @@ -27,13 +27,12 @@ get_pkg_ver() { # Find package version for a given package ID wireless_tools ) pkg_id=wireless-tools ;; bind-utils ) pkg_id=bind ;; html-tidy ) pkg_id=tidy ;; - jdk ) pkg_id=jdk-src ;; reiserfs ) pkg_id=reiser ;; xfs ) pkg_id=xfsprogs ;; esac xmllint --noent ./${BLFS_XML}/book/bookinfo.xml 2>/dev/null | \ - grep -i " ${pkg_id}-version " | cut -d "\"" -f2 + grep -i " ${pkg_id}-version " | cut -d "\"" -f2 | sed "s/ /_/g" } @@ -42,7 +41,24 @@ get_installed_ver() { # Find installed package version for a given package ID #-----------------------# local pkg_id=$1 - find $TRACKING_DIR -name "${pkg_id}-[[:digit:]]*" | sed "s/.*${pkg_id}-//" + + case ${pkg_id} in + html-tidy ) + find $TRACKING_DIR -name "${pkg_id}-cvs_[[:digit:]]*" | sed "s/.*${pkg_id}-//" + ;; + cdparanoia ) + find $TRACKING_DIR -name "${pkg_id}-III-[[:digit:]]*" | sed "s/.*${pkg_id}-//" + ;; + ffmpeg ) + find $TRACKING_DIR -name "${pkg_id}-svn_[[:digit:]]*" | sed "s/.*${pkg_id}-//" + ;; + psutils ) + find $TRACKING_DIR -name "${pkg_id}-p[[:digit:]]*" | sed "s/.*${pkg_id}-//" + ;; + * ) + find $TRACKING_DIR -name "${pkg_id}-[[:digit:]]*" | sed "s/.*${pkg_id}-//" | sed "s/ /_/g" + ;; + esac } @@ -57,18 +73,24 @@ generate_packages() { # Master packages file # Extract Id and path for sect1 files for file in `find $BLFS_XML -name "*.xml"` ; do pkg_id=$(grep "sect1 id" $file | sed -e 's/> packages.tmp done # IDs clean-up (unuseful pages or commented-out packages, could be more) - sed -i '/template/d;/ntroduction/d;/preface/d;/alsa.xml/d' packages.tmp - sed -i '/obsolete/d;/postlfs-/d;/-client.xml/d;/xorg7.xml/d' packages.tmp - sed -i '/courier.xml/d;/-other\t/d;/others-/d;/other-/d' packages.tmp + sed -i '/template/d;/ntroduction/d;/preface/d;/alsa.xml/d;/xorg.xml/d' packages.tmp + sed -i '/obsolete/d;/ispell\t/d;/postlfs-/d;/-client.xml/d;/xorg7.xml/d' packages.tmp + sed -i '/courier.xml/d;/-other\t/d;/others-/d;/other-/d;/^ash\t/d' packages.tmp sed -i '/fw-firewall\t/d;/gcc2\t/d;/cvsserver\t/d;/svnserver\t/d' packages.tmp - sed -i '/fam\t/d;/libungif\t/d;/ncpfs\t/d;/slrn\t/d;/konq\t/d' packages.tmp - sed -i '/gst-plugins\t/d;/openquicktime\t/d;/compressdoc\t/d' packages.tmp + sed -i '/fam\t/d;/libungif\t/d;/ncpfs\t/d;/slrn\t/d;/konq\t/d;/arts\t/d' packages.tmp + sed -i '/gst-plugins\t/d;/gimp-print\t/d;/openquicktime\t/d;/compressdoc\t/d' packages.tmp + sed -i '/errata\t/d;/foreword\t/d;/organization\t/d;/whoread\t/d' packages.tmp # Meta-packages version ALSA_VER=$(get_pkg_ver alsa) @@ -204,6 +226,6 @@ alsa-plugins\nalsa-lib" > libs/alsa.dep generate_xorg7() { # Xorg7 packages #--------------------------# echo -e "x-config\nx-setup\nrman\nxterm2\nxorg7-driver\nxorg7-server\nluit\n\ -xorg7-font\nxorg7-data\nxorg7-app\nxbitmaps\nmesalib\nlibdrm\n\ -xorg7-lib\nxorg7-util\nxorg7-proto" > libs/xorg7.dep +xkeyboard-config\nxorg7-font\nxorg7-data\nxorg7-app\nmesalib\nlibdrm\nxbitmaps\n\ +xorg7-lib\nlibxcb\nxcb-proto\nlibXdmcp\nlibXau\nxorg7-util\nxorg7-proto" > libs/xorg7.dep } diff --git a/BLFS/libs/func_parser b/BLFS/libs/func_parser index 8b55c9a..3cf2356 100644 --- a/BLFS/libs/func_parser +++ b/BLFS/libs/func_parser @@ -29,8 +29,8 @@ inline_doc { cat << EOF - + @@ -106,7 +106,7 @@ inline_doc ../libs/book.xsl \ $TARGET-index.xml > xsltproc.log 2>&1 mkdir HTML/{stylesheets,images} - cp ../$BLFS_XML/stylesheets/*.css HTML/stylesheets + cp ../$BLFS_XML/stylesheets/lfs-xsl/*.css HTML/stylesheets cp ../$BLFS_XML/images/*.png HTML/images cd HTML sed -i -e "s@../stylesheets@stylesheets@g" *.html diff --git a/BLFS/libs/scripts.xsl b/BLFS/libs/scripts.xsl index 97077aa..63fe140 100644 --- a/BLFS/libs/scripts.xsl +++ b/BLFS/libs/scripts.xsl @@ -29,7 +29,7 @@ - + + - + @@ -86,7 +86,7 @@ - #!/bin/sh set -e + #!/bin/bash set -e - cd $SRC_DIR/$PKG_DIR - rm -rf $UNPACKDIR unpacked + + cd $SRC_DIR/$PKG_DIR + rm -rf $UNPACKDIR unpacked + + + cd $SRC_DIR/MesaLib +UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'` +rm -rf $UNPACKDIR unpacked + @@ -148,14 +155,14 @@ cd xc if [[ -e unpacked ]] ; then UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'` - rm -rf $UNPACKDIR + [[ -n $UNPACKDIR ]] && [[ -d $UNPACKDIR ]] && rm -rf $UNPACKDIR fi tar -xvf $PACKAGE > unpacked UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'` cd $UNPACKDIR - sudo + sudo /sbin/ ldconfig @@ -168,29 +175,57 @@ cd $UNPACKDIR - + + + - - - WGET_LST= - - + SRC_ARCHIVE=$SRC_ARCHIVE +FTP_SERVER=$FTP_SERVER + + mkdir -p ${section} cd ${section} + + for line in $(grep -v '^#' ../${sect_ver}.wget) ; do + if [[ ! -f ${line} ]] ; then + if [[ -f $SRC_ARCHIVE/Xorg/${section}/${line} ]] ; then + cp $SRC_ARCHIVE/Xorg/${section}/${line} ${line} + elif [[ -f $SRC_ARCHIVE/Xorg/${line} ]] ; then + cp $SRC_ARCHIVE/Xorg/${line} ${line} + elif [[ -f $SRC_ARCHIVE/${section}/${line} ]] ; then + cp $SRC_ARCHIVE/${section}/${line} ${line} + elif [[ -f $SRC_ARCHIVE/${line} ]] ; then + cp $SRC_ARCHIVE/${line} ${line} + else + wget ${FTP_SERVER}conglomeration/Xorg/${line} || \ + wget http://xorg.freedesktop.org/releases/individual/${section}/${line} + fi + fi +done +md5sum -c ../${sect_ver}.md5 +cp ../${sect_ver}.wget ../${sect_ver}.wget.orig +cp ../${sect_ver}.md5 ../${sect_ver}.md5.orig - for package in $(cat $WGET_LST) ; do + for package in $(grep -v '^#' ../${sect_ver}.wget) ; do packagedir=$(echo $package | sed 's/.tar.bz2//') - tar -xf $package - cd $packagedir + tar -xf ${package} + cd ${packagedir} cd .. - rm -rf $packagedir -done + rm -rf ${packagedir} + sed -i "/${package}/d" ../${sect_ver}.wget + sed -i "/${package}/d" ../${sect_ver}.md5 +done +mv ../${sect_ver}.wget.orig ../${sect_ver}.wget +mv ../${sect_ver}.md5.orig ../${sect_ver}.md5 - sudo + sudo /sbin/ ldconfig + + + + @@ -356,10 +391,16 @@ done wget ${FTP_SERVER}conglomeration/$PKG_DIR/$PACKAGE - + || \ wget - + + + + + + + + @@ -385,6 +426,15 @@ done + + wget + + + + + + wget @@ -397,18 +447,22 @@ done - sudo sh -c " + sudo sh -c ' - " + ' - - + + section= + + sect_ver= + + @@ -427,9 +481,16 @@ done - **EDITME - - EDITME** + + + $SRC_DIR/MesaLib + + + **EDITME + + EDITME** + + diff --git a/CLFS/clfs.xsl b/CLFS/clfs.xsl index 584548d..0562fb8 100644 --- a/CLFS/clfs.xsl +++ b/CLFS/clfs.xsl @@ -42,6 +42,9 @@ + + + @@ -87,23 +90,31 @@ - - #!/tools/bin/bash set -e - - - #!/bin/sh + + #!/tools/bin/bash set +h - #!/bin/sh set -e + #!/bin/bash set +h - + + set -e + + + cd $PKGDIR tar -xvf ../vim-&vim-version;-lang.* --strip-components=1 + + echo -e "\n\nTotalseconds: $SECONDS\n" + exit @@ -149,13 +160,6 @@ - - - - patch -Z - - - @@ -282,6 +286,40 @@ + + + + + + -m32 -mcpu=ultrasparc -mtune=ultrasparc + + + -m32 -mcpu=ultrasparc3 -mtune=ultrasparc3 + + + + + + + -m64 -mcpu=ultrasparc -mtune=ultrasparc + + + -m64 -mcpu=ultrasparc3 -mtune=ultrasparc3 + + + + + + + -mcpu=ultrasparc -mtune=ultrasparc + + + -mcpu=ultrasparc3 -mtune=ultrasparc3 + + + + + **EDITME diff --git a/CLFS/master.sh b/CLFS/master.sh old mode 100755 new mode 100644 index bebe6e4..1b96a46 --- a/CLFS/master.sh +++ b/CLFS/master.sh @@ -1,103 +1,9 @@ -#!/bin/sh +#!/bin/bash # $Id$ orphan_scripts="" # 2 scripts do not fit BOOT_Makefiles LUSER environment -################################### -### FUNCTIONS ### -################################### - -#--------------------------------------# -BOOT_wrt_target() { # "${this_script}" "$PREV" -#--------------------------------------# - local i=$1 - local PREV=$2 - case $i in - iteration* ) local LOGFILE=$this_script.log ;; - * ) local LOGFILE=$this_script ;; - esac -( -cat << EOF - -$i: $PREV - @\$(call echo_message, Building) - @./progress_bar.sh \$@ \$\$PPID & - @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=${SCRIPT_ROOT}\`\n" >logs/$LOGFILE -EOF -) >> $MKFILE.tmp -} - -#--------------------------------------# -BOOT_wrt_Unpack() { # "$pkg_tarball" -#--------------------------------------# - local FILE=$1 - local optSAVE_PREVIOUS=$2 - - if [ "${optSAVE_PREVIOUS}" != "1" ]; then -( -cat << EOF - @\$(call remove_existing_dirs2,$FILE) -EOF -) >> $MKFILE.tmp - fi -( -cat << EOF - @\$(call unpack3,$FILE) - @\$(call get_pkg_root2) -EOF -) >> $MKFILE.tmp -} - -#----------------------------------# -BOOT_wrt_RunAsRoot() { # "${this_script}" "${file}" -#----------------------------------# - local this_script=$1 - local file=$2 -( -cat << EOF - @( time { source envars && ${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@ 2>&1 ; } ) 2>>logs/\$@ && \\ - echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \`\n" >>logs/\$@ -EOF -) >> $MKFILE.tmp -} - -#--------------------------------------# -BOOT_wrt_RemoveBuildDirs() { # "${name}" -#--------------------------------------# - local name=$1 -( -cat << EOF - @\$(call remove_build_dirs2,$name) -EOF -) >> $MKFILE.tmp -} - -#----------------------------------# -BOOT_wrt_test_log() { # -#----------------------------------# - local TESTLOGFILE=$1 -( -cat << EOF - @echo "export TEST_LOG=/\$(SCRIPT_ROOT)/test-logs/$TESTLOGFILE" >> envars && \\ - echo -e "\n\`date\`\n" >test-logs/$TESTLOGFILE -EOF -) >> $MKFILE.tmp -} - -#----------------------------------# -BOOT_wrt_CopyFstab() { # -#----------------------------------# -( -cat << EOF - @( time { cp -v /sources/fstab /etc/fstab >>logs/${this_script} 2>&1 ; } ) 2>>logs/${this_script} -EOF -) >> $MKFILE.tmp -} - - -######################################## - #--------------------------------------# host_prep_Makefiles() { # @@ -115,67 +21,56 @@ cat << EOF @mkdir \$(MOUNT_PT)/tools && \\ rm -f /tools && \\ ln -s \$(MOUNT_PT)/tools / - @if [ ! -d \$(MOUNT_PT)/sources ]; then \\ - mkdir \$(MOUNT_PT)/sources; \\ - fi; - @chmod a+wt \$(MOUNT_PT)/sources && \\ - touch \$@ && \\ - echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ - echo --------------------------------------------------------------------------------\$(WHITE) + @\$(call housekeeping) 024-creatingcrossdir: 023-creatingtoolsdir + @\$(call echo_message, Building) @mkdir -v \$(MOUNT_PT)/cross-tools && \\ rm -f /cross-tools && \\ ln -s \$(MOUNT_PT)/cross-tools / - @touch \$@ && \\ - echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ - echo --------------------------------------------------------------------------------\$(WHITE) + @\$(call housekeeping) 025-addinguser: 024-creatingcrossdir @\$(call echo_message, Building) - @if [ ! -d /home/\$(LUSER) ]; then \\ + @if [ ! -d \$(LUSER_HOME) ]; then \\ groupadd \$(LGROUP); \\ useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\ else \\ touch luser-exist; \\ fi; - @chown \$(LUSER) \$(MOUNT_PT) && \\ - chown \$(LUSER) \$(MOUNT_PT)/tools && \\ + @chown \$(LUSER) \$(MOUNT_PT)/tools && \\ chown \$(LUSER) \$(MOUNT_PT)/cross-tools && \\ - chown \$(LUSER) \$(MOUNT_PT)/sources && \\ - touch \$@ && \\ - echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ - echo --------------------------------------------------------------------------------\$(WHITE) + chmod -R a+wt \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\ + chmod a+wt \$(SRCSDIR) + @\$(call housekeeping) 026-settingenvironment: 025-addinguser @\$(call echo_message, Building) - @if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ - mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\ + @if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\ + mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\ fi; - @if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ - mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\ + @if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\ + mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\ fi; - @echo "set +h" > /home/\$(LUSER)/.bashrc && \\ - echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\ - echo "CLFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\ - echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\ - echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\ - echo "export CLFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\ - echo "" >> /home/\$(LUSER)/.bashrc && \\ - echo "unset CFLAGS" >> /home/\$(LUSER)/.bashrc && \\ - echo "unset CXXFLAGS" >> /home/\$(LUSER)/.bashrc && \\ - echo "" >> /home/\$(LUSER)/.bashrc && \\ - echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/\$(LUSER)/.bashrc && \\ - echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/\$(LUSER)/.bashrc && \\ - echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/\$(LUSER)/.bashrc && \\ - echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc - @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\ + @echo "set +h" > \$(LUSER_HOME)/.bashrc && \\ + echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\ + echo "CLFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\ + echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\ + echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\ + echo "export CLFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\ + echo "" >> \$(LUSER_HOME)/.bashrc && \\ + echo "unset CFLAGS" >> \$(LUSER_HOME)/.bashrc && \\ + echo "unset CXXFLAGS" >> \$(LUSER_HOME)/.bashrc && \\ + echo "" >> \$(LUSER_HOME)/.bashrc && \\ + echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> \$(LUSER_HOME)/.bashrc && \\ + echo "export CLFS_TARGET=\"${TARGET}\"" >> \$(LUSER_HOME)/.bashrc && \\ + echo "export CLFS_TARGET32=\"${TARGET32}\"" >> \$(LUSER_HOME)/.bashrc && \\ + echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc + @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\ touch envars && \\ chmod -R a+wt \$(MOUNT_PT) && \\ - chown -R \$(LUSER) \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\ - touch \$@ && \\ - echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ - echo --------------------------------------------------------------------------------\$(WHITE) + chown -R \$(LUSER) \$(MOUNT_PT)/\$(SCRIPT_ROOT) + @\$(call housekeeping) EOF ) >> $MKFILE.tmp host_prep=" 023-creatingtoolsdir 024-creatingcrossdir 026-settingenvironment" @@ -210,7 +105,7 @@ cross_tools_Makefiles() { # name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \ -e 's@-static@@' \ -e 's@-final@@' \ - -e 's@-64@@' \ + -e 's@-64@@' \ -e 's@-n32@@'` pkg_tarball=$(get_package_tarball_name $name) @@ -320,7 +215,6 @@ chroot_Makefiles() { # # First append each name of the script files to a list (this will become # the names of the targets in the Makefile case "${this_script}" in - *util-linux) orphan_scripts="${orphan_scripts} ${this_script}" ;; *kernfs) orphan_scripts="${orphan_scripts} ${this_script}" ;; *) chroottools="$chroottools $this_script" ;; esac @@ -340,8 +234,8 @@ chroot_Makefiles() { # LUSER_wrt_RunAsUser "${file}" LUSER_RemoveBuildDirs "${name}" wrt_touch - temptools="$temptools $this_script" - continue ;; + temptools="$temptools $this_script" + continue ;; esac @@ -357,17 +251,13 @@ chroot_Makefiles() { # # Insert instructions for unpacking the package and changing directories # if [ "$pkg_tarball" != "" ] ; then - case $this_script in - *util-linux) ROOT_Unpack "$pkg_tarball" ;; - *) CHROOT_Unpack "$pkg_tarball" ;; - esac + CHROOT_Unpack "$pkg_tarball" [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name" fi # # Select a script execution method case $this_script in - *kernfs) wrt_RunAsRoot "${this_script}" "${file}" ;; - *util-linux) ROOT_RunAsRoot "${file}" ;; + *kernfs) wrt_RunAsRoot "${file}" ;; *) CHROOT_wrt_RunAsRoot "${file}" ;; esac # @@ -403,7 +293,7 @@ boot_Makefiles() { # # A little housekeeping on the scripts case $this_script in - *grub | *aboot | *colo | *silo | *arcload | *lilo ) continue ;; + *grub | *aboot | *colo | *silo | *arcload | *lilo | *introduction ) continue ;; *whatnext*) continue ;; *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;; *kernel) # if there is no kernel config file do not build the kernel @@ -456,8 +346,8 @@ boot_Makefiles() { # case $this_script in # The following 2 scripts are defined in the /boot directory but need # to be run as a root user. Set them up here but run them in another phase - *changingowner*) wrt_RunAsRoot "${this_script}" "${file}" ;; - *devices*) wrt_RunAsRoot "${this_script}" "${file}" ;; + *changingowner*) wrt_RunAsRoot "${file}" ;; + *devices*) wrt_RunAsRoot "${file}" ;; *fstab*) if [[ -n "$FSTAB" ]]; then LUSER_wrt_CopyFstab else @@ -485,9 +375,15 @@ boot_Makefiles() { # #--------------------------------------# -chroot_testsuite_tools_Makefiles() { # +testsuite_tools_Makefiles() { # #--------------------------------------# - echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) testsuite tools ( CHROOT ) ${R_arrow}" + + if [[ "${METHOD}" = "chroot" ]]; then + echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) testsuite tools ( CHROOT ) ${R_arrow}" + else + echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) testsuite tools ( ROOT ) ${R_arrow}" + PREV="" + fi for file in testsuite-tools/* ; do # Keep the script file name @@ -534,65 +430,15 @@ chroot_testsuite_tools_Makefiles() { # done } -#--------------------------------------# -boot_testsuite_tools_Makefiles() { # -#--------------------------------------# - echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) testsuite tools ( ROOT ) ${R_arrow}" - for file in testsuite-tools/* ; do - # Keep the script file name - this_script=`basename $file` - - # First append each name of the script files to a list (this will become - # the names of the targets in the Makefile - PREV= - testsuitetools="$testsuitetools $this_script" - - # Grab the name of the target, strip id number, XXX-script - name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\ - -e 's@-64bit@@' \ - -e 's@-64@@' \ - -e 's@64@@' \ - -e 's@n32@@'` - - pkg_tarball=$(get_package_tarball_name $name) - - #--------------------------------------------------------------------# - # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # - #--------------------------------------------------------------------# - # - # Drop in the name of the target on a new line, and the previous target - # as a dependency. Also call the echo_message function. - BOOT_wrt_target "${this_script}" "$PREV" - # - BOOT_wrt_Unpack "$pkg_tarball" - [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name" - # - BOOT_wrt_RunAsRoot "${this_script}" "${file}" - # - BOOT_wrt_RemoveBuildDirs "${name}" - # - # Include a touch of the target name so make can check if it's already been made. - wrt_touch - # - #--------------------------------------------------------------------# - # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # - #--------------------------------------------------------------------# - # - # Keep the script file name for Makefile dependencies. - PREV=$this_script - - done - -} - #--------------------------------------# -chroot_final_system_Makefiles() { # +final_system_Makefiles() { # #--------------------------------------# # Set envars and scripts for iteration targets - LOGS="" # Start with an empty global LOGS envar if [[ -z "$1" ]] ; then local N="" + # In boot method the makesys phase was initiated in testsuite_tools_makefile + [[ "${METHOD}" = "boot" ]] && [[ "$TEST" = 0 ]] && PREV="" else local N=-build_$1 local basicsystem="" @@ -603,14 +449,20 @@ chroot_final_system_Makefiles() { # sed -e 's/ln -sv/&f/g' \ -e 's/mv -v/&f/g' \ -e 's/mkdir -v/&p/g' -i ${script} + # Rename the scripts + mv ${script} ${script}$N done - # Remove Bzip2 binaries before make install - sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2 + # Remove Bzip2 binaries before make install (CLFS-1.0 compatibility) + sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2$N # Delete *old Readline libraries just after make install - sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline + sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline$N fi - echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) final system$N ( CHROOT ) ${R_arrow}" + if [[ "${METHOD}" = "chroot" ]]; then + echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) final system$N ( CHROOT ) ${R_arrow}" + else + echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system$N ( ROOT ) ${R_arrow}" + fi for file in final-system$N/* ; do # Keep the script file name @@ -629,7 +481,8 @@ chroot_final_system_Makefiles() { # -e 's@-64bit@@' \ -e 's@-64@@' \ -e 's@64@@' \ - -e 's@n32@@'` + -e 's@n32@@' \ + -e 's,'$N',,'` # Find the version of the command files, if it corresponds with the building of # a specific package. We need this here to can skip scripts not needed for @@ -645,11 +498,7 @@ chroot_final_system_Makefiles() { # # Append each name of the script files to a list (this will become # the names of the targets in the Makefile - basicsystem="$basicsystem ${this_script}${N}" - - # Append each name of the script files to a list (this will become - # the names of the logs to be moved for each iteration) - LOGS="$LOGS ${this_script}" + basicsystem="$basicsystem ${this_script}" #--------------------------------------------------------------------# # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # @@ -657,10 +506,15 @@ chroot_final_system_Makefiles() { # # # Drop in the name of the target on a new line, and the previous target # as a dependency. Also call the echo_message function. - CHROOT_wrt_target "${this_script}${N}" "$PREV" + CHROOT_wrt_target "${this_script}" "$PREV" # If $pkg_tarball isn't empty, we've got a package... if [ "$pkg_tarball" != "" ] ; then + # Touch timestamp file if installed files logs will be created. + # But only for the firt build when running iterative builds. + if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then + CHROOT_wrt_TouchTimestamp + fi CHROOT_Unpack "$pkg_tarball" # If the testsuites must be run, initialize the log file case $name in @@ -677,120 +531,17 @@ chroot_final_system_Makefiles() { # # CHROOT_wrt_RunAsRoot "${file}" # - [[ "$pkg_tarball" != "" ]] && CHROOT_wrt_RemoveBuildDirs "${name}" - # - # Include a touch of the target name so make can check if it's already been made. - wrt_touch - # - #--------------------------------------------------------------------# - # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # - #--------------------------------------------------------------------# - # - # Keep the script file name for Makefile dependencies. - PREV=${this_script}${N} - # Set system_build envar for iteration targets - system_build=$basicsystem - done # for file in final-system/* ... -} - -#--------------------------------------# -boot_final_system_Makefiles() { # -#--------------------------------------# - # Set envars and scripts for iteration targets - LOGS="" # Start with an empty global LOGS envar - if [[ -z "$1" ]] ; then - local N="" - # The makesys phase was initiated in bm_testsuite_tools_makefile - [[ "$TEST" = 0 ]] && PREV="" - else - local N=-build_$1 - local basicsystem="" - mkdir final-system$N - cp final-system/* final-system$N - for script in final-system$N/* ; do - # Overwrite existing symlinks, files, and dirs - sed -e 's/ln -sv/&f/g' \ - -e 's/mv -v/&f/g' \ - -e 's/mkdir -v/&p/g' -i ${script} - done - # Remove Bzip2 binaries before make install - sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2 - # Delete *old Readline libraries just after make install - sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline - fi - - echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system$N ( ROOT ) ${R_arrow}" - - for file in final-system$N/* ; do - # Keep the script file name - this_script=`basename $file` - - # Test if the stripping phase must be skipped - # Skip alsp temp-perl for iterative runs - case $this_script in - *stripping*) [[ "$STRIP" = "n" ]] && continue ;; - *temp-perl*) [[ -n "$N" ]] && continue ;; - esac - - # Grab the name of the target, strip id number, XXX-script - name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \ - -e 's@temp-@@' \ - -e 's@-64bit@@' \ - -e 's@-64@@' \ - -e 's@64@@' \ - -e 's@n32@@'` - - # Find the version of the command files, if it corresponds with the building of - # a specific package. We need this here to can skip scripts not needed for - # iterations rebuilds - - pkg_tarball=$(get_package_tarball_name $name) - - if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then - case "${this_script}" in - *stripping*) ;; - *) continue ;; - esac - fi - - # Append each name of the script files to a list (this will become - # the names of the targets in the Makefile - basicsystem="$basicsystem ${this_script}${N}" - - # Append each name of the script files to a list (this will become - # the names of the logs to be moved for each iteration) - LOGS="$LOGS ${this_script}" - - #--------------------------------------------------------------------# - # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # - #--------------------------------------------------------------------# - # - # Drop in the name of the target on a new line, and the previous target - # as a dependency. Also call the echo_message function. - BOOT_wrt_target "${this_script}${N}" "$PREV" - - # If $pkg_tarball isn't empty, we've got a package... + # Write installed files log and remove the build directory(ies) + # except if the package build fails. if [ "$pkg_tarball" != "" ] ; then - FILE="$pkg_tarball" - BOOT_wrt_Unpack "$FILE" - # If the testsuites must be run, initialize the log file - case $name in - binutils | gcc | glibc ) - [[ "$TEST" != "0" ]] && BOOT_wrt_test_log "${this_script}" - ;; - * ) - [[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && BOOT_wrt_test_log "${this_script}" - ;; - esac - # If using optimizations, write the instructions - [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name" + CHROOT_wrt_RemoveBuildDirs "$name" + if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then + CHROOT_wrt_LogNewFiles "$name" + fi fi # - BOOT_wrt_RunAsRoot "${this_script}" "${file}" - # - [[ "$pkg_tarball" != "" ]] && BOOT_wrt_RemoveBuildDirs "${name}" - # - # Include a touch of the target name so make can check if it's already been made. + # Include a touch of the target name so make can check + # if it's already been made. wrt_touch # #--------------------------------------------------------------------# @@ -798,17 +549,21 @@ boot_final_system_Makefiles() { # #--------------------------------------------------------------------# # # Keep the script file name for Makefile dependencies. - PREV=${this_script}${N} + PREV=${this_script} # Set system_build envar for iteration targets system_build=$basicsystem done # for file in final-system/* ... - } #--------------------------------------# -chroot_bootscripts_Makefiles() { # +bootscripts_Makefiles() { # #--------------------------------------# - echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) bootscripts ( CHROOT ) ${R_arrow}" + + if [[ "${METHOD}" = "chroot" ]]; then + echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) bootscripts ( CHROOT ) ${R_arrow}" + else + echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) bootscripts ( ROOT ) ${R_arrow}" + fi for file in bootscripts/* ; do # Keep the script file name @@ -847,11 +602,23 @@ chroot_bootscripts_Makefiles() { # # # If $pkg_tarball isn't empty, we've got a package... # - [[ "$pkg_tarball" != "" ]] && CHROOT_Unpack "$pkg_tarball" + if [ "$pkg_tarball" != "" ] ; then + if [ "${INSTALL_LOG}" = "y" ] ; then + CHROOT_wrt_LogNewFiles "$name" + fi + CHROOT_Unpack "$pkg_tarball" + fi # CHROOT_wrt_RunAsRoot "${file}" # - [[ "$pkg_tarball" != "" ]] && CHROOT_wrt_RemoveBuildDirs "${name}" + # Write installed files log and remove the build directory(ies) + # except if the package build fails. + if [ "$pkg_tarball" != "" ] ; then + CHROOT_wrt_RemoveBuildDirs "$name" + if [ "${INSTALL_LOG}" = "y" ] ; then + CHROOT_wrt_LogNewFiles "$name" + fi + fi # # Include a touch of the target name so make can check if it's already been made. wrt_touch @@ -867,72 +634,17 @@ chroot_bootscripts_Makefiles() { # } #--------------------------------------# -boot_bootscripts_Makefiles() { # +bootable_Makefiles() { # #--------------------------------------# - echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) bootscripts ( ROOT ) ${R_arrow}" - for file in bootscripts/* ; do - # Keep the script file name - this_script=`basename $file` + if [[ "${METHOD}" = "chroot" ]]; then + echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) make bootable ( CHROOT ) ${R_arrow}" + else + echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) make bootable ( ROOT ) ${R_arrow}" + fi - case $this_script in - *udev) continue ;; # This is not a script but a commentary - *console*) continue ;; # Use the files that came with the bootscripts - *) ;; - esac - # First append each name of the script files to a list (this will become - # the names of the targets in the Makefile - bootscripttools="$bootscripttools $this_script" - - # Grab the name of the target, strip id number, XXX-script - name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\ - -e 's@-64bit@@' \ - -e 's@-64@@' \ - -e 's@64@@' \ - -e 's@n32@@'` - case $name in - *bootscripts*) name=bootscripts-cross-lfs ;; - *udev-rules) name=udev-cross-lfs ;; - esac - - pkg_tarball=$(get_package_tarball_name $name) - - #--------------------------------------------------------------------# - # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # - #--------------------------------------------------------------------# - # - # Drop in the name of the target on a new line, and the previous target - # as a dependency. Also call the echo_message function. - BOOT_wrt_target "${this_script}" "$PREV" - # - # If $pkg_tarball isn't empty, we've got a package... - # - [[ "$pkg_tarball" != "" ]] && BOOT_wrt_Unpack "$pkg_tarball" - # - BOOT_wrt_RunAsRoot "${this_script}" "${file}" - # - [[ "$pkg_tarball" != "" ]] && BOOT_wrt_RemoveBuildDirs "${name}" - # - # Include a touch of the target name so make can check if it's already been made. - wrt_touch - # - #--------------------------------------------------------------------# - # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # - #--------------------------------------------------------------------# - # - # Keep the script file name for Makefile dependencies. - PREV=$this_script - - done # for file in bootscripts/* ... -} - -#--------------------------------------# -chroot_bootable_Makefiles() { # -#--------------------------------------# - echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) make bootable ( CHROOT ) ${R_arrow}" - - for file in {bootable,the-end}/* ; do + for file in bootable/* ; do # Keep the script file name this_script=`basename $file` @@ -971,7 +683,12 @@ chroot_bootable_Makefiles() { # # If $pkg_tarball isn't empty, we've got a package... # Insert instructions for unpacking the package and changing directories # - [[ "$pkg_tarball" != "" ]] && CHROOT_Unpack "$pkg_tarball" + if [ "$pkg_tarball" != "" ] ; then + if [ "${INSTALL_LOG}" = "y" ] ; then + CHROOT_wrt_LogNewFiles "$name" + fi + CHROOT_Unpack "$pkg_tarball" + fi # # Select a script execution method case $this_script in @@ -985,8 +702,14 @@ chroot_bootable_Makefiles() { # ;; esac # - # Housekeeping...remove any build directory(ies) except if the package build fails. - [[ "$pkg_tarball" != "" ]] && CHROOT_wrt_RemoveBuildDirs "${name}" + # Write installed files log and remove the build directory(ies) + # except if the package build fails. + if [ "$pkg_tarball" != "" ] ; then + CHROOT_wrt_RemoveBuildDirs "$name" + if [ "${INSTALL_LOG}" = "y" ] ; then + CHROOT_wrt_LogNewFiles "$name" + fi + fi # # Include a touch of the target name so make can check if it's already been made. wrt_touch @@ -1002,79 +725,6 @@ chroot_bootable_Makefiles() { # } -#--------------------------------------# -boot_bootable_Makefiles() { # -#--------------------------------------# - echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) make bootable ( ROOT ) ${R_arrow}" - - for file in {bootable,the-end}/* ; do - # Keep the script file name - this_script=`basename $file` - - # A little housekeeping on the scripts - case $this_script in - *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;; - *kernel) # if there is no kernel config file do not build the kernel - [[ -z $CONFIG ]] && continue - # Copy the named config file to /sources with a standardized name - cp $CONFIG $BUILDDIR/sources/kernel-config - ;; - esac - # - # First append each name of the script files to a list (this will become - # the names of the targets in the Makefile - bootabletools="$bootabletools $this_script" - # - # Grab the name of the target, strip id number and misc words. - case $this_script in - *kernel) name=linux ;; - *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;; - esac - - pkg_tarball=$(get_package_tarball_name $name) - - #--------------------------------------------------------------------# - # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # - #--------------------------------------------------------------------# - # - # Drop in the name of the target on a new line, and the previous target - # as a dependency. Also call the echo_message function. - BOOT_wrt_target "${this_script}" "$PREV" - # - # If $pkg_tarball isn't empty, we've got a package... - # Insert instructions for unpacking the package and changing directories - # - [[ "$pkg_tarball" != "" ]] && BOOT_wrt_Unpack "$pkg_tarball" - # - # Select a script execution method - case $this_script in - *fstab*) if [[ -n "$FSTAB" ]]; then - # Minimal boot mode has no access to original file, store in /sources - cp $FSTAB $BUILDDIR/sources/fstab - BOOT_wrt_CopyFstab "${this_script}" - else - BOOT_wrt_RunAsRoot "${this_script}" "${file}" - fi - ;; - *) BOOT_wrt_RunAsRoot "${this_script}" "${file}" ;; - esac - # - # Housekeeping...remove any build directory(ies) except if the package build fails. - [[ "$pkg_tarball" != "" ]] && BOOT_wrt_RemoveBuildDirs "${name}" - # - # Include a touch of the target name so make can check if it's already been made. - wrt_touch - # - #--------------------------------------------------------------------# - # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # - #--------------------------------------------------------------------# - # - # Keep the script file name for Makefile dependencies. - PREV=$this_script - done - -} - #--------------------------------------# build_Makefile() { # Construct a Makefile from the book scripts @@ -1084,10 +734,6 @@ build_Makefile() { # Construct a Makefile from the book scri # set +e declare -f method_cmds - declare -f testsuite_cmds - declare -f final_sys_cmds - declare -f bootscripts_cmds - declare -f bootable_cmds set -e echo "...Creating Makefile... ${BOLD}START${OFF}" @@ -1097,71 +743,36 @@ set -e >$MKFILE >$MKFILE.tmp - method_cmds=${METHOD}_Makefiles - testsuite_cmds=${METHOD}_testsuite_tools_Makefiles - final_sys_cmds=${METHOD}_final_system_Makefiles - bootscripts_cmds=${METHOD}_bootscripts_Makefiles - bootable_cmds=${METHOD}_bootable_Makefiles + method_cmds=${METHOD}_Makefiles host_prep_Makefiles # mk_SETUP (SETUP) $host_prep cross_tools_Makefiles # mk_CROSS (LUSER) $cross_tools temptools_Makefiles # mk_TEMP (LUSER) $temptools $method_cmds # mk_SYSTOOLS (CHROOT) $chroottools/$boottools if [[ ! $TEST = "0" ]]; then - $testsuite_cmds # mk_SYSTOOLS (CHROOT) $testsuitetools + testsuite_tools_Makefiles # mk_SYSTOOLS (CHROOT) $testsuitetools fi - $final_sys_cmds # mk_FINAL (CHROOT) $basicsystem + final_system_Makefiles # mk_FINAL (CHROOT) $basicsystem # Add the iterations targets, if needed [[ "$COMPARE" = "y" ]] && wrt_compare_targets - $bootscripts_cmds # mk_BOOTSCRIPT (CHROOT) $bootscripttools - $bootable_cmds # mk_BOOTABLE (CHROOT) $bootabletools + bootscripts_Makefiles # mk_BOOTSCRIPT (CHROOT) $bootscripttools + bootable_Makefiles # mk_BOOTABLE (CHROOT) $bootabletools + # Add the CUSTOM_TOOLS targets, if needed + [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target # Add the BLFS_TOOL targets, if needed [[ "$BLFS_TOOL" = "y" ]] && wrt_blfs_tool_targets # Add a header, some variables and include the function file # to the top of the real Makefile. -( - cat << EOF -$HEADER - -SRC = /sources -MOUNT_PT = $BUILDDIR -PKG_LST = $PKG_LST -LUSER = $LUSER -LGROUP = $LGROUP -SCRIPT_ROOT = $SCRIPT_ROOT -ADD_BLFS_TOOLS = $BLFS_TOOL - -BASEDIR = \$(MOUNT_PT) -SRCSDIR = \$(BASEDIR)/sources -CMDSDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$PROGNAME-commands -LOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/logs -TESTLOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/test-logs - -crSRCSDIR = /sources -crCMDSDIR = /\$(SCRIPT_ROOT)/$PROGNAME-commands -crLOGDIR = /\$(SCRIPT_ROOT)/logs -crTESTLOGDIR = /\$(SCRIPT_ROOT)/test-logs - -SU_LUSER = su - \$(LUSER) -c -LUSER_HOME = /home/\$(LUSER) -PRT_DU = echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n" -PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) / \`\n" - -export PATH := \${PATH}:/usr/sbin - -include makefile-functions - -EOF -) > $MKFILE + wrt_Makefile_header # Add chroot commands if [ "$METHOD" = "chroot" ] ; then CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`" chroot=`cat chroot/*chroot* | \ sed -e "s@chroot@$CHROOT_LOC@" \ - -e '/#!\/tools\/bin\/bash/d' \ + -e '/#!\/bin\/bash/d' \ -e '/^export/d' \ -e '/^logout/d' \ -e 's@ \\\@ @g' | \ @@ -1170,8 +781,9 @@ EOF -e 's|\\$|&&|g' \ -e 's|exit||g' \ -e 's|$| -c|' \ - -e 's|"$$CLFS"|$(MOUNT_PT)|'\ - -e 's|set -e||'` + -e 's|"$${CLFS}"|$(MOUNT_PT)|'\ + -e 's|set -e||' \ + -e 's|set +h||'` echo -e "CHROOT1= $chroot\n" >> $MKFILE fi @@ -1181,8 +793,10 @@ if [[ "${METHOD}" = "chroot" ]]; then ( cat << EOF -all: ck_UID mk_SETUP mk_CROSS mk_SUDO mk_SYSTOOLS create-sbu_du-report mk_BLFS_TOOL +all: ck_UID mk_SETUP mk_CROSS mk_SUDO mk_SYSTOOLS create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL @sudo make do-housekeeping + @echo "$VERSION - jhalfs build" > clfs-release && \\ + sudo mv clfs-release \$(MOUNT_PT)/etc @\$(call echo_finished,$VERSION) ck_UID: @@ -1196,53 +810,62 @@ ck_UID: #---------------AS ROOT mk_SETUP: @\$(call echo_SU_request) - @sudo make SETUP + @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP @touch \$@ #---------------AS LUSER mk_CROSS: mk_SETUP @\$(call echo_PHASE,Cross and Temporary Tools) - @(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make AS_LUSER" ) + @(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) AS_LUSER" ) @sudo make restore-luser-env @touch \$@ mk_SUDO: mk_CROSS - @sudo make SUDO + @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO @touch \$@ -# -# The convoluted piece of code below is necessary to provide 'make' with a valid shell in the -# chroot environment. (Unless someone knows a different way) -# Manually create the /bin directory and provide link to the /tools dir. -# Also change the original symlink creation to include (f)orce to prevent failure due to -# pre-existing links. #---------------CHROOT JAIL mk_SYSTOOLS: mk_SUDO - @if [ ! -e \$(MOUNT_PT)/bin ]; then \\ - mkdir \$(MOUNT_PT)/bin; \\ - cd \$(MOUNT_PT)/bin && \\ - ln -svf /tools/bin/bash bash; ln -sf bash sh; \\ - sudo chown -R 0:0 \$(MOUNT_PT)/bin; \\ - fi; - @sudo sed -e 's|^ln -sv |ln -svf |' -i \$(CMDSDIR)/chroot/082-createfiles @\$(call echo_CHROOT_request) @\$(call echo_PHASE, CHROOT JAIL ) - @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make CHROOT_JAIL") + @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) PREP_CHROOT_JAIL") + @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT_JAIL") @touch \$@ -mk_BLFS_TOOL: mk_SYSTOOLS - @\$(call echo_PHASE,Building BLFS-TOOLS); \\ +mk_CUSTOM_TOOLS: create-sbu_du-report + @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\ + \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\ + sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\ + (sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\ + fi; + @touch \$@ + +mk_BLFS_TOOL: mk_CUSTOM_TOOLS @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\ + \$(call sh_echo_PHASE,Building BLFS_TOOL); \\ sudo mkdir -p $BUILDDIR$TRACKING_DIR; \\ - sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BLFS_TOOL"; \\ - fi + sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BLFS_TOOL"; \\ + fi; @touch \$@ -SETUP: $host_prep -AS_LUSER: $cross_tools $temptools -SUDO: $orphan_scripts -CHROOT_JAIL: ${chroottools}${boottools} $testsuitetools $basicsystem $bootscripttools $bootabletools -BLFS_TOOL: $blfs_tool +SETUP: $host_prep +AS_LUSER: $cross_tools $temptools +SUDO: $orphan_scripts +PREP_CHROOT_JAIL: SHELL=/tools/bin/bash +PREP_CHROOT_JAIL: ${chroottools} +CHROOT_JAIL: SHELL=/tools/bin/bash +CHROOT_JAIL: $testsuitetools $basicsystem $bootscripttools $bootabletools +CUSTOM_TOOLS: $custom_list +BLFS_TOOL: $blfs_tool + + +create-sbu_du-report: mk_SYSTOOLS + @\$(call echo_message, Building) + @if [ "\$(ADD_REPORT)" = "y" ]; then \\ + ./create-sbu_du-report.sh logs $VERSION; \\ + \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\ + fi; + @touch \$@ do-housekeeping: @-umount \$(MOUNT_PT)/dev/pts @@ -1253,27 +876,12 @@ do-housekeeping: @-rm /tools /cross-tools @-if [ ! -f luser-exist ]; then \\ userdel \$(LUSER); \\ - rm -rf /home/\$(LUSER); \\ + rm -rf \$(LUSER_HOME); \\ fi; EOF ) >> $MKFILE - # Add SBU-disk_usage report target - echo "create-sbu_du-report:" >> $MKFILE - if [[ "$REPORT" = "y" ]] ; then -( - cat << EOF - @\$(call echo_message, Building) - @./create-sbu_du-report.sh logs $VERSION - @\$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report) - @touch \$@ - -EOF -) >> $MKFILE - else echo -e "\t@true\n" >> $MKFILE; fi - - fi ################### BOOT ##################### @@ -1287,7 +895,8 @@ all: ck_UID mk_SETUP mk_CROSS mk_SUDO @sudo make do-housekeeping @\$(call echo_boot_finished,$VERSION) -makesys: mk_FINAL mk_BLFS_TOOL +makesys: mk_FINAL mk_CUSTOM_TOOLS mk_BLFS_TOOL + @echo "$VERSION - jhalfs build" > /etc/clfs-release @\$(call echo_finished,$VERSION) @@ -1307,46 +916,56 @@ ck_UID: mk_SETUP: @\$(call echo_SU_request) - @sudo make SETUP + @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP @touch \$@ #---------------AS LUSER mk_CROSS: mk_SETUP @\$(call echo_PHASE,Cross Tool) - @(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make AS_LUSER" ) + @(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) AS_LUSER" ) @touch \$@ mk_SUDO: mk_CROSS - @sudo make SUDO + @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO @touch \$@ #---------------AS ROOT mk_FINAL: @\$(call echo_PHASE,Final System) - @( make AS_ROOT ) + @( source /root/.bash_profile && make BREAKPOINT=\$(BREAKPOINT) AS_ROOT ) @touch \$@ -mk_BLFS_TOOL: mk_FINAL - @\$(call echo_PHASE,Building BLFS-TOOLS) +mk_CUSTOM_TOOLS: mk_FINAL + @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\ + \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\ + mkdir -p ${TRACKING_DIR}; \\ + ( source /root/.bash_profile && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS ); \\ + fi; + @touch \$@ + +mk_BLFS_TOOL: mk_CUSTOM_TOOLS @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\ + \$(call sh_echo_PHASE,Building BLFS_TOOL); \\ mkdir -p $TRACKING_DIR; \\ - make BLFS_TOOL; \\ + ( source /root/.bash_profile && make BREAKPOINT=\$(BREAKPOINT) BLFS_TOOL ); \\ fi @touch \$@ -SETUP: $host_prep -AS_LUSER: $cross_tools $temptools ${chroottools}${boottools} -SUDO: $orphan_scripts -AS_ROOT: $testsuitetools $basicsystem $bootscripttools $bootabletools -BLFS_TOOL: $blfs_tool +SETUP: $host_prep +AS_LUSER: $cross_tools $temptools ${boottools} +SUDO: $orphan_scripts +AS_ROOT: SHELL=/tools/bin/bash +AS_ROOT: $testsuitetools $basicsystem $bootscripttools $bootabletools +CUSTOM_TOOLS: $custom_list +BLFS_TOOL: $blfs_tool do-housekeeping: @-rm /tools /cross-tools @-if [ ! -f luser-exist ]; then \\ userdel \$(LUSER); \\ - rm -rf /home/\$(LUSER); \\ + rm -rf \$(LUSER_HOME); \\ fi; EOF @@ -1358,13 +977,13 @@ fi restore-luser-env: @\$(call echo_message, Building) - @if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ - mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\ + @if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\ + mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\ fi; - @if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ - mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\ + @if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\ + mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\ fi; - @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\ + @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* && \\ touch \$@ && \\ echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ echo --------------------------------------------------------------------------------\$(WHITE) diff --git a/CLFS2/clfs2.xsl b/CLFS2/clfs2.xsl index 75bfda4..76fa0f0 100644 --- a/CLFS2/clfs2.xsl +++ b/CLFS2/clfs2.xsl @@ -66,10 +66,11 @@ - #!/bin/sh + #!/bin/bash set +h - set -e + set -e + cd $PKGDIR diff --git a/CLFS2/master.sh b/CLFS2/master.sh old mode 100755 new mode 100644 index 3e2b328..5df8f26 --- a/CLFS2/master.sh +++ b/CLFS2/master.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # $Id$ ################################### @@ -17,59 +17,42 @@ host_prep_Makefiles() { # Initialization of the system CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")" ( cat << EOF -023-creatingtoolsdir: - @\$(call echo_message, Building) - @if [ ! -d \$(MOUNT_PT)/sources ]; then \\ - mkdir \$(MOUNT_PT)/sources; \\ - fi; - @chmod a+wt \$(MOUNT_PT)/sources - @touch \$@ && \\ - echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ - echo --------------------------------------------------------------------------------\$(WHITE) -025-addinguser: 023-creatingtoolsdir +025-addinguser: @\$(call echo_message, Building) - @if [ ! -d /home/\$(LUSER) ]; then \\ + @if [ ! -d \$(LUSER_HOME) ]; then \\ groupadd \$(LGROUP); \\ useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\ else \\ touch luser-exist; \\ fi; - @chown -R \$(LUSER) \$(MOUNT_PT) && \\ - chown \$(LUSER) \$(MOUNT_PT)/sources - @touch \$@ && \\ - echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ - echo --------------------------------------------------------------------------------\$(WHITE) + @\$(call housekeeping) 026-settingenvironment: 025-addinguser @\$(call echo_message, Building) - @if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ - mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\ + @if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\ + mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\ fi; - @if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ - mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\ + @if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\ + mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\ fi; - @echo "set +h" > /home/\$(LUSER)/.bashrc && \\ - echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\ - echo "CLFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\ - echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\ - echo "PATH=\$(MOUNT_PT)/cross-tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\ - echo "export CLFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\ - echo "" >> /home/\$(LUSER)/.bashrc && \\ - echo "unset CFLAGS" >> /home/\$(LUSER)/.bashrc && \\ - echo "unset CXXFLAGS" >> /home/\$(LUSER)/.bashrc && \\ - echo "" >> /home/\$(LUSER)/.bashrc && \\ - echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/\$(LUSER)/.bashrc && \\ - echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/\$(LUSER)/.bashrc && \\ - echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/\$(LUSER)/.bashrc && \\ - echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc - @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\ + @echo "set +h" > \$(LUSER_HOME)/.bashrc && \\ + echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\ + echo "CLFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\ + echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\ + echo "PATH=\$(MOUNT_PT)/cross-tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\ + echo "export CLFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\ + echo "" >> \$(LUSER_HOME)/.bashrc && \\ + echo "unset CFLAGS" >> \$(LUSER_HOME)/.bashrc && \\ + echo "unset CXXFLAGS" >> \$(LUSER_HOME)/.bashrc && \\ + echo "" >> \$(LUSER_HOME)/.bashrc && \\ + echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> \$(LUSER_HOME)/.bashrc && \\ + echo "export CLFS_TARGET=\"${TARGET}\"" >> \$(LUSER_HOME)/.bashrc && \\ + echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc + @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\ touch envars && \\ - chown \$(LUSER):\$(LGROUP) envars && \\ - chmod -R a+wt \$(MOUNT_PT) - @touch \$@ && \\ - echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ - echo --------------------------------------------------------------------------------\$(WHITE) + chown \$(LUSER):\$(LGROUP) envars + @\$(call housekeeping) 027-create-directories: 026-settingenvironment @\$(call echo_message, Building) @@ -87,10 +70,7 @@ cat << EOF @for dir in \$(MOUNT_PT)/usr{,/local}; do \\ ln -s share/{man,doc,info} \$\$dir ; \\ done - - @touch \$@ && \\ - echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ - echo --------------------------------------------------------------------------------\$(WHITE) + @\$(call housekeeping) 028-creating-sysfile: 027-create-directories @\$(call echo_message, Building) @@ -116,16 +96,15 @@ cat << EOF @touch \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/{btmp,lastlog,wtmp} @chmod 664 \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/lastlog - @chown -R \$(LUSER) \$(MOUNT_PT) - - @touch \$@ && \\ - echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ - echo --------------------------------------------------------------------------------\$(WHITE) + @chown -R \$(LUSER) \$(MOUNT_PT) && \\ + chmod -R a+w \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\ + chmod -R a+w \$(SRCSDIR) + @\$(call housekeeping) EOF ) >> $MKFILE.tmp - host_prep=" 023-creatingtoolsdir 025-addinguser 026-settingenvironment 027-create-directories 028-creating-sysfile" + host_prep=" 025-addinguser 026-settingenvironment 027-create-directories 028-creating-sysfile" } @@ -139,18 +118,9 @@ cross_tools_Makefiles() { # this_script=`basename $file` # # Skip this script... - # NOTE.. the book indicated you only needed to install groff or file if the host - # had older versions. The packages would be installed in the target directory - # and not the host. case $this_script in *cflags* | *variables* ) # work done in host_prep_Makefiles continue ;; - *file ) FileVer=`file --version | head -n1 | cut -d " " -f1` - [[ "$FileVer" = "file-4.17" ]] && continue - ;; - *groff) GroffVer=`groff --version | head -n1 | cut -d " " -f4` - [[ "$GroffVer" = "1.19.2" ]] && continue - ;; *) ;; esac @@ -248,6 +218,11 @@ final_system_Makefiles() { # # # If $pkg_tarball isn't empty, we've got a package... if [ "$pkg_tarball" != "" ] ; then + # Touch timestamp file if installed files logs will be created. + # But only for the firt build when running iterative builds. + if [ "${INSTALL_LOG}" = "y" ] ; then + LUSER_wrt_TouchTimestamp + fi LUSER_wrt_unpack "$pkg_tarball" # If using optimizations, write the instructions [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name" @@ -255,7 +230,14 @@ final_system_Makefiles() { # # LUSER_wrt_RunAsUser "${file}" # - [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}" + # Write installed files log and remove the build directory(ies) + # except if the package build fails. + if [ "$pkg_tarball" != "" ] ; then + LUSER_RemoveBuildDirs "${name}" + if [ "${INSTALL_LOG}" = "y" ] ; then + LUSER_wrt_LogNewFiles "$name" + fi + fi # # Include a touch of the target name so make can check if it's already been made. wrt_touch @@ -313,11 +295,21 @@ bootscripts_Makefiles() { # LUSER_wrt_target "${this_script}" "$PREV" # # If $pkg_tarball isn't empty, we've got a package... - [[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball" + if [ "$pkg_tarball" != "" ] ; then + LUSER_wrt_unpack "$pkg_tarball" + if [ "${INSTALL_LOG}" = "y" ] ; then + LUSER_wrt_TouchTimestamp + fi + fi # LUSER_wrt_RunAsUser "${file}" # - [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}" + if [ "$pkg_tarball" != "" ] ; then + LUSER_RemoveBuildDirs "${name}" + if [ "${INSTALL_LOG}" = "y" ] ; then + LUSER_wrt_LogNewFiles "$name" + fi + fi # # Include a touch of the target name so make can check if it's already been made. wrt_touch @@ -359,7 +351,7 @@ bootable_Makefiles() { # # NOTE: new makfile format forces the last script, *chowning, into a separate # phase. case ${this_script} in - *chowning) chowning=${this_script} ;; + *chowning) chowning=" ${this_script}" ;; *) bootable="$bootable $this_script" ;; esac # @@ -381,7 +373,12 @@ bootable_Makefiles() { # LUSER_wrt_target "${this_script}" "$PREV" # # If $pkg_tarball isn't empty, we've got a package... - [[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball" + if [ "$pkg_tarball" != "" ] ; then + LUSER_wrt_unpack "$pkg_tarball" + if [ "${INSTALL_LOG}" = "y" ] ; then + LUSER_wrt_TouchTimestamp + fi + fi # # Select a script execution method case $this_script in @@ -391,14 +388,19 @@ bootable_Makefiles() { # LUSER_wrt_RunAsUser "${file}" fi ;; - *chowning) wrt_RunAsRoot "${this_script}" "${file}" + *chowning) wrt_RunAsRoot "${file}" ;; *) LUSER_wrt_RunAsUser "${file}" ;; esac # # Housekeeping...remove any build directory(ies) except if the package build fails. - [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}" + if [ "$pkg_tarball" != "" ] ; then + LUSER_RemoveBuildDirs "${name}" + if [ "${INSTALL_LOG}" = "y" ] ; then + LUSER_wrt_LogNewFiles "$name" + fi + fi # # Include a touch of the target name so make can check if it's already been made. wrt_touch @@ -429,43 +431,22 @@ build_Makefile() { # Construct a Makefile from the book scripts final_system_Makefiles # $basicsystem bootscripts_Makefiles # $bootscripttools bootable_Makefiles # $bootable + # Add the CUSTOM_TOOLS targets, if needed + [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target + # Add the BLFS_TOOL targets, if needed. + [[ "$BLFS_TOOL" = "y" ]] && wrt_blfs_tool_targets # Add a header, some variables and include the function file # to the top of the real Makefile. -( - cat << EOF -$HEADER - -SRC = /sources -MOUNT_PT = $BUILDDIR -PKG_LST = $PKG_LST -LUSER = $LUSER -LGROUP = $LGROUP -SCRIPT_ROOT = $SCRIPT_ROOT - -BASEDIR = \$(MOUNT_PT) -SRCSDIR = \$(BASEDIR)/sources -CMDSDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$PROGNAME-commands -LOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/logs -TESTLOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/test-logs - -SU_LUSER = su - \$(LUSER) -c -PRT_DU = echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n" -LUSER_HOME = /home/\$(LUSER) - -export PATH := \${PATH}:/usr/sbin - -include makefile-functions - -EOF -) > $MKFILE + wrt_Makefile_header # Drop in the main target 'all:' and the chapter targets with each sub-target # as a dependency. ( cat << EOF -all: ck_UID mk_SETUP mk_LUSER mk_ROOT create-sbu_du-report +all: ck_UID mk_SETUP mk_LUSER create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL mk_ROOT + @sudo make restore-luser-env @sudo make do-housekeeping @\$(call echo_finished,$VERSION) @@ -479,35 +460,61 @@ ck_UID: mk_SETUP: @\$(call echo_SU_request) - @sudo make SETUP + @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP @touch \$@ mk_LUSER: mk_SETUP @\$(call echo_SULUSER_request) - @(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make LUSER" ) - @sudo make restore-luser-env + @(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) LUSER" ) @touch \$@ -mk_ROOT: - @sudo make ROOT +mk_CUSTOM_TOOLS: create-sbu_du-report + @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\ + \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\ + (sudo \$(SU_LUSER) "mkdir -p $BUILDDIR$TRACKING_DIR"); \\ + (sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\ + fi; @touch \$@ -SETUP: $host_prep +mk_BLFS_TOOL: mk_CUSTOM_TOOLS + @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\ + \$(call sh_echo_PHASE,Building BLFS_TOOL); \\ + (sudo \$(SU_LUSER) "mkdir -p $BUILDDIR$TRACKING_DIR"); \\ + (sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BLFS_TOOL"); \\ + fi; + @touch \$@ -LUSER: $cross_tools $basicsystem $bootscripttools $bootable +mk_ROOT: create-sbu_du-report + @\$(call echo_SU_request) + @echo "$VERSION-sysroot - jhalfs build" > clfs-release && \\ + sudo mv clfs-release \$(MOUNT_PT)/etc + @sudo make BREAKPOINT=\$(BREAKPOINT) ROOT + @touch \$@ -ROOT: $chowning +SETUP: $host_prep +LUSER: $cross_tools $basicsystem $bootscripttools $bootable +CUSTOM_TOOLS: $custom_list +BLFS_TOOL: $blfs_tool +ROOT: $chowning +create-sbu_du-report: mk_LUSER + @\$(call echo_message, Building) + @if [ "\$(ADD_REPORT)" = "y" ]; then \\ + ./create-sbu_du-report.sh logs $VERSION; \\ + \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\ + fi; + @touch \$@ + restore-luser-env: @\$(call echo_message, Building) - @if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ - mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\ + @if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\ + mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\ fi; - @if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ - mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\ + @if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\ + mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\ fi; - @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\ + @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* && \\ touch \$@ && \\ echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ echo --------------------------------------------------------------------------------\$(WHITE) @@ -515,31 +522,15 @@ restore-luser-env: do-housekeeping: @-if [ ! -f luser-exist ]; then \\ userdel \$(LUSER); \\ - rm -rf /home/\$(LUSER); \\ + rm -rf \$(LUSER_HOME); \\ fi; EOF ) >> $MKFILE - # Add SBU-disk_usage report target - echo "create-sbu_du-report:" >> $MKFILE - if [[ "$REPORT" = "y" ]] ; then -( - cat << EOF - @\$(call echo_message, Building) - @./create-sbu_du-report.sh logs $VERSION - @\$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report) - @touch \$@ - - -EOF -) >> $MKFILE - else echo -e "\t@true\n\n" >> $MKFILE; fi - # Bring over the items from the Makefile.tmp cat $MKFILE.tmp >> $MKFILE rm $MKFILE.tmp echo "Creating Makefile... ${BOLD}DONE${OFF}" } - diff --git a/CLFS3/clfs3.xsl b/CLFS3/clfs3.xsl new file mode 100644 index 0000000..e0ec0f9 --- /dev/null +++ b/CLFS3/clfs3.xsl @@ -0,0 +1,154 @@ + + + %general-entities; +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 00 + + + + 0 + + + + + + + + + + #!/bin/bash set +h set -e + + + + + + + cd $PKGDIR + + + exit + + + + + + + + + + + + + + + + + + + + tar.* + + + + + + + + + + export LANG= + + + + + + + + + make mrproper + cp -v ../kernel-config .config + + + + + + + || true + + + + + + + + + + + + + + + + + + + **EDITME + + EDITME** + + + + + diff --git a/CLFS3/master.sh b/CLFS3/master.sh new file mode 100644 index 0000000..9f500dc --- /dev/null +++ b/CLFS3/master.sh @@ -0,0 +1,586 @@ +#!/bin/bash +# $Id$ + +################################### +### FUNCTIONS ### +################################### + + +#----------------------------# +host_prep_Makefiles() { # Initialization of the system +#----------------------------# + local CLFS_HOST + + echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files ( SETUP ) ${R_arrow}" + + # defined here, only for ease of reading + CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")" +( +cat << EOF + +025-addinguser: + @\$(call echo_message, Building) + @if [ ! -d \$(LUSER_HOME) ]; then \\ + groupadd \$(LGROUP); \\ + useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\ + else \\ + touch luser-exist; \\ + fi; + @\$(call housekeeping) + +026-settingenvironment: 025-addinguser + @\$(call echo_message, Building) + @if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\ + mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\ + fi; + @if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\ + mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\ + fi; + @echo "set +h" > \$(LUSER_HOME)/.bashrc && \\ + echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\ + echo "CLFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\ + echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\ + echo "PATH=\$(MOUNT_PT)/cross-tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\ + echo "export CLFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\ + echo "" >> \$(LUSER_HOME)/.bashrc && \\ + echo "unset CFLAGS" >> \$(LUSER_HOME)/.bashrc && \\ + echo "unset CXXFLAGS" >> \$(LUSER_HOME)/.bashrc && \\ + echo "" >> \$(LUSER_HOME)/.bashrc && \\ + echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> \$(LUSER_HOME)/.bashrc && \\ + echo "export CLFS_TARGET=\"${TARGET}\"" >> \$(LUSER_HOME)/.bashrc && \\ + echo "export CLFS_MIPS_LEVEL=\"${MIPS_LEVEL}\"" >> \$(LUSER_HOME)/.bashrc && \\ + echo "export BUILD=\"${ABI}\"" >> \$(LUSER_HOME)/.bashrc && \\ + echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc + @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\ + touch envars && \\ + chown \$(LUSER):\$(LGROUP) envars + @\$(call housekeeping) + +027-create-directories: 026-settingenvironment + @\$(call echo_message, Building) + + @mkdir -p \$(MOUNT_PT)/{bin,boot,dev,{etc/,}opt,home,lib,mnt} + @mkdir -p \$(MOUNT_PT)/{proc,media/{floppy,cdrom},sbin,srv,sys} + @mkdir -p \$(MOUNT_PT)/var/{lock,log,mail,run,spool} + @mkdir -p \$(MOUNT_PT)/var/{opt,cache,lib/{misc,locate},local} + @install -d -m 0750 \$(MOUNT_PT)/root + @install -d -m 1777 \$(MOUNT_PT){/var,}/tmp + @mkdir -p \$(MOUNT_PT)/usr/{,local/}{bin,include,lib,sbin,src} + @mkdir -p \$(MOUNT_PT)/usr/{,local/}share/{doc,info,locale,man} + @mkdir -p \$(MOUNT_PT)/usr/{,local/}share/{misc,terminfo,zoneinfo} + @mkdir -p \$(MOUNT_PT)/usr/{,local/}share/man/man{1,2,3,4,5,6,7,8} + @for dir in \$(MOUNT_PT)/usr{,/local}; do \\ + ln -s share/{man,doc,info} \$\$dir ; \\ + done + @\$(call housekeeping) + +028-creating-sysfile: 027-create-directories + @\$(call echo_message, Building) + + @touch \$(MOUNT_PT)/etc/mtab + @echo "root::0:0:root:/root:/bin/ash" >> \$(MOUNT_PT)/etc/passwd + @echo "root:x:0:" >> \$(MOUNT_PT)/etc/group + @echo "bin:x:1:" >> \$(MOUNT_PT)/etc/group + @echo "sys:x:2:" >> \$(MOUNT_PT)/etc/group + @echo "kmem:x:3" >> \$(MOUNT_PT)/etc/group + @echo "tty:x:4:" >> \$(MOUNT_PT)/etc/group + @echo "tape:x:5:" >> \$(MOUNT_PT)/etc/group + @echo "daemon:x:6:" >> \$(MOUNT_PT)/etc/group + @echo "floppy:x:7:" >> \$(MOUNT_PT)/etc/group + @echo "disk:x:8:" >> \$(MOUNT_PT)/etc/group + @echo "lp:x:9:" >> \$(MOUNT_PT)/etc/group + @echo "dialout:x:10:" >> \$(MOUNT_PT)/etc/group + @echo "audio:x:11:" >> \$(MOUNT_PT)/etc/group + @echo "video:x:12:" >> \$(MOUNT_PT)/etc/group + @echo "utmp:x:13:" >> \$(MOUNT_PT)/etc/group + @echo "usb:x:14:" >> \$(MOUNT_PT)/etc/group + @echo "cdrom:x:15:" >> \$(MOUNT_PT)/etc/group + + @touch \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/{btmp,lastlog,wtmp} + @chmod 664 \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/lastlog + @chown -R \$(LUSER) \$(MOUNT_PT) && \\ + chmod -R a+w \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\ + chmod -R a+w \$(SRCSDIR) + @\$(call housekeeping) + +EOF +) >> $MKFILE.tmp + + host_prep=" 025-addinguser 026-settingenvironment 027-create-directories 028-creating-sysfile" +} + +#-----------------------------# +systemprep_Makefiles() { # +#-----------------------------# + echo "${tab_}${GREEN}Processing... ${L_arrow}system prep tools ( LUSER ) ${R_arrow}" + + for file in systemprep/* ; do + # Keep the script file name + this_script=`basename $file` + + # Set the dependency for the first target. + if [ -z $PREV ] ; then PREV=028-creating-sysfile ; fi + + # First append each name of the script files to a list (this will become + # the names of the targets in the Makefile) + cross_tools="$cross_tools $this_script" + + # Grab the name of the target (minus the -headers or -cross in the case of gcc + # and binutils in chapter 5) + name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'` + + pkg_tarball=$(get_package_tarball_name $name) + #--------------------------------------------------------------------# + # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # + #--------------------------------------------------------------------# + # + # Drop in the name of the target on a new line, and the previous target + # as a dependency. Also call the echo_message function. + LUSER_wrt_target "${this_script}" "$PREV" + # + # If $pkg_tarball isn't empty, we've got a package... + if [ "$pkg_tarball" != "" ] ; then + LUSER_wrt_unpack "$pkg_tarball" + fi + # + LUSER_wrt_RunAsUser "${file}" + # + [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}" + # + # Include a touch of the target name so make can check if it's already been made. + wrt_touch + # + #--------------------------------------------------------------------# + # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # + #--------------------------------------------------------------------# + # + # Keep the script file name for Makefile dependencies. + PREV=$this_script + + done # for file in .... +} + + +#-----------------------------# +cross_tools_Makefiles() { # +#-----------------------------# + echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools ( LUSER ) ${R_arrow}" + + for file in cross-tools/* ; do + # Keep the script file name + this_script=`basename $file` + # + # Skip this script... + # NOTE.. the book indicated you only needed to install groff or file if the host + # had older versions. The packages would be installed in the target directory + # and not the host. + case $this_script in + *cflags* | *variables* | *abi | *toolchain*) # work done in host_prep_Makefiles + continue ;; + *) ;; + esac + + # + # Set the dependency for the first target. + if [ -z $PREV ] ; then PREV=028-creating-sysfile ; fi + + # First append each name of the script files to a list (this will become + # the names of the targets in the Makefile) + cross_tools="$cross_tools $this_script" + + # Grab the name of the target (minus the -headers or -cross in the case of gcc + # and binutils in chapter 5) + name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \ + -e 's@-static@@' \ + -e 's@-final@@' \ + -e 's@-64@@' \ + -e 's@-n32@@'` + case $name in + uclibc*) name="uClibc" ;; + esac + pkg_tarball=$(get_package_tarball_name $name) + #--------------------------------------------------------------------# + # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # + #--------------------------------------------------------------------# + # + # Drop in the name of the target on a new line, and the previous target + # as a dependency. Also call the echo_message function. + LUSER_wrt_target "${this_script}" "$PREV" + # + # If $pkg_tarball isn't empty, we've got a package... + if [ "$pkg_tarball" != "" ] ; then + LUSER_wrt_unpack "$pkg_tarball" + # Touch timestamp file if installed files logs will be created. + if [ "${INSTALL_LOG}" = "y" ] ; then + LUSER_wrt_TouchTimestamp + fi + # If using optimizations, write the instructions + [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name" + fi + # + LUSER_wrt_RunAsUser "${file}" + # + # Write installed files log and remove the build directory(ies) + # except if the package build fails. + if [ "$pkg_tarball" != "" ] ; then + LUSER_RemoveBuildDirs "${name}" + if [ "${INSTALL_LOG}" = "y" ] ; then + LUSER_wrt_LogNewFiles "$name" + fi + fi + # + # Include a touch of the target name so make can check if it's already been made. + wrt_touch + # + #--------------------------------------------------------------------# + # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # + #--------------------------------------------------------------------# + # + # Keep the script file name for Makefile dependencies. + PREV=$this_script + + done # for file in .... +} + + + +#-----------------------------# +final_system_Makefiles() { # +#-----------------------------# + echo "${tab_}${GREEN}Processing... ${L_arrow}final system ( LUSER ) ${R_arrow}" + + for file in final-system/* ; do + # Keep the script file name + this_script=`basename $file` + + # Grab the name of the target, strip id number, XXX-script + name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \ + -e 's@temp-@@' \ + -e 's@-64bit@@' \ + -e 's@-64@@' \ + -e 's@64@@' \ + -e 's@n32@@'` + + # Find the version of the command files, if it corresponds with the building of + # a specific package. + pkg_tarball=$(get_package_tarball_name $name) + + # Append each name of the script files to a list (this will become + # the names of the targets in the Makefile + basicsystem="$basicsystem ${this_script}" + + #--------------------------------------------------------------------# + # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # + #--------------------------------------------------------------------# + # + # Drop in the name of the target on a new line, and the previous target + # as a dependency. Also call the echo_message function. + LUSER_wrt_target "${this_script}" "$PREV" + # + # If $pkg_tarball isn't empty, we've got a package... + if [ "$pkg_tarball" != "" ] ; then + # Touch timestamp file if installed files logs will be created. + if [ "${INSTALL_LOG}" = "y" ] ; then + LUSER_wrt_TouchTimestamp + fi + LUSER_wrt_unpack "$pkg_tarball" + # If using optimizations, write the instructions + [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name" + fi + # + LUSER_wrt_RunAsUser "${file}" + # + # Write installed files log and remove the build directory(ies) + # except if the package build fails. + if [ "$pkg_tarball" != "" ] ; then + LUSER_RemoveBuildDirs "${name}" + if [ "${INSTALL_LOG}" = "y" ] ; then + LUSER_wrt_LogNewFiles "$name" + fi + fi + # + # Include a touch of the target name so make can check if it's already been made. + wrt_touch + # + #--------------------------------------------------------------------# + # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # + #--------------------------------------------------------------------# + # + # Keep the script file name for Makefile dependencies. + PREV=${this_script} + done # for file in final-system/* ... +} + + + +#-----------------------------# +bootscripts_Makefiles() { # +#-----------------------------# + echo "${tab_}${GREEN}Processing... ${L_arrow}bootscripts ( LUSER ) ${R_arrow}" + + for file in bootscripts/* ; do + # Keep the script file name + this_script=`basename $file` + + case $this_script in + *console*) continue ;; # Use the files that came with the bootscripts + *network*) continue ;; # Manually create these files + *) ;; + esac + + # First append each name of the script files to a list (this will become + # the names of the targets in the Makefile + bootscripttools="$bootscripttools $this_script" + + # Grab the name of the target, strip id number, XXX-script + name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\ + -e 's@-64bit@@' \ + -e 's@-64@@' \ + -e 's@64@@' \ + -e 's@n32@@'` + case $name in + *bootscripts*) name=clfs-embedded-bootscripts ;; + esac + + pkg_tarball=$(get_package_tarball_name $name) + + #--------------------------------------------------------------------# + # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # + #--------------------------------------------------------------------# + # + # Drop in the name of the target on a new line, and the previous target + # as a dependency. Also call the echo_message function. + LUSER_wrt_target "${this_script}" "$PREV" + # + # If $pkg_tarball isn't empty, we've got a package... + if [ "$pkg_tarball" != "" ] ; then + LUSER_wrt_unpack "$pkg_tarball" + if [ "${INSTALL_LOG}" = "y" ] ; then + LUSER_wrt_TouchTimestamp + fi + fi + # + LUSER_wrt_RunAsUser "${file}" + # + if [ "$pkg_tarball" != "" ] ; then + LUSER_RemoveBuildDirs "${name}" + if [ "${INSTALL_LOG}" = "y" ] ; then + LUSER_wrt_LogNewFiles "$name" + fi + fi + # + # Include a touch of the target name so make can check if it's already been made. + wrt_touch + # + #--------------------------------------------------------------------# + # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # + #--------------------------------------------------------------------# + # + # Keep the script file name for Makefile dependencies. + PREV=$this_script + + done # for file in bootscripts/* ... + +} + + +#-----------------------------# +bootable_Makefiles() { # +#-----------------------------# + echo "${tab_}${GREEN}Processing... ${L_arrow}make bootable ( LUSER ) ${R_arrow}" + + for file in bootable/* ; do + # Keep the script file name + this_script=`basename $file` + + # A little housekeeping on the scripts + case $this_script in + *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;; + *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;; + *kernel) # if there is no kernel config file do not build the kernel + [[ -z $CONFIG ]] && continue + # Copy the config file to /sources with a standardized name + cp $CONFIG $BUILDDIR/sources/kernel-config + ;; + esac + # + # First append each name of the script files to a list (this will become + # the names of the targets in the Makefile + # NOTE: new makfile format forces the last script, *chowning, into a separate + # phase. + case ${this_script} in + *chowning) chowning=${this_script} ;; + *) bootable="$bootable $this_script" ;; + esac + # + # Grab the name of the target, strip id number and misc words. + name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` + case $this_script in + *kernel*) name=linux + ;; + esac + + pkg_tarball=$(get_package_tarball_name $name) + + #--------------------------------------------------------------------# + # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # + #--------------------------------------------------------------------# + # + # Drop in the name of the target on a new line, and the previous target + # as a dependency. Also call the echo_message function. + LUSER_wrt_target "${this_script}" "$PREV" + # + # If $pkg_tarball isn't empty, we've got a package... + if [ "$pkg_tarball" != "" ] ; then + LUSER_wrt_unpack "$pkg_tarball" + if [ "${INSTALL_LOG}" = "y" ] ; then + LUSER_wrt_TouchTimestamp + fi + fi + # + # Select a script execution method + case $this_script in + *fstab*) if [[ -n "$FSTAB" ]]; then + LUSER_wrt_CopyFstab + else + LUSER_wrt_RunAsUser "${file}" + fi + ;; + *chowning) wrt_RunAsRoot "${file}" + ;; + *) LUSER_wrt_RunAsUser "${file}" + ;; + esac + # + # Housekeeping...remove any build directory(ies) except if the package build fails. + if [ "$pkg_tarball" != "" ] ; then + LUSER_RemoveBuildDirs "${name}" + if [ "${INSTALL_LOG}" = "y" ] ; then + LUSER_wrt_LogNewFiles "$name" + fi + fi + # + # Include a touch of the target name so make can check if it's already been made. + wrt_touch + # + #--------------------------------------------------------------------# + # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # + #--------------------------------------------------------------------# + # + # Keep the script file name for Makefile dependencies. + PREV=$this_script + + done + +} + + +#-----------------------------# +build_Makefile() { # Construct a Makefile from the book scripts +#-----------------------------# + echo "Creating Makefile... ${BOLD}START${OFF}" + + cd $JHALFSDIR/${PROGNAME}-commands + # Start with a clean Makefile.tmp file + >$MKFILE.tmp + + host_prep_Makefiles + [[ "${PLATFORM% -*}" = "WRT" ]] && systemprep_Makefiles # $cross_tools + cross_tools_Makefiles # $cross_tools + final_system_Makefiles # $basicsystem + bootscripts_Makefiles # $bootscripttools + bootable_Makefiles # $bootable + # Add the CUSTOM_TOOLS targets, if needed + [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target + + # Add a header, some variables and include the function file + # to the top of the real Makefile. + wrt_Makefile_header + + # Drop in the main target 'all:' and the chapter targets with each sub-target + # as a dependency. +( +cat << EOF + +all: ck_UID mk_SETUP mk_LUSER create-sbu_du-report mk_CUSTOM_TOOLS mk_ROOT + @sudo make restore-luser-env + @sudo make do-housekeeping + @\$(call echo_finished,$VERSION) + +ck_UID: + @if [ \`id -u\` = "0" ]; then \\ + echo "--------------------------------------------------"; \\ + echo "You cannot run this makefile from the root account"; \\ + echo "--------------------------------------------------"; \\ + exit 1; \\ + fi + +mk_SETUP: + @\$(call echo_SU_request) + @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP + @touch \$@ + +mk_LUSER: mk_SETUP + @\$(call echo_SULUSER_request) + @(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) LUSER" ) + @touch \$@ + +mk_CUSTOM_TOOLS: create-sbu_du-report + @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\ + \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\ + (sudo \$(SU_LUSER) "mkdir -p $BUILDDIR$TRACKING_DIR"); \\ + (sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\ + fi; + @touch \$@ + +mk_ROOT: + @\$(call echo_SU_request) + @echo "$VERSION-embedded - jhalfs build" > clfs-release && \\ + sudo mv clfs-release \$(MOUNT_PT)/etc + @sudo make BREAKPOINT=\$(BREAKPOINT) ROOT + @touch \$@ + + +SETUP: $host_prep +LUSER: $cross_tools $basicsystem $bootscripttools $bootable +CUSTOM_TOOLS: $custom_list +ROOT: $chowning + + +create-sbu_du-report: mk_LUSER + @\$(call echo_message, Building) + @if [ "\$(ADD_REPORT)" = "y" ]; then \\ + ./create-sbu_du-report.sh logs $VERSION; \\ + \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\ + fi; + @touch \$@ + +restore-luser-env: + @\$(call echo_message, Building) + @if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\ + mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\ + fi; + @if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\ + mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\ + fi; + @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* && \\ + touch \$@ && \\ + echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) + +do-housekeeping: + @-if [ ! -f luser-exist ]; then \\ + userdel \$(LUSER); \\ + rm -rf \$(LUSER_HOME); \\ + fi; + +EOF +) >> $MKFILE + + # Bring over the items from the Makefile.tmp + cat $MKFILE.tmp >> $MKFILE + rm $MKFILE.tmp + echo "Creating Makefile... ${BOLD}DONE${OFF}" + +} + diff --git a/Config.in b/Config.in index b4697de..a8235da 100644 --- a/Config.in +++ b/Config.in @@ -14,10 +14,10 @@ menu "--- BOOK Settings" bool "Cross-Compiled Linux From Scratch" config BOOK_CLFS2 - bool "Cross-Compiled Linux From Scratch (Version 2)" + bool "Cross-Compiled Linux From Scratch (Sysroot method)" -# config BOOK_CLFS3 -# bool "Cross-Compiled Linux From Scratch (Embedded Systems)" + config BOOK_CLFS3 + bool "Cross-Compiled Linux From Scratch (Embedded Systems)" config BOOK_HLFS bool "Hardened Linux From Scratch" @@ -31,7 +31,7 @@ menu "--- BOOK Settings" default "lfs" if BOOK_LFS default "clfs" if BOOK_CLFS default "clfs2" if BOOK_CLFS2 -# default "clfs3" if BOOK_CLFS3 + default "clfs3" if BOOK_CLFS3 default "hlfs" if BOOK_HLFS default "blfs" if BOOK_BLFS @@ -57,7 +57,7 @@ menu "--- BOOK Settings" #-- A local working copy config BRANCH - bool "Branch or stable book" if !BOOK_CLFS2 + bool "Branch or stable book" if !BOOK_CLFS2 && !BOOK_CLFS3 help #-- A supported SVN branch or stable released book endchoice @@ -83,9 +83,9 @@ menu "--- BOOK Settings" choice prompt "Target architecture" default ARCH_X86 - depends BOOK_CLFS || BOOK_CLFS2 + depends BOOK_CLFS || BOOK_CLFS2 || BOOK_CLFS3 help - #-- Choose a base architecture + #-- Choose the target system base architecture config ARCH_X86 bool "x86" @@ -94,118 +94,252 @@ menu "--- BOOK Settings" bool "mips" if !BOOK_CLFS2 config ARCH_PPC - bool "ppc" if !BOOK_CLFS2 + bool "ppc" if BOOK_CLFS config ARCH_SPARC - bool "sparc" if !BOOK_CLFS2 + bool "sparc" if BOOK_CLFS config ARCH_ALPHA - bool "alpha" if !BOOK_CLFS2 + bool "alpha" if !BOOK_CLFS3 config ARCH_ARM bool "arm" if !BOOK_CLFS + + config ARCH_HPPA + bool "hppa" if BOOK_CLFS2 + endchoice + + choice + prompt "Hardware Platform" + depends BOOK_CLFS3 && ARCH_MIPS + default PLATFORM_GENERIC + help + # Chose a destination platform + # Platform specific files will be included + + config PLATFORM_GENERIC + bool "Generic platform" + + config PLATFORM_WRT + bool "WRT - MIPS based wireless router" if ARCH_MIPS endchoice choice prompt "Library" - depends (BOOK_CLFS || BOOK_CLFS2) - default DATA_32 if !ARCH_ALPHA - default DATA_64 if ARCH_ALPHA + depends (BOOK_CLFS && !ARCH_ALPHA) || (BOOK_CLFS3 && ARCH_MIPS) + default DATA_32 + help + #-- Choose the target system libraries type config DATA_32 - bool "32-bit" if !ARCH_ALPHA + bool "32-bit" config DATA_64 - bool "64-bit" if !ARCH_PPC && !ARCH_ARM && !(BOOK_CLFS2 && ARCH_X86) + bool "64-bit" if !ARCH_PPC config DATA_MULTI - bool "multilib" if !ARCH_ALPHA && !ARCH_ARM && !(BOOK_CLFS2 && ARCH_X86) + bool "multilib" if !(BOOK_CLFS3 && ARCH_MIPS ) endchoice choice - prompt "Target" - depends (BOOK_CLFS || BOOK_CLFS2) && ((ARCH_X86 && DATA_32) || ARCH_MIPS) + prompt "Processor type" + depends (BOOK_CLFS || BOOK_CLFS2 || BOOK_CLFS3) && ((ARCH_X86 && !(DATA_64 || DATA_MULTI)) || ARCH_MIPS || ARCH_HPPA || ARCH_ALPHA || (ARCH_SPARC && (DATA_64 || DATA_MULTI)) || (ARCH_ARM && BOOK_CLFS3)) + help + #-- Choose the target system processor config PROC_i486 - bool "i486" if ARCH_X86 && DATA_32 + bool "486 Compatibles" if ARCH_X86 config PROC_i586 - bool "i586" if ARCH_X86 && DATA_32 + bool "Pentium, K6, 586 Compatibles" if ARCH_X86 config PROC_i686 - bool "i686" if ARCH_X86 && DATA_32 + bool "Pentium II, Pentium III, Pentium 4, Athlon, Duron" if ARCH_X86 config PROC_mipsel - bool "mips -little endian" if ARCH_MIPS + bool "MIPS Little Endian" if ARCH_MIPS config PROC_mips - bool "mips" if ARCH_MIPS + bool "MIPS Big Endian" if ARCH_MIPS + + config PROC_unknown + bool "Unknown" if ARCH_HPPA || ARCH_ALPHA + + config PROC_hppa1 + bool "PA 7000 Series" if ARCH_HPPA + + config PROC_hppa2 + bool "PA 8000 Series" if ARCH_HPPA + + config PROC_EV5 + bool "EV5 Series" if ARCH_ALPHA + + config PROC_EV56 + bool "EV56 Series" if ARCH_ALPHA + + config PROC_PCA56 + bool "PCA56 Series" if ARCH_ALPHA + + config PROC_PCA57 + bool "PCA57 Series" if ARCH_ALPHA + + config PROC_EV6 + bool "EV6 Series" if ARCH_ALPHA + + config PROC_EV67 + bool "EV67 Series" if ARCH_ALPHA + + config PROC_EV68 + bool "EV68 Series" if ARCH_ALPHA + + config PROC_ARM + bool "Generic arm, little endian" if ARCH_ARM + + config PROC_ARM5L + bool "Generic arm, version 5, little endian" if ARCH_ARM + + config PROC_ARM5B + bool "Generic arm, version 5, big endian" if ARCH_ARM + + config PROC_ULTRA1 + bool "UtraSparc" if ARCH_SPARC && (DATA_64 || DATA_MULTI) + + config PROC_ULTRA2 + bool "UtraSparc2" if ARCH_SPARC && (DATA_64 || DATA_MULTI) + + config PROC_ULTRA3 + bool "UtraSparc3" if ARCH_SPARC && (DATA_64 || DATA_MULTI) + endchoice + + choice + prompt "MIPS 64 ABI" + depends BOOK_CLFS3 && ARCH_MIPS && DATA_64 + default ABI_64 + help + #-- Choose the target system ABI to use + + config ABI_32 + bool "o32" + + config ABI_N32 + bool "n32" + + config ABI_64 + bool "n64" endchoice config TARGET string - depends DATA_32 - default "i486-pc-linux-gnu" if ARCH_X86 && PROC_i486 - default "i586-pc-linux-gnu" if ARCH_X86 && PROC_i586 - default "i686-pc-linux-gnu" if ARCH_X86 && PROC_i686 - default "mipsel-unknown-linux-gnu" if ARCH_MIPS && PROC_mipsel - default "mips-unknown-linux-gnu" if ARCH_MIPS && PROC_mips - default "powerpc-unknown-linux-gnu" if ARCH_PPC - default "sparc-unknown-linux-gnu" if ARCH_SPARC - default "arm-unknown-linux-gnu" if ARCH_ARM + default "i486-pc-linux-gnu" if !BOOK_CLFS3 && PROC_i486 + default "i586-pc-linux-gnu" if !BOOK_CLFS3 && PROC_i586 + default "i686-pc-linux-gnu" if !BOOK_CLFS3 && PROC_i686 - config TARGET - string - depends DATA_64 - default "x86_64-unknown-linux-gnu" if ARCH_X86 - default "mips64el-unknown-linux-gnu" if ARCH_MIPS && PROC_mipsel - default "mips64-unknown-linux-gnu" if ARCH_MIPS && PROC_mips - default "sparc64-unknown-linux-gnu" if ARCH_SPARC - default "alpha-unknown-linux-gnu" if ARCH_ALPHA + default "i486-pc-linux-uclibc" if BOOK_CLFS3 && PROC_i486 + default "i586-pc-linux-uclibc" if BOOK_CLFS3 && PROC_i586 + default "i686-pc-linux-uclibc" if BOOK_CLFS3 && PROC_i686 - config TARGET - string - depends DATA_MULTI - default "x86_64-unknown-linux-gnu" if ARCH_X86 - default "mips64el-unknown-linux-gnu" if ARCH_MIPS && PROC_mipsel - default "mips64-unknown-linux-gnu" if ARCH_MIPS && PROC_mips - default "sparc64-unknown-linux-gnu" if ARCH_SPARC - default "powerpc64-unknown-linux-gnu" if ARCH_PPC + default "x86_64-unknown-linux-gnu" if ARCH_X86 && (DATA_64 || DATA_MULTI) + default "mipsel-unknown-linux-gnu" if !BOOK_CLFS3 && PROC_mipsel && DATA_32 + default "mips-unknown-linux-gnu" if !BOOK_CLFS3 && PROC_mips && DATA_32 + default "mips64el-unknown-linux-gnu" if !BOOK_CLFS3 && PROC_mipsel && (DATA_64 || DATA_MULTI) + default "mips64-unknown-linux-gnu" if !BOOK_CLFS3 && PROC_mips && (DATA_64 || DATA_MULTI) + + default "mipsel-unknown-linux-uclibc" if BOOK_CLFS3 && PROC_mipsel && DATA_32 + default "mips-unknown-linux-uclibc" if BOOK_CLFS3 && PROC_mips && DATA_32 + default "mips64el-unknown-linux-uclibc" if BOOK_CLFS3 && PROC_mipsel && DATA_64 + default "mips64-unknown-linux-uclibc" if BOOK_CLFS3 && PROC_mips && DATA_64 + + default "powerpc-unknown-linux-gnu" if ARCH_PPC && DATA_32 + default "powerpc64-unknown-linux-gnu" if ARCH_PPC && DATA_MULTI + + default "sparc-unknown-linux-gnu" if ARCH_SPARC && DATA_32 + default "sparc64-unknown-linux-gnu" if ARCH_SPARC && (DATA_64 || DATA_MULTI) + + default "hppa-unknown-linux-gnu" if PROC_unknown && ARCH_HPPA + default "hppa1.1-unknown-linux-gnu" if PROC_hppa1 + default "hppa2.0-unknown-linux-gnu" if PROC_hppa2 + + default "arm-unknown-linux-gnu" if ARCH_ARM && BOOK_CLFS2 + + default "arm-unknown-linux-uclibc" if PROC_ARM + default "armv5l-unknown-linux-uclibc" if PROC_ARM5L + default "armv5b-unknown-linux-uclibc" if PROC_ARM5B + + default "alpha-unknown-linux-gnu" if PROC_unknown && ARCH_ALPHA + default "alphaev5-unknown-linux-gnu" if PROC_EV5 + default "alphaev56-unknown-linux-gnu" if PROC_EV56 + default "alphapca56-unknown-linux-gnu" if PROC_PCA56 + default "alphapca57-unknown-linux-gnu" if PROC_PCA57 + default "alphaev6-unknown-linux-gnu" if PROC_EV6 + default "alphaev67-unknown-linux-gnu" if PROC_EV67 + default "alphaev68-unknown-linux-gnu" if PROC_EV68 config TARGET32 string depends DATA_MULTI default "i686-pc-linux-gnu" if ARCH_X86 - default "mipsel-unknown-linux-gnu" if ARCH_MIPS && PROC_mipsel - default "mips-unknown-linux-gnu" if ARCH_MIPS && PROC_mips + default "mipsel-unknown-linux-gnu" if PROC_mipsel + default "mips-unknown-linux-gnu" if PROC_mips default "sparc-unknown-linux-gnu" if ARCH_SPARC default "powerpc-unknown-linux-gnu" if ARCH_PPC - config ARCH + config PLATFORM string - depends DATA_32 - default "x86" if ARCH_X86 - default "ppc" if ARCH_PPC - default "mips" if ARCH_MIPS - default "sparc" if ARCH_SPARC - default "arm" if ARCH_ARM + default "GENERIC" if (!BOOK_CLFS3) || PLATFORM_GENERIC + default "WRT - Wireless Router" if PLATFORM_WRT + + config SPARC64_PROC + string + default "none" if !(ARCH_SPARC && (DATA_64 || DATA_MULTI)) + default "1" if PROC_ULTRA1 + default "2" if PROC_ULTRA2 + default "3" if PROC_ULTRA3 config ARCH string - depends DATA_64 - default "x86_64-64" if ARCH_X86 - default "mips64-64" if ARCH_MIPS - default "sparc64-64" if ARCH_SPARC + default "x86" if ARCH_X86 && (DATA_32 || BOOK_CLFS2 || BOOK_CLFS3) + default "x86_64" if ARCH_X86 && DATA_MULTI + default "x86_64-64" if ARCH_X86 && DATA_64 + + default "wrt" if PLATFORM_WRT && BOOK_CLFS3 + + default "mips" if ARCH_MIPS && (DATA_32 || BOOK_CLFS3) + default "mips64" if ARCH_MIPS && DATA_MULTI + default "mips64-64" if ARCH_MIPS && DATA_64 && BOOK_CLFS + + + default "ppc" if ARCH_PPC && DATA_32 + default "ppc64" if ARCH_PPC && DATA_MULTI + + default "sparc" if ARCH_SPARC && DATA_32 + default "sparc64" if ARCH_SPARC && DATA_MULTI + default "sparc64-64" if ARCH_SPARC && DATA_64 + default "alpha" if ARCH_ALPHA + default "arm" if ARCH_ARM + default "hppa" if ARCH_HPPA - config ARCH + config MIPS_LEVEL string - depends DATA_MULTI - default "x86_64" if ARCH_X86 - default "mips64" if ARCH_MIPS - default "sparc64" if ARCH_SPARC - default "ppc64" if ARCH_PPC + depends BOOK_CLFS3 && ARCH_MIPS + default "1" if DATA_32 + default "3" if DATA_64 + + config ABI + string + depends BOOK_CLFS3 + default "-m32" if ARCH_X86 || ARCH_ARM +# default "-m64" if NO USED YET IN THE BOOK + default "-mabi=32" if ABI_32 || (ARCH_MIPS && DATA_32) + default "-mabi=n32" if ABI_N32 + default "-mabi=64" if ABI_64 + + config ENDIAN + string + depends BOOK_CLFS3 && (ARCH_MIPS || ARCH_ARM) + default "little" if PROC_mipsel || PROC_ARM || PROC_ARM5L + default "big" if PROC_mips || PROC_ARM5B choice prompt "Build method" @@ -265,23 +399,120 @@ menu "--- BOOK Settings" string default "glibc" if LIB_GLIBC default "uclibc" if LIB_UCLIBC + + choice + prompt "Kernel series" + depends on BOOK_HLFS + help + #-- Which kernel series to use: 2.6/2.4 + + config KERNEL_26 + bool "2.6 kernel series" + + config KERNEL_24 + bool "2.4 kernel series" + endchoice + + config KERNEL + depends on BOOK_HLFS + string + default "2.6" if KERNEL_26 + default "2.4" if KERNEL_24 + +# menu "HLFS Additional Features" +# depends on BOOK_HLFS +# +# config SET_SSP +# bool "Stack-smashing protector" +# default y +# +# config SET_ASLR +# bool "Address-space layout randomization" +# default y +# +# config SET_PAX +# bool "PaX-aware ELF executables and kernel" +# default y +# +# config SET_HARDENED_TMP +# bool "Hardened temporary files creation" +# default y +# +# config SET_WARNINGS +# bool "Additional warnings" +# default y +# +# config SET_MISC +# bool "Miscellaneous features" +# default y +# +# config SET_BLOWFISH +# bool "Blowfish passwords" +# default y +# endmenu + + config SSP +# depends on SET_SSP + string + default ",ssp," + + config ASLR +# depends on SET_ASLR + string + default ",aslr," + + config PAX +# depends on SET_PAX + string + default ",pax," + + config HARDENED_TMP +# depends on SET_HARDENED_TMP + string + default ",hardened_tmp," + + config WARNINGS +# depends on SET_WARNINGS + string + default ",warnings," + + config MISC +# depends on SET_MISC + string + default ",misc," + + config BLOWFISH +# depends on SET_BLOWFISH + string + default ",blowfish," #--- End HLFS specific params + #--- Custom Tools support + config CUSTOM_TOOLS + bool "Add custom tools support" + default n + depends on !BOOK_BLFS + help + #--- Activating this option additional packages you create + # will be installed after finished the xLFS system build. + # + #--- End Custom Tools support + #--- blfs-tool Support config BLFS_TOOL bool "Add blfs-tool support" default n -# depends on !BOOK_BLFS - depends on BOOK_LFS || BOOK_CLFS + depends on !BOOK_BLFS && !BOOK_CLFS3 help - #--- Activating this option additional packages needed to - # use blfs-tool will be installed. + #--- Activating this option will install additional + # packages needed to use blfs-tool when booting + # the new system. # # The blfs-tool files will be installed under # $BUILD_DIR/blfs_root. # After booting the new xLFS system you should to - # create an user account and move the blfs-root + # create an user account and move the /blfs-root # directory to the user's home, making he the # directory and files owner, before start # using blfs-tool. @@ -339,12 +570,12 @@ menu "--- BOOK Settings" default y depends on DEP_DBXML - config DEP_DBXSL - bool "DocBook XSL (required)" - default y + #config DEP_DBXSL + #bool "DocBook XSL (required)" + #default y - config DEP_LINKS - bool "links (required)" + config DEP_LYNX + bool "lynx (required)" default y config DEP_SUDO @@ -355,16 +586,27 @@ menu "--- BOOK Settings" bool "wget (recommended)" default y - config DEP_SVN - bool "SVN client (optional)" - default y - config DEP_GPM bool "GPM (optional, see help)" default y help #-- You MUST to install manually the gpm bootscript - # and create its configuration file + # and create its configuration file. + # + # An alternative is to unselect this option and + # install gpm, its configuration file, and its + # bootscript using the custom tools support. + + config DEP_SVN + bool "SVN client (optional, see help)" + default n + help + #-- Subversion-1.3.1 will be installed. This version is + # old but does not rely on additional packages to be + # built. + # + # If you are happy with this old version and don't + # need extra features, select this option. endmenu #--- End blfs-tool Support @@ -389,28 +631,23 @@ menu "--- BOOK Settings" config TRACKING_DIR string "Installed packages database directory" default "/var/lib/jhalfs/BLFS" - depends on BOOK_BLFS || BLFS_TOOL + depends on BOOK_BLFS || BLFS_TOOL || CUSTOM_TOOLS help #-- Full path to the directory where the installed # packages database will be created. # - # You MUST to create manually this directory. + # If you are installing blfs-tool on a running xLFS system + # you MUST to create manually this directory. + # + # If you are installing blfs-tool as part of a xLFS build + # and/or using the customized scripts feature, you will + # need to fix that directory permissions after booting + # the new system. # # Note that the user that will build the packages must # have read and write privileges on that directory. #--- End BLFS specific params - - #--- Custom Tools support - config CUSTOM_TOOLS - bool "Add custom tool support" - default n - depends on BOOK_LFS - help - #--- Activating this option additional packages you create - # will be installed. - # - #--- End Custom Tools support - + #--- End BOOK Settings endmenu @@ -419,7 +656,7 @@ menu "--- General Settings" #--- Set User Account config CONFIG_USER - bool "Change the default user/group for this build" + bool "Change the default user/group and homedir for this build" default n help #-- Unprivileged user and group name # If you do not have the priv to create/delete @@ -427,15 +664,17 @@ menu "--- General Settings" # user id for the build # # default values for each book - # LFS lfs - # CLFS clfs - # CLFS2 clfs - # HLFS hlfs + # LFS lfs + # CLFS* clfs + # HLFS hlfs + # + # Also, if your host place users home dirs into a + # directory other than /home you can specify it here. config DEF_USER string default "lfs" if BOOK_LFS - default "clfs" if BOOK_CLFS || BOOK_CLFS2 + default "clfs" if BOOK_CLFS || BOOK_CLFS2 || BOOK_CLFS3 default "hlfs" if BOOK_HLFS config SET_USER @@ -443,7 +682,6 @@ menu "--- General Settings" depends CONFIG_USER default DEF_USER - config CONFIG_GROUP bool "Set Group?" default n @@ -454,6 +692,16 @@ menu "--- General Settings" depends CONFIG_GROUP default DEF_USER + config CONFIG_HOME + bool "Set home dir?" + default n + depends CONFIG_USER + + config SET_HOME + string "Path to the directory where user home dir will be created" + depends CONFIG_HOME + default "/home" + config LUSER string default DEF_USER if !CONFIG_USER @@ -463,6 +711,11 @@ menu "--- General Settings" string default LUSER if !CONFIG_GROUP default SET_GROUP if CONFIG_GROUP + + config LHOME + string + default "/home" if !CONFIG_HOME + default SET_HOME if CONFIG_HOME #--- End Set User Account config BUILDDIR @@ -470,6 +723,9 @@ menu "--- General Settings" default "/mnt/build_dir" help #-- The directory where the created system will be located. + # NOTE: A working directory named jhalfs will be created + # here, so ensure this does not conflict with the jhalfs + # source directory. config GETPKG bool "Retrieve source files" @@ -502,7 +758,7 @@ menu "--- General Settings" config GETKERNEL bool "Always retrieve kernel package (see help)" - default y if BOOK_LFS && relSVN + default y if BOOK_LFS || BOOK_HLFS depends GETPKG help #-- Get the kernel package and patches even if no kernel @@ -510,7 +766,10 @@ menu "--- General Settings" # NOTE: # The kernel package must be available when building - # the SVN version of LFS to can install the headers files. + # the SVN version of LFS or HLFS to can install the + # headers files. + # + # If building LFS-6.2 this setting can be disabled. config RUNMAKE bool "Run the makefile" @@ -526,7 +785,6 @@ menu "--- General Settings" # The directory is cleaned only if it was populated by a # previous JHALFS run. # - # NOTE::You must be 'root' for this function to work #--- End General Settings endmenu @@ -537,7 +795,7 @@ menu "--- Build Settings" #--- Test Suites config CONFIG_TESTS bool "Run testsuites" - depends !BOOK_CLFS2 + depends !BOOK_CLFS2 && !BOOK_CLFS3 default y help #-- Run test suites @@ -598,6 +856,16 @@ menu "--- Build Settings" #--- End Test Suites + #--- Installed files logs + config INSTALL_LOG + bool "Create installed files logs" + default n + help + #-- Select this if you want to create logs of the files + # installed by each package on the final system. + + #--- End Installed files logs + #--- FSTAB config HAVE_FSTAB bool "Use a custom fstab file" @@ -637,10 +905,12 @@ menu "--- Build Settings" config STRIP bool "Strip Installed Binaries/Libraries" default y + depends on !BOOK_CLFS3 config VIMLANG bool "Install vim-lang package" default y + depends on !BOOK_HLFS && !BOOK_CLFS3 help #-- Install the optional vim-lang package @@ -657,13 +927,6 @@ menu "--- Build Settings" help #-- Language information in /etc/profile See for values - config LC_ALL - string "Language" - default "$LC_ALL" - depends on !BOOK_LFS - help - #-- Language information in /etc/profile See for values - #--- Groff page choice prompt "Groff page size" @@ -697,7 +960,7 @@ menu "--- Advanced Features" #--- ICA/farce config COMPARE bool "Run comparison analysis on final stage" - depends !BOOK_CLFS2 + depends !BOOK_CLFS2 && !BOOK_CLFS3 default n help #-- Should some iterative comparison analysis by made? @@ -736,7 +999,7 @@ menu "--- Advanced Features" #--- End ICA/farce #--- Optimizations -if !BOOK_CLFS2 +if !BOOK_CLFS2 && !BOOK_CLFS3 config CONFIG_OPTIMIZE bool "Use optimization (see help)" default n @@ -784,13 +1047,29 @@ endif string "jhalfs directory" default "$BUILDDIR/$SCRIPT_ROOT" + config LOGDIRBASE + string "Build logs directory basename" + default "logs" + config LOGDIR string "Build logs directory" - default "$JHALFSDIR/logs" + default "$JHALFSDIR/$LOGDIRBASE" + + config TESTLOGDIRBASE + string "Test suites logs directory basename" + default "test-logs" config TESTLOGDIR string "Test suites logs directory" - default "$JHALFSDIR/test-logs" + default "$JHALFSDIR/$TESTLOGDIRBASE" + + config FILELOGDIRBASE + string "Installed files logs directory basename" + default "installed-files" + + config FILELOGDIR + string "Installed files logs directory" + default "$JHALFSDIR/$FILELOGDIRBASE" config ICALOGDIR string "ICA logs directory" @@ -817,3 +1096,16 @@ endif #--- End Advanced Features endmenu + +config REBUILD_MAKEFILE + bool "Rebuild the Makefile (see help)" + default n + depends on !BOOK_BLFS + help + #-- Rebuild the Makefile + # + # This option alow to rebuild the Makefile after + # customizing the base system build scripts. + # + # See README.CUSTOM for more info about this feature. + diff --git a/HLFS/hlfs.xsl b/HLFS/hlfs.xsl index dd3e09d..aa9504a 100644 --- a/HLFS/hlfs.xsl +++ b/HLFS/hlfs.xsl @@ -16,6 +16,9 @@ + + + @@ -33,6 +36,9 @@ --> + + ,ssp,aslr,pax,hardened_tmp,warnings,misc,blowfish, + @@ -41,7 +47,6 @@ - @@ -51,10 +56,11 @@ + count(descendant::screen[@role='nodump'])) and + ((@condition=$model or not(@condition)) and + (@vendor=$kernel or not(@vendor)))"> @@ -84,45 +90,48 @@ - - #!/tools/bin/bash set -e - - - #!/bin/sh + #!/tools/bin/bash set +h - #!/bin/sh set -e + #!/bin/bash set +h - + + set -e + + + cd $PKGDIR - + pushd ../; tar -xvf gettext-&gettext-version;.*; popd; - - - tar -xvf gcc-core-&gcc-version;.*; - tar -xvf gcc-g++-&gcc-version;.*; tar -xvf binutils-&binutils-version;.*; + + tar -xvf gcc-g++-&gcc-version;.*; + tar -xvf gcc-testsuite-&gcc-version;.*; - - - - pushd ../; tar -xvf blfs-bootscripts-&blfs-bootscripts-version;.* ; popd; - + + + echo -e "\n\nTotalseconds: $SECONDS\n" + exit @@ -130,7 +139,9 @@ + (@vendor=$kernel or not(@vendor)) and + child::* = userinput and (not(@role) or + (@role and contains($features,concat(',',@role,','))))"> @@ -160,44 +171,19 @@ - - - - tar.* - - - - - - - patch -Z - - - - + - - export LC_ALL= - - export LANG= + + export LANG= - export INPUTRC - + - - - make install - cd ../blfs-bootscripts-&blfs-bootscripts-version; - - - make mrproper @@ -205,6 +191,13 @@ + + + + echo "export + + " >> ~/.bashrc + cd ../gettext-*/gettext-runtime @@ -245,16 +238,17 @@ - - + + - - >> $TEST_LOG 2>&1 || true + make -k check >> $TEST_LOG 2>&1 || true + >> $TEST_LOG 2>&1 || true @@ -266,29 +260,38 @@ - + - - - - >> $TEST_LOG 2>&1 || true - - - >> $TEST_LOG 2>&1 - - || true - - - - + + - - + + + + + >> $TEST_LOG 2>&1 || true + + + + + + set +e + + set -e + + + + ! + + + + + || true @@ -301,7 +304,8 @@ - + diff --git a/HLFS/master.sh b/HLFS/master.sh old mode 100755 new mode 100644 index 8fa49ea..5d12ec4 --- a/HLFS/master.sh +++ b/HLFS/master.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e # Enable error trapping # $Id$ @@ -19,7 +19,7 @@ process_toolchain() { # embryo,cocoon and butterfly need special handling local TC_MountPT local remove_existing - tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'` + tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@' -e 's,'$N',,'` case $tc_phase in embryo | \ cocoon) # Vars for LUSER phase @@ -93,14 +93,7 @@ chapter3_Makefiles() { # Initialization of the system echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter3 ( SETUP ) ${R_arrow}" - # Define a few model dependant variables - if [[ ${MODEL} = "uclibc" ]]; then - TARGET="pc-linux-gnu"; LOADER="ld-uClibc.so.0" - else - TARGET="pc-linux-gnu"; LOADER="ld-linux.so.2" - fi - - # If /home/$LUSER is already present in the host, we asume that the + # If $LUSER_HOME is already present in the host, we asume that the # hlfs user and group are also presents in the host, and a backup # of their bash init files is made. ( @@ -110,55 +103,42 @@ cat << EOF @mkdir \$(MOUNT_PT)/tools && \\ rm -f /tools && \\ ln -s \$(MOUNT_PT)/tools / - @if [ ! -d \$(MOUNT_PT)/sources ]; then \\ - mkdir \$(MOUNT_PT)/sources; \\ - fi; - @chmod a+wt \$(MOUNT_PT)/sources && \\ - touch \$@ && \\ - echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ - echo --------------------------------------------------------------------------------\$(WHITE) + @\$(call housekeeping) 021-addinguser: 020-creatingtoolsdir @\$(call echo_message, Building) - @if [ ! -d /home/\$(LUSER) ]; then \\ + @if [ ! -d \$(LUSER_HOME) ]; then \\ groupadd \$(LGROUP); \\ useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\ else \\ touch luser-exist; \\ fi; @chown \$(LUSER) \$(MOUNT_PT)/tools && \\ - chown -R \$(LUSER) \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\ - chown \$(LUSER) \$(MOUNT_PT)/sources && \\ - touch \$@ && \\ - echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ - echo --------------------------------------------------------------------------------\$(WHITE) + chmod -R a+wt \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\ + chmod a+wt \$(SRCSDIR) + @\$(call housekeeping) 022-settingenvironment: 021-addinguser @\$(call echo_message, Building) - @if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ - mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\ + @if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\ + mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\ fi; - @if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ - mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\ + @if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\ + mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\ fi; - @echo "set +h" > /home/\$(LUSER)/.bashrc && \\ - echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\ - echo "HLFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\ - echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\ - echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\ - echo "export HLFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\ - echo "" >> /home/\$(LUSER)/.bashrc && \\ - echo "target=$(uname -m)-${TARGET}" >> /home/\$(LUSER)/.bashrc && \\ - echo "ldso=/tools/lib/${LOADER}" >> /home/\$(LUSER)/.bashrc && \\ - echo "export target ldso" >> /home/\$(LUSER)/.bashrc && \\ - echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc && \\ - chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\ + @echo "set +h" > \$(LUSER_HOME)/.bashrc && \\ + echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\ + echo "HLFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\ + echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\ + echo "PATH=/tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\ + echo "export HLFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\ + echo "" >> \$(LUSER_HOME)/.bashrc && \\ + echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc && \\ + chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\ chmod -R a+wt \$(MOUNT_PT) && \\ touch envars && \\ - chown \$(LUSER) envars && \\ - touch \$@ && \\ - echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ - echo --------------------------------------------------------------------------------\$(WHITE) + chown \$(LUSER) envars + @\$(call housekeeping) EOF ) >> $MKFILE.tmp chapter3=" 020-creatingtoolsdir 021-addinguser 022-settingenvironment" @@ -182,8 +162,6 @@ chapter5_Makefiles() { # Bootstrap or temptools phase *tcl* ) [[ "$TEST" = "0" ]] && continue; ;; *expect* ) [[ "$TEST" = "0" ]] && continue; ;; *dejagnu* ) [[ "$TEST" = "0" ]] && continue; ;; - # Nothing interestin in this script - *introduction* ) continue ;; # Test if the stripping phase must be skipped *stripping* ) [[ "$STRIP" = "n" ]] && continue ;; *) ;; @@ -194,7 +172,7 @@ chapter5_Makefiles() { # Bootstrap or temptools phase chapter5="$chapter5 $this_script" # Grab the name of the target - name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'` + name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-pass[0-9]\{1\}@@'` # Adjust 'name' case $name in @@ -224,8 +202,11 @@ chapter5_Makefiles() { # Bootstrap or temptools phase # LUSER_wrt_target "$this_script" "$PREV" # Find the version of the command files, if it corresponds with the building of - # a specific package - pkg_tarball=$(get_package_tarball_name $name) + # a specific package. Fix GCC tarball name for 2.4-branch. + case $name in + gcc ) pkg_tarball=$(get_package_tarball_name gcc-core) ;; + * ) pkg_tarball=$(get_package_tarball_name $name) ;; + esac # If $pkg_tarball isn't empty, we've got a package... if [ "$pkg_tarball" != "" ] ; then # Insert instructions for unpacking the package and to set the PKGDIR variable. @@ -262,7 +243,6 @@ chapter6_Makefiles() { # sysroot or chroot build phase local file local this_script # Set envars and scripts for iteration targets - LOGS="" # Start with an empty global LOGS envar if [[ -z "$1" ]] ; then local N="" else @@ -273,16 +253,17 @@ chapter6_Makefiles() { # sysroot or chroot build phase for script in chapter06$N/* ; do # Overwrite existing symlinks, files, and dirs sed -e 's/ln -s /ln -sf /g' \ - -e 's/^mv /&-f/g' -i ${script} + -e 's/^mv /&-f /g' \ + -e 's/mkdir -v/&p/g' -i ${script} + # Rename the scripts + mv ${script} ${script}$N done # Remove Bzip2 binaries before make install - sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2 + sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2$N # Fix how Module-Init-Tools do the install target - sed -e 's@make install@make INSTALL=install install@' -i chapter06$N/*-module-init-tools - # Delete *old Readline libraries just after make install - sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i chapter06$N/*-readline + sed -e 's@make install@make INSTALL=install install@' -i chapter06$N/*-module-init-tools$N # Don't readd already existing groups - sed -e '/groupadd/d' -i chapter06$N/*-udev + sed -e '/groupadd/d' -i chapter06$N/*-udev$N fi echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ( CHROOT ) ${R_arrow}" @@ -298,18 +279,23 @@ chapter6_Makefiles() { # sysroot or chroot build phase *chroot* ) continue ;; # Test if the stripping phase must be skipped *-stripping* ) [[ "$STRIP" = "n" ]] && continue ;; + # Skip linux-headers in iterative builds + *linux-headers*) [[ -n "$N" ]] && continue ;; esac # Grab the name of the target - name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'` + name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's,'$N',,'` case $name in uclibc) name="uClibc" ;; esac # Find the version of the command files, if it corresponds with the building of - # a specific package - pkg_tarball=$(get_package_tarball_name $name) + # a specific package. Fix GCC tarball name for 2.4-branch. + case $name in + gcc ) pkg_tarball=$(get_package_tarball_name gcc-core) ;; + * ) pkg_tarball=$(get_package_tarball_name $name) ;; + esac if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then case "${this_script}" in @@ -320,11 +306,10 @@ chapter6_Makefiles() { # sysroot or chroot build phase # Append each name of the script files to a list (this will become # the names of the targets in the Makefile - chapter6="$chapter6 ${this_script}${N}" - - # Append each name of the script files to a list (this will become - # the names of the logs to be moved for each iteration) - LOGS="$LOGS ${this_script}" + case "${this_script}" in + *kernfs* ) runasroot=" ${this_script}" ;; + * ) chapter6="$chapter6 ${this_script}" ;; + esac #--------------------------------------------------------------------# @@ -334,44 +319,60 @@ chapter6_Makefiles() { # sysroot or chroot build phase # Drop in the name of the target on a new line, and the previous target # as a dependency. Also call the echo_message function. if [[ ${name} = "butterfly-toolchain" ]]; then - CHROOT_wrt_target "${this_script}${N}" "$PREV" - process_toolchain "${this_script}" "${file}" - wrt_touch - PREV=$this_script - continue + CHROOT_wrt_target "${this_script}" "$PREV" + # Touch timestamp file if installed files logs will be created. + # But only for the firt build when running iterative builds. + if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then + CHROOT_wrt_TouchTimestamp + fi + process_toolchain "${this_script}" "${file}" + if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then + CHROOT_wrt_LogNewFiles "$name" + fi + wrt_touch + PREV=$this_script + continue fi - - CHROOT_wrt_target "${this_script}${N}" "$PREV" + # kernfs is run in SUDO target + case "${this_script}" in + *kernfs* ) LUSER_wrt_target "${this_script}" "$PREV" ;; + * ) CHROOT_wrt_target "${this_script}" "$PREV" ;; + esac # If $pkg_tarball isn't empty, we've got a package... # Insert instructions for unpacking the package and changing directories if [ "$pkg_tarball" != "" ] ; then + # Touch timestamp file if installed files logs will be created. + # But only for the firt build when running iterative builds. + if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then + CHROOT_wrt_TouchTimestamp + fi CHROOT_Unpack "$pkg_tarball" # If the testsuites must be run, initialize the log file # butterfly-toolchain tests are enabled in 'process_tookchain' function + # 2.4-branch toolchain is ernabled here. case $name in - glibc ) [[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}" - ;; - * ) [[ "$TEST" > "1" ]] && CHROOT_wrt_test_log "${this_script}" - ;; + glibc | gcc | binutils) + [[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}" ;; + * ) [[ "$TEST" > "1" ]] && CHROOT_wrt_test_log "${this_script}" ;; esac # If using optimizations, write the instructions [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name" fi - # In the mount of kernel filesystems we need to set HLFS and not to use chroot. + # In kernfs we need to set HLFS and not to use chroot. case "${this_script}" in - *kernfs* | *changingowner*) - wrt_RunAsRoot "${this_script}" "${file}" - ;; - *) # The rest of Chapter06 - CHROOT_wrt_RunAsRoot "${file}" - ;; + *kernfs* ) wrt_RunAsRoot "${file}" ;; + * ) CHROOT_wrt_RunAsRoot "${file}" ;; esac # - # Remove the build directory(ies) except if the package build fails. + # Write installed files log and remove the build directory(ies) + # except if the package build fails. if [ "$pkg_tarball" != "" ] ; then CHROOT_wrt_RemoveBuildDirs "$name" + if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then + CHROOT_wrt_LogNewFiles "$name" + fi fi # # Include a touch of the target name so make can check if it's already been made. @@ -382,7 +383,7 @@ chapter6_Makefiles() { # sysroot or chroot build phase #--------------------------------------------------------------------# # Keep the script file name for Makefile dependencies. - PREV=${this_script}${N} + PREV=${this_script} # Set system_build envar for iteration targets system_build=$chapter6 done # end for file in chapter06/* @@ -400,19 +401,14 @@ chapter7_Makefiles() { # Create a bootable system.. kernel, bootscripts..e # Keep the script file name this_script=`basename $file` - # Grub must be configured manually. - # The filesystems can't be unmounted via Makefile and the user - # should enter the chroot environment to create the root - # password, edit several files and setup Grub. case $this_script in - *usage) continue ;; # Contains example commands - *grub) continue ;; - *console) continue ;; # Use the file generated by lfs-bootscripts - *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab + *grub) continue ;; # Grub must be configured manually. + *console) continue ;; # Use the file generated by lfs-bootscripts + *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;; - *kernel) # If no .config file is supplied, the kernel build is skipped - [[ -z $CONFIG ]] && continue - cp $CONFIG $BUILDDIR/sources/kernel-config + *kernel) # If no .config file is supplied, the kernel build is skipped + [[ -z $CONFIG ]] && continue + cp $CONFIG $BUILDDIR/sources/kernel-config ;; esac @@ -430,10 +426,21 @@ chapter7_Makefiles() { # Create a bootable system.. kernel, bootscripts..e case "${this_script}" in *bootscripts*) + if [ "${INSTALL_LOG}" = "y" ] ; then + CHROOT_wrt_TouchTimestamp + fi CHROOT_Unpack $(get_package_tarball_name "lfs-bootscripts") blfs_bootscripts=$(get_package_tarball_name "blfs-bootscripts" | sed -e 's/.tar.*//' ) echo -e "\t@echo \"\$(MOUNT_PT)\$(SRC)/$blfs_bootscripts\" >> sources-dir" >> $MKFILE.tmp ;; + *kernel) + name="linux" + pkg_tarball=$(get_package_tarball_name $name) + if [ "${INSTALL_LOG}" = "y" ] ; then + CHROOT_wrt_TouchTimestamp + fi + CHROOT_Unpack "$pkg_tarball" + ;; esac case "${this_script}" in @@ -456,11 +463,18 @@ chapter7_Makefiles() { # Create a bootable system.. kernel, bootscripts..e cat << EOF @ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\ rm -r \$(SRC)/\$\$ROOT - @rm -r \`cat sources-dir\` && \\ + @rm -rf \`cat sources-dir\` && \\ rm sources-dir EOF ) >> $MKFILE.tmp + if [ "${INSTALL_LOG}" = "y" ] ; then + CHROOT_wrt_LogNewFiles "$name" + fi ;; + *kernel) CHROOT_wrt_RemoveBuildDirs "dummy" + if [ "${INSTALL_LOG}" = "y" ] ; then + CHROOT_wrt_LogNewFiles "$name" + fi ;; esac # Include a touch of the target name so make can check if it's already been made. @@ -491,43 +505,14 @@ build_Makefile() { # Construct a Makefile from the book scripts # Add the iterations targets, if needed [[ "$COMPARE" = "y" ]] && wrt_compare_targets chapter7_Makefiles + # Add the CUSTOM_TOOLS targets, if needed + [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target + # Add the BLFS_TOOL targets, if needed + [[ "$BLFS_TOOL" = "y" ]] && wrt_blfs_tool_targets # Add a header, some variables and include the function file # to the top of the real Makefile. -( - cat << EOF -$HEADER - -SRC = /sources -MOUNT_PT = $BUILDDIR -PKG_LST = $PKG_LST -LUSER = $LUSER -LGROUP = $LGROUP -SCRIPT_ROOT = $SCRIPT_ROOT - -BASEDIR = \$(MOUNT_PT) -SRCSDIR = \$(BASEDIR)/sources -CMDSDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$PROGNAME-commands -LOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/logs -TESTLOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/test-logs - -crSRCSDIR = /sources -crCMDSDIR = /\$(SCRIPT_ROOT)/$PROGNAME-commands -crLOGDIR = /\$(SCRIPT_ROOT)/logs -crTESTLOGDIR = /\$(SCRIPT_ROOT)/test-logs - -SU_LUSER = su - \$(LUSER) -c -LUSER_HOME = /home/\$(LUSER) -PRT_DU = echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n" -PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) / \`\n" - -export PATH := \${PATH}:/usr/sbin - -include makefile-functions - -EOF -) > $MKFILE - + wrt_Makefile_header # Add chroot commands CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`" @@ -535,7 +520,7 @@ EOF for file in chapter06/*chroot* ; do chroot=`cat $file | \ sed -e "s@chroot@$CHROOT_LOC@" \ - -e '/#!\/bin\/sh/d' \ + -e '/#!\/bin\/bash/d' \ -e '/^export/d' \ -e '/^logout/d' \ -e 's@ \\\@ @g' | \ @@ -545,7 +530,8 @@ EOF -e 's|exit||g' \ -e 's|$| -c|' \ -e 's|"$$HLFS"|$(MOUNT_PT)|'\ - -e 's|set -e||'` + -e 's|set -e||' \ + -e 's|set +h||'` echo -e "CHROOT$i= $chroot\n" >> $MKFILE i=`expr $i + 1` done @@ -555,8 +541,10 @@ EOF ( cat << EOF -all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report +all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL @sudo make do-housekeeping + @echo "$VERSION - jhalfs build" > hlfs-release && \\ + sudo install -m444 hlfs-release \$(MOUNT_PT)/etc/hlfs-release @\$(call echo_finished,$VERSION) ck_UID: @@ -569,12 +557,12 @@ ck_UID: mk_SETUP: @\$(call echo_SU_request) - @sudo make SETUP + @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP @touch \$@ mk_LUSER: mk_SETUP @\$(call echo_SULUSER_request) - @(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make LUSER" ) + @(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) LUSER" ) @sudo make restore-luser-env @touch \$@ @@ -583,43 +571,65 @@ mk_SUDO: mk_LUSER @touch \$@ mk_CHROOT: mk_SUDO - @if [ ! -e \$(MOUNT_PT)/bin ]; then \\ - mkdir \$(MOUNT_PT)/bin; \\ - cd \$(MOUNT_PT)/bin && \\ - ln -sf /tools/bin/bash bash; ln -sf bash sh; \\ - sudo chown -R 0:0 \$(MOUNT_PT)/bin; \\ + @if [ ! -e \$(MOUNT_PT)/dev ]; then \\ + mkdir \$(MOUNT_PT)/dev && \\ + sudo mknod -m 666 \$(MOUNT_PT)/dev/null c 1 3 && \\ + sudo mknod -m 600 \$(MOUNT_PT)/dev/console c 5 1 && \\ + sudo chown -R 0:0 \$(MOUNT_PT)/dev; \\ fi; - @sudo sed -e 's|^ln -sv |ln -svf |' -i \$(CMDSDIR)/chapter06/064-createfiles @\$(call echo_CHROOT_request) - @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make CHROOT") + @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT") @touch \$@ mk_BOOT: mk_CHROOT @\$(call echo_CHROOT_request) - @( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BOOT") + @( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BOOT") + @touch \$@ + +mk_CUSTOM_TOOLS: create-sbu_du-report + @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\ + \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\ + sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\ + (sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\ + fi; + @touch \$@ + +mk_BLFS_TOOL: mk_CUSTOM_TOOLS + @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\ + \$(call sh_echo_PHASE,Building BLFS_TOOL); \\ + sudo mkdir -p $BUILDDIR$TRACKING_DIR; \\ + (sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BLFS_TOOL"); \\ + fi; @touch \$@ -SETUP: $chapter3 +SETUP: $chapter3 +LUSER: $chapter5 +SUDO: $runasroot +CHROOT: SHELL=/tools/bin/bash +CHROOT: $chapter6 +BOOT: $chapter7 +CUSTOM_TOOLS: $custom_list +BLFS_TOOL: $blfs_tool -LUSER: $chapter5 - -SUDO: 060-kernfs 062-changingowner - -CHROOT: $chapter6 - -BOOT: $chapter7 +create-sbu_du-report: mk_BOOT + @\$(call echo_message, Building) + @if [ "\$(ADD_REPORT)" = "y" ]; then \\ + ./create-sbu_du-report.sh logs $VERSION; \\ + \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\ + fi; + @touch \$@ restore-luser-env: @\$(call echo_message, Building) - @if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ - mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\ + @if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\ + mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\ fi; - @if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ - mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\ + @if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\ + mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\ fi; - @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\ + @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* && \\ touch \$@ && \\ echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ echo --------------------------------------------------------------------------------\$(WHITE) @@ -633,7 +643,7 @@ do-housekeeping: @-rm /tools @-if [ ! -f luser-exist ]; then \\ userdel \$(LUSER); \\ - rm -rf /home/\$(LUSER); \\ + rm -rf \$(LUSER_HOME); \\ fi; @@ -641,21 +651,6 @@ do-housekeeping: EOF ) >> $MKFILE - # Add SBU-disk_usage report target - echo "create-sbu_du-report:" >> $MKFILE - if [[ "$REPORT" = "y" ]] ; then -( - cat << EOF - @\$(call echo_message, Building) - @./create-sbu_du-report.sh logs $VERSION - @\$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report) - @touch \$@ - - -EOF -) >> $MKFILE - else echo -e "\t@true\n\n" >> $MKFILE; fi - # Bring over the items from the Makefile.tmp cat $MKFILE.tmp >> $MKFILE rm $MKFILE.tmp diff --git a/LFS/lfs.xsl b/LFS/lfs.xsl index 1a02e7d..c02f442 100644 --- a/LFS/lfs.xsl +++ b/LFS/lfs.xsl @@ -44,8 +44,13 @@ - + @@ -75,31 +80,36 @@ - - #!/tools/bin/bash set -e - - - #!/bin/sh + #!/tools/bin/bash set +h - #!/bin/sh set -e + #!/bin/bash set +h + + set -e + + cd $PKGDIR tar -xvf ../vim-&vim-version;-lang.* --strip-components=1 - + - + - exit + + echo -e "\n\nTotalseconds: $SECONDS\n" + + exit @@ -110,31 +120,6 @@ - - - - - - make -k - - >> $TEST_LOG 2>&1 || true - - - - >> $TEST_LOG 2>&1 - - || true - - - - - - - @@ -171,18 +156,20 @@ make mrproper cp -v ../kernel-config .config - + + ancestor::sect1[@id='ch-system-bash'] or + ancestor::sect1[@id='ch-system-module-init-tools']) + and @remap = 'test'"> - + + @@ -201,12 +188,35 @@ + + + + + + -k tests + + >> $TEST_LOG 2>&1 || true + + + + >> $TEST_LOG 2>&1 + + || true + + + + + - + + + + + + + + + + make -k + + >> $TEST_LOG 2>&1 || true + + + + >> $TEST_LOG 2>&1 + + || true + + + + + + + diff --git a/LFS/master.sh b/LFS/master.sh old mode 100755 new mode 100644 index db9385e..f3d28ad --- a/LFS/master.sh +++ b/LFS/master.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # $Id$ @@ -15,7 +15,7 @@ chapter4_Makefiles() { # #----------------------------# echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter4 ( SETUP ) ${R_arrow}" -# If /home/$LUSER is already present in the host, we asume that the +# If $LUSER_HOME is already present in the host, we asume that the # lfs user and group are also presents in the host, and a backup # of their bash init files is made. ( @@ -24,47 +24,41 @@ chapter4_Makefiles() { # @\$(call echo_message, Building) @mkdir \$(MOUNT_PT)/tools && \\ rm -f /tools && \\ - ln -s \$(MOUNT_PT)/tools / && \\ - touch \$@ && \\ - echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ - echo --------------------------------------------------------------------------------\$(WHITE) + ln -s \$(MOUNT_PT)/tools / + @\$(call housekeeping) 021-addinguser: 020-creatingtoolsdir @\$(call echo_message, Building) - @if [ ! -d /home/\$(LUSER) ]; then \\ + @if [ ! -d \$(LUSER_HOME) ]; then \\ groupadd \$(LGROUP); \\ useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\ else \\ touch luser-exist; \\ fi; @chown \$(LUSER) \$(MOUNT_PT)/tools && \\ - chown -R \$(LUSER) \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\ - chmod -R a+wt \$(MOUNT_PT) && \\ - touch \$@ && \\ - echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ - echo --------------------------------------------------------------------------------\$(WHITE) + chmod -R a+wt \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\ + chmod a+wt \$(SRCSDIR) + @\$(call housekeeping) 022-settingenvironment: 021-addinguser @\$(call echo_message, Building) - @if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ - mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\ + @if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\ + mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\ fi; - @if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ - mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\ + @if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\ + mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\ fi; - @echo "set +h" > /home/\$(LUSER)/.bashrc && \\ - echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\ - echo "LFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\ - echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\ - echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\ - echo "export LFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\ - echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc && \\ - chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\ + @echo "set +h" > \$(LUSER_HOME)/.bashrc && \\ + echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\ + echo "LFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\ + echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\ + echo "PATH=/tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\ + echo "export LFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\ + echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc && \\ + chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\ touch envars && \\ - chown \$(LUSER) envars && \\ - touch \$@ && \\ - echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ - echo --------------------------------------------------------------------------------\$(WHITE) + chown \$(LUSER) envars + @\$(call housekeeping) EOF ) > $MKFILE.tmp @@ -95,11 +89,11 @@ chapter5_Makefiles() { # First append each name of the script files to a list (this will become # the names of the targets in the Makefile - # DO NOT append the changingowner script. + # DO NOT append the changingowner script, it need be run as root. # A hack is necessary: create script in chap5 BUT run as a dependency for - # chap6 CHROOT + # SUDO target case "${this_script}" in - *changingowner) : ;; + *changingowner) runasroot="$runasroot ${this_script}" ;; *) chapter5="$chapter5 ${this_script}" ;; esac @@ -136,7 +130,7 @@ chapter5_Makefiles() { # and date and disk usage again at the bottom of the log file. # The changingowner script must be run as root. case "${this_script}" in - *changingowner) wrt_RunAsRoot "${this_script}" "$file" ;; + *changingowner) wrt_RunAsRoot "$file" ;; *) LUSER_wrt_RunAsUser "$file" ;; esac @@ -165,7 +159,6 @@ chapter6_Makefiles() { #----------------------------# # Set envars and scripts for iteration targets - LOGS="" # Start with an empty global LOGS envar if [[ -z "$1" ]] ; then local N="" else @@ -178,9 +171,11 @@ chapter6_Makefiles() { sed -e 's/ln -sv/&f/g' \ -e 's/mv -v/&f/g' \ -e 's/mkdir -v/&p/g' -i ${script} + # Rename the scripts + mv ${script} ${script}$N done - # Remove Bzip2 binaries before make install - sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2 + # Remove Bzip2 binaries before make install (LFS-6.2 compatibility) + sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2$N fi echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ( CHROOT ) ${R_arrow}" @@ -191,13 +186,15 @@ chapter6_Makefiles() { # We'll run the chroot commands differently than the others, so skip them in the # dependencies and target creation. + # Skip also linux-headers in iterative builds. case "${this_script}" in *chroot) continue ;; *stripping*) [[ "${STRIP}" = "n" ]] && continue ;; + *linux-headers*) [[ -n "$N" ]] && continue ;; esac - # Grab the name of the target - name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@'` + # Grab the name of the target. + name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@' -e 's,'$N',,'` # Find the version of the command files, if it corresponds with the building of # a specific package. We need this here to can skip scripts not needed for @@ -213,11 +210,11 @@ chapter6_Makefiles() { # Append each name of the script files to a list (this will become # the names of the targets in the Makefile) - chapter6="$chapter6 ${this_script}${N}" - - # Append each name of the script files to a list (this will become - # the names of the logs to be moved for each iteration) - LOGS="$LOGS ${this_script}" + # The kernfs script must be run as part of SUDO target. + case "${this_script}" in + *kernfs) runasroot="$runasroot ${this_script}" ;; + *) chapter6="$chapter6 ${this_script}" ;; + esac #--------------------------------------------------------------------# # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # @@ -225,11 +222,21 @@ chapter6_Makefiles() { # # Drop in the name of the target on a new line, and the previous target # as a dependency. Also call the echo_message function. - CHROOT_wrt_target "${this_script}${N}" "$PREV" + # In the mount of kernel filesystems we need to set LFS + # and not to use chroot. + case "${this_script}" in + *kernfs) LUSER_wrt_target "${this_script}" "$PREV" ;; + *) CHROOT_wrt_target "${this_script}" "$PREV" ;; + esac # If $pkg_tarball isn't empty, we've got a package... # Insert instructions for unpacking the package and changing directories if [ "$pkg_tarball" != "" ] ; then + # Touch timestamp file if installed files logs will be created. + # But only for the firt build when running iterative builds. + if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then + CHROOT_wrt_TouchTimestamp + fi CHROOT_Unpack "$pkg_tarball" # If the testsuites must be run, initialize the log file case $name in @@ -247,13 +254,17 @@ chapter6_Makefiles() { # In the mount of kernel filesystems we need to set LFS # and not to use chroot. case "${this_script}" in - *kernfs) wrt_RunAsRoot "${this_script}" "$file" ;; + *kernfs) wrt_RunAsRoot "$file" ;; *) CHROOT_wrt_RunAsRoot "$file" ;; esac - # Remove the build directory(ies) except if the package build fails. + # Write installed files log and remove the build directory(ies) + # except if the package build fails. if [ "$pkg_tarball" != "" ] ; then CHROOT_wrt_RemoveBuildDirs "$name" + if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then + CHROOT_wrt_LogNewFiles "$name" + fi fi # Include a touch of the target name so make can check @@ -265,32 +276,26 @@ chapter6_Makefiles() { #--------------------------------------------------------------------# # Keep the script file name for Makefile dependencies. - PREV=${this_script}${N} + PREV=${this_script} # Set system_build envar for iteration targets system_build=$chapter6 done # end for file in chapter06/* } #----------------------------# -chapter789_Makefiles() { +chapter78_Makefiles() { #----------------------------# - echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7/8/9 ( BOOT ) ${R_arrow}" + echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7/8 ( BOOT ) ${R_arrow}" - for file in chapter0{7,8,9}/* ; do + for file in chapter0{7,8}/* ; do # Keep the script file name this_script=`basename $file` # Grub must be configured manually. - # The filesystems can't be unmounted via Makefile and the user - # should enter the chroot environment to create the root - # password, edit several files and setup Grub. - # + # Handle fstab creation. # If no .config file is supplied, the kernel build is skipped - # case ${this_script} in *grub) continue ;; - *reboot) continue ;; - *console) continue ;; # Use the file generated by lfs-bootscripts *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;; *kernel) [[ -z ${CONFIG} ]] && continue cp ${CONFIG} $BUILDDIR/sources/kernel-config ;; @@ -298,7 +303,7 @@ chapter789_Makefiles() { # First append each name of the script files to a list (this will become # the names of the targets in the Makefile - chapter789="$chapter789 ${this_script}" + chapter78="$chapter78 ${this_script}" #--------------------------------------------------------------------# # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # @@ -313,11 +318,17 @@ chapter789_Makefiles() { *bootscripts) name="lfs-bootscripts" pkg_tarball=$(get_package_tarball_name $name) + if [ "${INSTALL_LOG}" = "y" ] ; then + CHROOT_wrt_TouchTimestamp + fi CHROOT_Unpack "$pkg_tarball" ;; *kernel) name="linux" pkg_tarball=$(get_package_tarball_name $name) + if [ "${INSTALL_LOG}" = "y" ] ; then + CHROOT_wrt_TouchTimestamp + fi CHROOT_Unpack "$pkg_tarball" ;; esac @@ -335,8 +346,14 @@ chapter789_Makefiles() { esac case "${this_script}" in - *bootscripts) CHROOT_wrt_RemoveBuildDirs "dummy" ;; - *kernel) CHROOT_wrt_RemoveBuildDirs "dummy" ;; + *bootscripts) CHROOT_wrt_RemoveBuildDirs "dummy" + if [ "${INSTALL_LOG}" = "y" ] ; then + CHROOT_wrt_LogNewFiles "$name" + fi ;; + *kernel) CHROOT_wrt_RemoveBuildDirs "dummy" + if [ "${INSTALL_LOG}" = "y" ] ; then + CHROOT_wrt_LogNewFiles "$name" + fi ;; esac # Include a touch of the target name so make can check @@ -349,7 +366,7 @@ chapter789_Makefiles() { # Keep the script file name for Makefile dependencies. PREV=${this_script} - done # for file in chapter0{7,8,9}/* + done # for file in chapter0{7,8}/* } @@ -371,46 +388,15 @@ build_Makefile() { # chapter6_Makefiles # Add the iterations targets, if needed [[ "$COMPARE" = "y" ]] && wrt_compare_targets - chapter789_Makefiles + chapter78_Makefiles + # Add the CUSTOM_TOOLS targets, if needed + [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target # Add the BLFS_TOOL targets, if needed [[ "$BLFS_TOOL" = "y" ]] && wrt_blfs_tool_targets # Add a header, some variables and include the function file # to the top of the real Makefile. -( - cat << EOF -$HEADER - - -SRC = /sources -MOUNT_PT = $BUILDDIR -PKG_LST = $PKG_LST -LUSER = $LUSER -LGROUP = $LGROUP -SCRIPT_ROOT = $SCRIPT_ROOT - -BASEDIR = \$(MOUNT_PT) -SRCSDIR = \$(BASEDIR)/sources -CMDSDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$PROGNAME-commands -LOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/logs -TESTLOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/test-logs - -crSRCSDIR = /sources -crCMDSDIR = /\$(SCRIPT_ROOT)/$PROGNAME-commands -crLOGDIR = /\$(SCRIPT_ROOT)/logs -crTESTLOGDIR = /\$(SCRIPT_ROOT)/test-logs - -SU_LUSER = su - \$(LUSER) -c -LUSER_HOME = /home/\$(LUSER) -PRT_DU = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) \$(MOUNT_PT) \`\n" -PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) / \`\n" - -export PATH := \${PATH}:/usr/sbin - -include makefile-functions - -EOF -) > $MKFILE + wrt_Makefile_header # Add chroot commands CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`" @@ -418,7 +404,7 @@ EOF for file in chapter06/*chroot* ; do chroot=`cat $file | \ sed -e "s@chroot@$CHROOT_LOC@" \ - -e '/#!\/bin\/sh/d' \ + -e '/#!\/bin\/bash/d' \ -e 's@ \\\@ @g' | \ tr -d '\n' | \ sed -e 's/ */ /g' \ @@ -426,7 +412,8 @@ EOF -e 's|exit||g' \ -e 's|$| -c|' \ -e 's|"$$LFS"|$(MOUNT_PT)|' \ - -e 's|set -e||'` + -e 's|set -e||' \ + -e 's|set +h||'` echo -e "CHROOT$i= $chroot\n" >> $MKFILE i=`expr $i + 1` done @@ -436,8 +423,10 @@ EOF ( cat << EOF -all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_BLFS_TOOL +all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL @sudo make do_housekeeping + @echo "$VERSION - jhalfs build" > lfs-release && \\ + sudo mv lfs-release \$(MOUNT_PT)/etc @\$(call echo_finished,$VERSION) ck_UID: @@ -450,66 +439,74 @@ ck_UID: mk_SETUP: @\$(call echo_SU_request) - @sudo make SETUP + @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP @touch \$@ mk_LUSER: mk_SETUP @\$(call echo_SULUSER_request) - @( sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make LUSER" ) + @( sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) LUSER" ) @sudo make restore-luser-env @touch \$@ mk_SUDO: mk_LUSER - @sudo make SUDO - touch \$@ -# -# The convoluted piece of code below is necessary to provide 'make' with a valid shell in the -# chroot environment. (Unless someone knows a different way) -# Manually create the /bin directory and provide link to the /tools dir. -# Also change the original symlink creation to include (f)orce to prevent failure due to -# pre-existing links. -# + @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO + @touch \$@ + mk_CHROOT: mk_SUDO - @if [ ! -e \$(MOUNT_PT)/bin ]; then \\ - mkdir \$(MOUNT_PT)/bin; \\ - cd \$(MOUNT_PT)/bin && \\ - ln -sf /tools/bin/bash bash; ln -sf bash sh; \\ - sudo chown -R 0:0 \$(MOUNT_PT)/bin; \\ - fi; - @sudo sed -e 's|^ln -sv |ln -svf |' -i \$(CMDSDIR)/chapter06/063-createfiles @\$(call echo_CHROOT_request) - @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make CHROOT") + @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT") @touch \$@ mk_BOOT: mk_CHROOT @\$(call echo_CHROOT_request) - @( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BOOT") + @( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BOOT") + @touch \$@ + +mk_CUSTOM_TOOLS: create-sbu_du-report + @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\ + \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\ + sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\ + (sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\ + fi; + @touch \$@ + +mk_BLFS_TOOL: mk_CUSTOM_TOOLS + @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\ + \$(call sh_echo_PHASE,Building BLFS_TOOL); \\ + sudo mkdir -p $BUILDDIR$TRACKING_DIR; \\ + (sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BLFS_TOOL"); \\ + fi; @touch \$@ -SETUP: $chapter4 +SETUP: $chapter4 +LUSER: $chapter5 +SUDO: $runasroot +CHROOT: SHELL=/tools/bin/bash +CHROOT: $chapter6 +BOOT: $chapter78 +CUSTOM_TOOLS: $custom_list +BLFS_TOOL: $blfs_tool -LUSER: $chapter5 - -SUDO: 057-changingowner 059-kernfs - -CHROOT: $chapter6 - -BOOT: $chapter789 +create-sbu_du-report: mk_BOOT + @\$(call echo_message, Building) + @if [ "\$(ADD_REPORT)" = "y" ]; then \\ + ./create-sbu_du-report.sh logs $VERSION; \\ + \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\ + fi; + @touch \$@ restore-luser-env: @\$(call echo_message, Building) - @if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\ - mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\ + @if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\ + mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\ fi; - @if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\ - mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\ + @if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\ + mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\ fi; - @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\ - touch \$@ && \\ - echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ - echo --------------------------------------------------------------------------------\$(WHITE) + @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* + @\$(call housekeeping) do_housekeeping: @-umount \$(MOUNT_PT)/sys @@ -520,45 +517,13 @@ do_housekeeping: @-rm /tools @-if [ ! -f luser-exist ]; then \\ userdel \$(LUSER); \\ - rm -rf /home/\$(LUSER); \\ + rm -rf \$(LUSER_HOME); \\ fi; EOF ) >> $MKFILE - # Add SBU-disk_usage report target - echo "create-sbu_du-report:" >> $MKFILE - if [[ "$REPORT" = "y" ]] ; then -( - cat << EOF - @\$(call echo_message, Building) - @./create-sbu_du-report.sh logs $VERSION - @\$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report) - @touch \$@ - - -EOF -) >> $MKFILE - else echo -e "\t@true\n\n" >> $MKFILE; fi - - # Add BLFS_TOOL targets - echo "mk_BLFS_TOOL:" >> $MKFILE - if [[ "$BLFS_TOOL" = "y" ]] ; then -( - cat << EOF - @\$(call echo_CHROOT_request) - @ sudo mkdir -p $BUILDDIR$TRACKING_DIR - @( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BLFS_TOOL") - @touch \$@ - -BLFS_TOOL: $blfs_tool - - -EOF -) >> $MKFILE - else echo -e "\t@true\n\n" >> $MKFILE; fi - # Bring over the items from the Makefile.tmp cat $MKFILE.tmp >> $MKFILE rm $MKFILE.tmp diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3912109 --- /dev/null +++ b/LICENSE @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/README b/README index 1fe9c31..fc8bebf 100644 --- a/README +++ b/README @@ -24,6 +24,9 @@ $Id$ configuration of the uClibc package when building a HLFS system using uClibc rather than glibc. + *. Read carefully this file and the other README.* files before start + using the tool. + 2. PREREQUISITES:: To use this tool you MUST: @@ -43,23 +46,17 @@ $Id$ 4. CONFIGURATION:: - ::NEWS:: - There is a new configuration method for jhalfs. - We have installed the familiar menu based configuration tool driven by GNU make. see the section RUNNING, for details 5. RUNNING:: - ::NEWS:: - jhalfs is now launched via GNU make instead of individual symlinks. - The command will launch a menu based configuration program. You will recognize the layout from building the kernel or uClibc/BusyBox. The underlying menu code was borrowed from BusyBox and slightly modified for our use. - Help on parameter function is available from the online help. Please + Help on parameter function is available from the on-line help. Please make use of that feature for additional information not in this file. Once you have set the parameters you wish and have saved your work the @@ -81,7 +78,16 @@ $Id$ 6. BLFS_TOOL SUPPORT:: For books that support it, there is an option to install blfs-tool and its - dependendencies on the final system. + dependencies on the final system. The pre-made build dependencies + scripts has been written based on a LFS build. For CLFS and HLFS + builds you may need to adjust that scripts, that are found into the + common/blfs-tool-deps directory in the jhalfs sources tree. + + WARNING:: If you add blfs-tool support on a CLFS Sysroot build + you MUST to edit the dependencies scripts to fix the + installation paths. + Be careful when you modify the scripts as you can + easily disable the host system. After booting the new xLFS system some steps are needed to finish blfs-tool installation: @@ -95,6 +101,9 @@ $Id$ - Give the user read and write privileges over the $TRACKING_DIR directory and the files that it contains. + - If you think that you may need the libxml2/libxslt Python modules, + remove the libxml2 and libxslt trackin files found in $TRACKING_DIR. + - Configure sudo, adding the needed privileges for the user. We assume that blfs-tool will be used on a running fresh xLFS system. @@ -113,6 +122,9 @@ $Id$ /CLFS2/master.sh /clfs2.xsl + /CLFS3/master.sh + /clfs3.xsl + /HLFS/master.sh /hlfs.xsl @@ -121,16 +133,17 @@ $Id$ /common/common_functions /makefile_functions - /func_check_versions.sh - /func_validate_configs.sh /packages.xsl /urls.xsl /create-sbu_du-report.sh - /func_compare.sh /progress_bar.sh /blfs-tool-deps/9xx-* + /libs/func_* - /contrib/jhalfs-paco.patch + /custom/template + /config/ + /examples/* + /examples_CLFS-E/* /extras/do_copy_files /do_ica_prep @@ -151,8 +164,9 @@ $Id$ README README.BLFS + README.CLFS README.HLFS - README.PACO + README.CUSTOM TODO LICENSE @@ -217,7 +231,7 @@ $Id$ Q. "What is the function of "User account" and "Group account" menu settings?" A. If you are running jhalfs from a low or non-privileged account you may not - have the priv to create/delete the user needed to build temporally tools. + have the priv to create/delete the user needed to build temporary tools. These settings allow you to use your own user and group name to do that build steps. @@ -244,6 +258,19 @@ $Id$ understanding of host/target hardware combination. Please read the book carefully and don't skip the easy parts (there are none..) + Q. "How could I stop the build at a predefined chosen point?" + A. Launch the Makefile manually passing the last numbered target to be build + as the break point. For example: + + make BREAKPOINT=84-bash + + The build can be stopped also at the end of a top-level build phase by + calling directly the appropriate mk_* target. For example: + + make mk_LUSER + + See the Makefile to know the proper target names for that book build. + Authors: George Boudreau Manuel Canales Esparcia diff --git a/README.BLFS b/README.BLFS index 67885b8..ba8977b 100644 --- a/README.BLFS +++ b/README.BLFS @@ -2,22 +2,25 @@ $Id$ 1. INTRODUCTION:: - To automatize packages build from the BLFS book instructions is a huge - task. The BLFS book isn't linear, some package pages need to use a non - default layout, there are circular dependencies, several packages can be - installed on a non default prefix, build commands can change based on what - dependencies will be used, etc. + If you want to add blfs-tool support into a xLFS base system build, + read the "BLFS_TOOL SUPPORT" section found in the README and be sure + to follow the after-booting installation intructions. - Said that, the goal of blfs-tool is try to help you solving packages - dependencies and creating your own build scripts and Makefile. Few of the - auto-generated build scripts and Makefile could work "as is", thus as a - general rule you will need to review and edit the scripts while reading - the book. + To automate package builds from the BLFS book instructions is a huge + task. Some of the issues are: the BLFS book isn't linear; some package + pages use a custom layout; there are circular dependencies; several + packages can be installed on a non-default prefix; build commands can + change based on what dependencies will be used, etc. + + That being said, the goal of the blfs-tool is to help you solve package + dependencies, create build scripts and a Makefile. Few of the auto-generated + build scripts and Makefile will work "as is", thus, as a general rule, + you will need to review and edit the scripts while reading the book. 2. PREREQUISITES:: - To use this tool you MUST to: + To use this tool you MUST: - have experience building BLFS packages - know how to edit and write shell scripts @@ -30,20 +33,21 @@ $Id$ 3. USAGE:: - Due the complexity of the BLFS book, the scripts and Makefile generation is - done in several steps: + Due the complexity of the BLFS book, the scripts and Makefile generation + is done in several steps: 3.1 INSTALLED PACKAGES TRACKING SYSTEM - This tool includes a very simple tracking system to know what packages - has been installed using the tool. It is used to skip installed packages - from target selection menu and to know if an installed package has been updated - on the BLFS book. Don't rely on this feature as a packages management tool. + This tool includes a very simple tracking system to log which packages + have been installed using the tool. It is used to skip installed packages + from target selection menu and to test if an installed package has been + updated in the BLFS book. Do not rely on this feature as a package + management tool. - The directory where tracking files will be stored need be created - before installing blfs-tool. You can place that directory anywhere, taking - care that the builder user must have read and write privileges on that - directory and on all files it contains. + The directory where tracking files will be stored needs to be created + before installing blfs-tool. You can place this directory anywhere, taking + care that the user must have read and write privileges on that directory + and on all files it contains. To use the default path set in the installation menu, run as root: @@ -52,12 +56,12 @@ $Id$ 3.2 BLFS_TOOL INSTALLATION:: Run "make" to launch the jhalfs menuconfig interface. Select the BLFS - book and it version. Then set the installation directory (default + book and version. Then set the installation directory (default $HOME/blfs_root), the BLFS sources directory (default blfs-xml), and the installed packages tracking directory (default /var/lib/jhalfs/BLFS). All required files will be placed in the installation directory and - BLFS XML sources will be checkout to the named sub-directory. + BLFS XML sources will be installed in the named sub-directory. Installed files: @@ -70,9 +74,9 @@ $Id$ update_book.sh update the XML book sources and regenerates packages database and meta-packages dependencies tree gen_config.sh regenerates Config.in - gen_pkg_book.sh solve dependencies and generates linear BLFS books + gen_pkg_book.sh resolves dependencies and generates linear BLFS books and build scripts - gen-makefile.sh generates target Makefile + gen-makefile.sh generates the target Makefile progress_bar.sh the target Makefile progress bar Makefile run gen_config.sh to update Config.in, then launch the menuconfig interface, and lastly run @@ -89,180 +93,148 @@ $Id$ 3.3 UPDATING BOOK SOURCES:: - If using the development book version, and if you want to update already - installed packages to the new version found in that book, you need to update - the XML sources and packages database. + If you are using the development book version and you want to update + installed packages to the latest version found in that book, you need to + update the XML sources and packages database. To do that run "./update_book.sh" On the next configuration run, packages already installed but listed - with a new version in the book will be available for target selection and - used to solve dependencies. + with a new version in the book will be available for target selection + and used to solve dependencies. 3.4 CONFIGURING AND PARSING THE BOOK:: - Next step is to create a book and build scripts in dependencies build order - for a target package. A target can be a package or a meta-package. + The next step is to create a book and build scripts in dependency + build order for a target package. A target can be a package or a + meta-package. WARNING: Only one target (meta-package or individual package) must be selected on each configuration run. - That is due that there is no way to solve dependencies properly - when more than one target are selected at the same time. + There is no way to solve dependencies properly when more + than one target are selected. Run to launch the configuration interface. The main menu contains - three block: meta-package selection, individual package selection, and + three blocks: meta-package selection, individual package selection, and build options. - When a meta-package is selected is possible to unselect unwanted components. - That unselected components will be skipped if no other components depends - on them. + When a meta-package is selected, it is possible to unselect unwanted + components. The unselected components will be skipped if no other components + depends on them. - In the build options section the dependencies level and default packages - used to solve alternatives are set. Can be set also if the build will be - made as a normal user or as root. That settings are saved to be reused on + In the build options section, the dependencies level and default packages + used to solve alternatives are set. You can also select whether the build will + be made as a normal user or as root. That settings are saved to be reused in future configuration runs. - If, for example, your target selection is Xsoft-->Graphweb-->galeon a + If, for example, your target selection is Xsoft-->Graphweb-->galeon, a directory named "galeon" will be created. Inside that directory you will find a directory named "HTML" that contains a galeon-based HTML book with its dependencies in build order, and a "scripts" directory with build scripts for that packages. - There is also two other directories, "dependencies" and "xincludes", that - contains files generated while resolving dependencies trees. + There are also two other directories ("dependencies" and "xincludes") + that contain files generated while resolving dependencies trees. 3.5 EDITING BUILD SCRIPTS - Now is time to review the generated book and scripts, making in the - scripts any changes required to fix generation bugs or to fit your needs. + Now it is time to review the generated book and scripts, making any changes + to the scripts necessary to fix generation bugs or to suit your needs. Scripts for additional packages (i.e., for non-BLFS packages) can be - inserted in an easy way due how the scripts are named. For example, if you - want to install the external dependency "bar" before "foo" package and the - "foo" script is named "064-z-foo", you need to create a "064-y-bar" build - script. + easily inserted. For example, if you want to install the external dependency + "bar" before "foo" package and the "foo" script is named "064-z-foo", you + need to create a "064-y-bar" build script. - Remember that the packages tracking system isn't a packages management tool - and know nothing about packages not in the BLFS book. + Remember, the package tracking system isn't a package management tool + and knows nothing about packages not in the BLFS book. - Also, review and edit envars.conf. That file is used to set global envars + Also, review and edit envars.conf. This file is used to set global envars needed by the build scripts. 3.6 CREATING THE MAKEFILE When the build scripts are ready to be run, the Makefile can be created. Be sure that you cd into the "package" directory and run + ../gen-makefile.sh - ../gen_makefile.sh - - Review the Makefile and if all looks sane, start the build. + Review the Makefile, and, if all looks sane, start the build. 4. GENERATED BUILD SCRIPTS ISSUES:: - In this section known issues with the generated build scripts are - discussed. They are due build procedures and/or BLFS layout particularities - than we can't handle. In several cases editing the build scripts is mandatory. - You may need also to insert some build script created by you to resolve + In this section, known issues with the generated build scripts are + discussed. They are due to build procedures and/or BLFS layout particularities + that we can't handle. In several cases, editing the build scripts is mandatory. + You may also need to insert some build scripts created by you to resolve unhandled dependencies and/or to remove some script installing the affected package by hand. 4.1 BLFS BOOTSCRIPTS - For now, bootscripts installation will fail. You will need to edit the - scripts for packages that install bootscripts and fix their installation - command. That could be fixed in the future, but not sure. + For now, bootscripts installation will fail. You will need to edit + the scripts for packages that install bootscripts and fix their + installation command. That could be fixed in the future. - 4.2 PACKAGES CONFIGURATION + 4.2 PACKAGE CONFIGURATION - For that packages that have a "Configuration" section, you should to - edit it build script to fit the configuration to your needs. + For those packages that have a "Configuration" section, you should + edit the build script to fit the needs of your system. - 4.4 PDL and Perl modules. + 4.4 PDL, Perl modules, and Glib-Bindings. - The generated scripts for that packages are plainly broken and can't - be fixed. You must to replace it by your own ones or install that - packages by hand. + The generated scripts for these packages are broken and can not + be fixed. You must rename it as the sub-package to be installed and + edit it to use the proper commads for that sub-package. - 4.4 GCC, JDK, Sane, and KDE-multimedia + You may need to create additional scripts for these sub-package + dependencies, if any. - On the pages for that packages, the BLFS book actually have instructions - to install two packages. You must to edit the scripts to fix it. We will - try to fix some of them, but may not be possible. + 4.4 GCC, JDK, Sane, and KDE-multimedia, freetype2, MesaLib and others + + On the pages for these packages, the BLFS book actually has instructions + to download and install two or more packages. You must edit the scripts to + fix this. + + We will try to fix some of them, but this may not be possible. 4.5 XORG7 - The generated scripts for Xorg7 pseudo-packages don't have support for - $SRC_ARCHIVE nor MD5 checking. + The generated scripts for Xorg7 pseudo-packages have $SRC_ARCHIVE + support for individual packages, but not for patches nor *.wget and *.md5 + files. - If you has downloaded previously the packages, you must to edit the scripts - to make it to use your local packages. + If you have previously downloaded the patches, you must edit + the scripts to use your local packages. - Also, you will need to edit the scripts to fix the commands that must - be applied only to a concrete individual sub-package. For example the "for" - loop to install xorg7-util packages may read like: + The *.wget and *.md5 files should be downladed always from inside + the scripts to be sure that the most current individual packages are + used. Thus don't reuse previouly existing ones. -for package in $(cat $WGET_LST) ; do - packagedir=$(echo $package | sed 's/.tar.bz2//') - tar -xf $package - cd $packagedir - sed -i "s@/usr/X11R6@$XORG_PREFIX@" X11.tmpl && - ./configure $XORG_CONFIG --with-config-dir=$XORG_PREFIX/lib/X11/config - sudo sh -c "make install" - ./configure $XORG_CONFIG --with-config-dir=$XORG_PREFIX/lib/X11/config && - make - sudo sh -c "make install" - ./configure $XORG_CONFIG && - make - sudo sh -c "make install" - cd .. - rm -rf $packagedir -done - - After reading the HTML page to know what commands is for what package, - the loop can be changed to read something like: - -for package in $(cat $WGET_LST) ; do - packagedir=$(echo $package | sed 's/.tar.bz2//') - tar -xf $package - cd $packagedir - if [ ${packagedir} = "xorg-cf-files" ] ; then - sed -i "s@/usr/X11R6@$XORG_PREFIX@" X11.tmpl && - ./configure $XORG_CONFIG --with-config-dir=$XORG_PREFIX/lib/X11/config - sudo sh -c "make install" - elif [ ${packagedir} = "Imake" ] ; then - ./configure $XORG_CONFIG --with-config-dir=$XORG_PREFIX/lib/X11/config && - make - sudo sh -c "make install" - else - ./configure $XORG_CONFIG && - make - sudo sh -c "make install" - fi - cd .. - rm -rf $packagedir -done + In the script for xorg7-font, be sure to move the fonts directories + symlinks creation to after the "for ... done" loop. 4.6 PATCHES - By default all required patches will be downloaded from the NET. + By default, all required patches will be downloaded from the NET. - If you has downloaded previously the patches, you must to edit the scripts - to make it to use your local patches. + If you have previously downloaded the patches, you must edit the + scripts to use your local patches. Also, be sure that all scripts have the commands to download/apply the - required patches. Due book layout issues some patches may be missing. + required patches. Due to book layout issues, some patches may be missing. 4.7 ROOT COMMANDS - If building as a normal user (the default setting) be sure that all - commands that need root privileges are run using sudo. + If building as a normal user (the default setting), be sure that all + commands that require root privileges are run using sudo. Also make sure + necessary root privilege commands are visible in your PATH. - Due book layout issues some sudo command may be missing. + Due to book layout issues, some sudo commands may be missing. 4.8 OTHERS - May have other issues that we are not aware on them yet. If you find - someone, please report it to . + There may be other issues that we are not aware of. If you find + any, please report it to . diff --git a/README.CLFS b/README.CLFS new file mode 100644 index 0000000..e4251a2 --- /dev/null +++ b/README.CLFS @@ -0,0 +1,44 @@ +# $Id$ + + CLFS-1.x NOTES + + None for now. + + + + CLFS SYSROOT METHOD NOTES + + .- If you want to install additional custom packages via "Add custom tools + support" and/or select "Add blfs-tool support", be sure to review and edit + their packages build scripts to follow the sysroot build method or you will + end messing your host system. Be very careful with this. + + .- If you install additional packages not using the "Add custom tools support" + feature (i,e, you will install it manually after finished the Makefile run) + you will need to run manually the "Changing the Ownership Of The CLFS System" + phase commands found in the book. + + + + CLFS EMBEDDED SYSTEMS NOTES + + .- Mips, WRT and ARM builds are broken due a book bug on the uClibc + *ENDIAN* configuration settings. + + .- To install CBLFS packages you must to use the "Add custom tools support" + feature. To learn how it works and how to use it, see the section titled + "Adding Post-System Build Configuration Files and Extra Packages" + found in README.CUSTOM. That is also applicable to bootloaders installation. + + .- If you install additional packages not using the "Add custom tools support" + feature (i,e, you will install it manually after finished the Makefile run) + you will need to run manually the "Changing the Ownership Of The CLFS System" + phase commands found in the book. + + .- If your target is a MIPS wireless router, you must to select "mips" as + your target architecture and "WRT - MIPS based wireless route" as your + hardware platform. + + .- The backup & clean-up phases aren't run. This is to allow users to + review the installed files and do a more in-deeper clean-up before creating + the system tarball. diff --git a/README.CUSTOM b/README.CUSTOM index d94da0c..171449d 100644 --- a/README.CUSTOM +++ b/README.CUSTOM @@ -1,5 +1,8 @@ +# +# $Id$ +# HOW TO ADD CUSTOM SCRIPTS TO THE JHALFS MAKEFILE - + Normally JHALFS creates a Makefile containing only those scripts found in the {B,C,H}LFS books. An automated construction tool cannot predict the @@ -7,6 +10,102 @@ needs of every individual and requests are made "Can you add xxxx package". Rather than adding numerous package scripts and switches for each request it was easier to add a tool for the user(s) to code their own package needs. + There is two areas that can be customized: how the base system is build +and what additional configurations and packages requires your hardware to can +boot and work with. Each one of this areas is handled in a different way. + + + + + BASE SYSTEM CUSTOMIZATION + + There is two ways to alter how the base system will be built: + + - Using a working copy of the book sources and editing the XML files. + This is the way used by book editors to test packages upgrades, + command changes, build order changes. etc. + + This method requires you know very well the book sources and what + files need be edited. It will not be discussed here. + + - Editing the generated build scripts to make any change you would. + This is the method discussed below. + + + EDITING THE BASE SCRIPTS + + First step is to generate the build scripts with book defaults. To do that, +configure jhalfs activating any option you want included, but do not select +"Run the Makefile" option. + + Under the ${BUILD_DIR}/${SCRIPT_ROOT}/${PROGNAME}-commands directory +(using the defaults values to do an LFS build, that directory name is +/mnt/build_dir/jhalfs/lfs-commands) you will find the default build scripts. + + If all you want is modify, add, or remove some command from a package +installation, for example to change it ./configure line, just edit the related +script. If changing or adding a patch, be sure to copy the new patch to the +${BUILD_DIR}/sources directory. When done, run 'make' from inside the +${BUILD_DIR}/${SCRIPT_ROOT} directory. + + + REPLACING OR INSERTING PACKAGES AND CHANGING BUILD ORDER + + To remove a package from the system, just remove its script(s). + + To change the version of some package to build a newest or oldest one than the +one found in the book, edit ${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list to +change it tarball name and place the new tarball in the ${BUILD_DIR}/sources +directory, + + To replace a package by an equivalent one, rename the replaced package script +to reflect the new package name (for example, 102-man-db -> 102-man), edit the +script to made the required commands changes, place the new tarball in the +${BUILD_DIR}/sources directory, and edit ${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list +file to replace the removed package tarball name by the new package tarball name. + + To change the build order, rename the scripts changing the first 3-digits +string until have it ordered in the way you want. + + To insert a new package, for example to build Cracklib to can build Shadow +with Cracklib support, first you should decide before what default package it +need be installed, in this example before 107-shadow. Then create a new script +containing the needed commands, using an existing one as template, and name it with +the same 3-digits string used for that mentioned default package, but adding +another 1-digit string. In our example, the new script to build Cracklib just +before Shadow will be named 107-1-cracklib. This naming schema allow to insert +up to 10 scripts before each one of the default scripts. Place the tarball for +the new package and required patches, if any, if ${BUILD_DIR}/sources and edit +${BUILD_DIR}/${SCRIPT_ROOT}/pkg_tarball_list to add the tarball name for that +package. + + When ready, launch again the jhalfs configuration interface. Be sure that +are selected exactly the same options than when generating the default build +scripts. Be sure that "Rebuild files" is unselected and select "Run the Makefile" +if you want. Then select "Rebuild the Makefile". This will create a new Makefile +based on the changes you made to the build scripts. + + + + + ADDING POST-SYSTEM BUILD CONFIGURATION FILES AND EXTRA PACKAGES + + The installation of BLFS packages is handled via blfs-tool and activated +when you select the appropriate menu option. See README and README.BLFS for +more info. + + The feature described below was added so users could install remaining +configuration files, build the packages necessary to access the Internet +or to support specific hardware, or to install basic utilities that need +have available from the beginning, and was not intended to replace the BLFS +install system. + + :::NOTICE::: + The following examples are for use with LFS and are not applicable to any +of the CLFS-sysroot or CLFS-Embedded books. The directory examples_CLFS-E +contains code extracted from Beyond CLFS-embedded. Any packages you chose to +add should honour the DESTDIR=${CLFS} switch or equivalent. + LAYOUT A new directory has been added to JHALFS tree which will contain the @@ -14,8 +113,10 @@ configuration scripts and a few examples. A switch has been added to the configuration file which enables/disables the inclusion of personal scripts. custom - /config <-- where to put your scripts. - template <-- ALL scripts MUST look like this + /config <-- where to put your scripts. + /examples <-- a few example scripts + /examples_CLFS-E <-- example scripts for CLFS-Embedded + template <-- ALL scripts MUST look like this @@ -33,7 +134,7 @@ configuration file which enables/disables the inclusion of personal scripts. and rename it. 2. Populate the variables with the necessary values. - Variable function is self explanitory except for the inclusion of the + Variable function is self explanatory except for the inclusion of the build cmds. If the package you want to include is found in the BLFS book then you only need to copy/paste the cmd strings between the xEOFx pairs, otherwise you will need to define the build cmds yourself. @@ -44,7 +145,7 @@ configuration file which enables/disables the inclusion of personal scripts. 3. As mentioned previously the build order is dictated by the 3 digit number in the file name. If a package has dependencies it must be numerically larger than the dependency files. - ie. The package mc has glib as a dependency and build order is + i.e. The package mc has glib as a dependency and build order is 950-glib 951-mc @@ -52,17 +153,7 @@ configuration file which enables/disables the inclusion of personal scripts. If a package requires a bootscript to be installed add the cmd to this file and NOT in the package script. The gpm script is included as an example of multiple patch files and the need for a blfs bootscript. - - RUNNING::: - Although your scripts are added to the generated makefile they are not - automatically built. You must tell the makefile to build the tools with - the cmd - make mk_CUSTOM_TOOLS - :::FINAL COMMENT::: - This feature was added so users could build the packages necessary to access - the internet and was not intended to replace the BLFS install system. - #--------- GLIB example ----------- @@ -71,13 +162,17 @@ configuration file which enables/disables the inclusion of personal scripts. # Create a file in the custom/config directory # Populate the file using the following script as an example # - + PKG="glib" PKG_VERSION="1.2.10" PKG_FILE="glib-1.2.10.tar.gz" URL="http://gd.tuwien.ac.at/graphics/gimp/gtk/v1.2/${PKG_FILE}" MD5="6fe30dad87c77b91b632def29dd69ef9" + # The following code removes previously defined PATCHx variables +for i in PATCH{1..10}; do + unset $i +done # Patches are named PATCH[1..10] # This information is used to download the patch only # If you do not have the MD5SUM the download will proceed with a warning. @@ -108,7 +203,11 @@ PKG_VERSION="1.20.1" PKG_FILE="gmp-1.20.1.tar.bz2" URL="ftp://arcana.linux.it/pub/gpm/gpm-1.20.1.tar.bz2" MD5="2c63e827d755527950d9d13fe3d87692" - +for i in PATCH{1..10}; do + unset $i +done + # MD5SUM is not absolutely necessary but JHALFS whines and complains + # Add the MD5SUM if you can PATCH1=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-segfault-1.patch" PATCH2=" http://www.linuxfromscratch.org/patches/blfs/svn/gpm-1.20.1-silent-1.patch" @@ -141,3 +240,29 @@ EOF xEOFx ) > tmp + +#--------- CMDS ONLY example ----------- + # This is an example of a self contained cmd script + # There are no referenced to a package or package dir. + # This method is useful for creating user files/profiles/etc + # at build time. + + +PKG="" +PKG_VERSION="" +PKG_FILE="" +URL="" +MD5="" +for i in PATCH{1..10}; do + unset $i +done +PATCH1="" + + +( cat << "xEOFx" + +echo "JUST A USELESS TRACE" + +xEOFx +) > tmp + diff --git a/README.HLFS b/README.HLFS index a9076cf..e7c2d1a 100644 --- a/README.HLFS +++ b/README.HLFS @@ -7,11 +7,5 @@ $Id$ changes can occur and the build could be broken for extended periods of time. - As of Sept.15.2006 jhalfs cannot build the svn book. This is a book - problem and not jhalfs. - - - Automation failures: - 1.Directory /dev and devices nodes /dev/null, /dev/console needed to be - created in kernfs - 3.Remove the creation of /null and /console node from the devices script. \ No newline at end of file + As of July 26.2007, the Glibc-based systems builds should work. + uClibc-based system still fail due book issues. diff --git a/TODO b/TODO new file mode 100644 index 0000000..e743e3f --- /dev/null +++ b/TODO @@ -0,0 +1,25 @@ + jhalfs TODO + --------------- + + +MASTER SCRIPT +------------- + + - Nothing for now. + + +xLFS MODULES +------------ + + - To develop a new "restart" Makefile target code to can resume an stopped build + after a host reboot, if possible. + + +BLFS MODULE (See BLFS/TODO) +----------- + + +OTHERS +------ + + - Bugs haunting and code clean-up. diff --git a/blfs-tool b/blfs-tool index bcb3d40..7f57fb0 100755 --- a/blfs-tool +++ b/blfs-tool @@ -38,13 +38,13 @@ declare -r L_arrow=$'\e[1;33m<\e[0m' simple_error() { # Basic error trap.... JUST DIE #-----------------------# # If +e then disable text output - if [[ "$-" =~ "e" ]]; then + if [[ "$-" =~ e ]]; then echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2 fi } see_ya() { - echo -e "\n${L_arrow}${BOLD}jhalfs-X${R_arrow} exit${OFF}\n" + echo -e "\n${L_arrow}${BOLD}jhalfs-trunk${R_arrow} exit${OFF}\n" } ##### Simple error TRAPS # ctrl-c SIGINT @@ -73,12 +73,12 @@ source configuration [[ $VERBOSITY > 0 ]] && echo "OK" [[ $VERBOSITY > 0 ]] && echo -n "Loading function ..." -source $COMMON_DIR/func_check_version.sh +source $COMMON_DIR/libs/func_check_version.sh [[ $? > 0 ]] && echo " function module did not load.." && exit 2 [[ $VERBOSITY > 0 ]] && echo "OK" [[ $VERBOSITY > 0 ]] && echo -n "Loading function ..." -source $COMMON_DIR/func_validate_configs.sh +source $COMMON_DIR/libs/func_validate_configs.sh [[ $? > 0 ]] && echo " function module did not load.." && exit 2 [[ $VERBOSITY > 0 ]] && echo "OK" [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}" @@ -95,8 +95,8 @@ case $BRANCH_ID in *EDIT* ) echo " You forgot to set the branch or stable book version." echo " Please rerun make and fix the configuration." exit 2 ;; - branch-* ) TREE=branches/${BRANCH_ID#branch-}/BOOK ;; - * ) TREE=tags/${BRANCH_ID}/BOOK ;; + branch-* ) TREE=branches/${BRANCH_ID#branch-} ;; + * ) TREE=tags/${BRANCH_ID} ;; esac # Check for minimun dependencies versions @@ -112,8 +112,8 @@ check_version "2004" "${tidyVer}" XML_FILE=" - +
Test file @@ -123,18 +123,18 @@ XML_FILE="
" if `echo $XML_FILE | xmllint -noout -postvalid - 2>/dev/null` ; then - check_version "4.4" "4.4" "DocBook XML DTD" + check_version "4.5" "4.5" "DocBook XML DTD" else - echo "Warning: not found a working DocBook XML DTD 4.4 installation" + echo "Warning: not found a working DocBook XML DTD 4.5 installation" exit 2 fi -if `echo $XML_FILE | xsltproc --noout - 2>/dev/null` ; then - check_version "1.69.1" "1.69.1" "DocBook XSL" -else - echo "Warning: not found a working DocBook XSL 1.69.1 installation" - exit 2 -fi +# if `echo $XML_FILE | xsltproc --noout - 2>/dev/null` ; then +# check_version "1.69.1" "1.69.1" "DocBook XSL" +# else +# echo "Warning: not found a working DocBook XSL 1.69.1 installation" +# exit 2 +# fi echo "${SD_BORDER}${nl_}" @@ -178,5 +178,5 @@ else fi # Run the menuconfig interface -make +make -B diff --git a/common/blfs-tool-deps/901-libxml2 b/common/blfs-tool-deps/901-libxml2 index e2c2222..5c48d38 100644 --- a/common/blfs-tool-deps/901-libxml2 +++ b/common/blfs-tool-deps/901-libxml2 @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # $Id$ diff --git a/common/blfs-tool-deps/902-libxslt b/common/blfs-tool-deps/902-libxslt index e2c2222..5c48d38 100644 --- a/common/blfs-tool-deps/902-libxslt +++ b/common/blfs-tool-deps/902-libxslt @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # $Id$ diff --git a/common/blfs-tool-deps/903-tidy b/common/blfs-tool-deps/903-tidy index c8b70b4..b3053c1 100644 --- a/common/blfs-tool-deps/903-tidy +++ b/common/blfs-tool-deps/903-tidy @@ -1,24 +1,13 @@ -#!/bin/sh +#!/bin/bash # $Id$ set -e cd $PKGDIR -patch -Np1 -i ../tidy-051026-prevent_PRE_newlines-1.patch -sh build/gnuauto/setup.sh ./configure --prefix=/usr make make install -(cd ../ && tar -xvf tidy_docs_051020.tgz) -cd htmldoc -tidy -xml-help > tidy-help.xml -tidy -xml-config > tidy-config.xml -xsltproc -o tidy.1 tidy1.xsl tidy-help.xml -xsltproc -o quickref.html quickref-html.xsl tidy-config.xml -cd .. -install -v -m644 htmldoc/tidy.1 /usr/share/man/man1 -install -v -m755 -d /usr/share/doc/tidy-051020 -cp -v -R htmldoc/* /usr/share/doc/tidy-051020 +make -C htmldoc install_apidocs exit diff --git a/common/blfs-tool-deps/904-unzip b/common/blfs-tool-deps/904-unzip index 28dcf1f..c25e898 100644 --- a/common/blfs-tool-deps/904-unzip +++ b/common/blfs-tool-deps/904-unzip @@ -1,10 +1,11 @@ -#!/bin/sh +#!/bin/bash # $Id$ set -e cd $PKGDIR +patch -Np1 -i ../unzip-5.52-security_fix-1.patch make -f unix/Makefile LOCAL_UNZIP=-D_FILE_OFFSET_BITS=64 linux make prefix=/usr install diff --git a/common/blfs-tool-deps/905-docbook-xml b/common/blfs-tool-deps/905-docbook-xml index 15b398e..ccd0a86 100644 --- a/common/blfs-tool-deps/905-docbook-xml +++ b/common/blfs-tool-deps/905-docbook-xml @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # $Id$ @@ -7,58 +7,58 @@ set -e cd /sources mkdir docbook-xml cd docbook-xml -unzip ../docbook-xml-4.4.zip -install -v -d -m755 /usr/share/xml/docbook/xml-dtd-4.4 +unzip ../docbook-xml-4.5.zip +install -v -d -m755 /usr/share/xml/docbook/xml-dtd-4.5 install -v -d -m755 /etc/xml chown -R root:root . cp -v -af docbook.cat *.dtd ent/ *.mod \ - /usr/share/xml/docbook/xml-dtd-4.4 + /usr/share/xml/docbook/xml-dtd-4.5 if [ ! -e /etc/xml/docbook ]; then xmlcatalog --noout --create /etc/xml/docbook fi xmlcatalog --noout --add "public" \ - "-//OASIS//DTD DocBook XML V4.4//EN" \ - "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" \ + "-//OASIS//DTD DocBook XML V4.5//EN" \ + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" \ /etc/xml/docbook xmlcatalog --noout --add "public" \ - "-//OASIS//DTD DocBook XML CALS Table Model V4.4//EN" \ - "file:///usr/share/xml/docbook/xml-dtd-4.4/calstblx.dtd" \ + "-//OASIS//DTD DocBook XML CALS Table Model V4.5//EN" \ + "file:///usr/share/xml/docbook/xml-dtd-4.5/calstblx.dtd" \ /etc/xml/docbook xmlcatalog --noout --add "public" \ "-//OASIS//DTD XML Exchange Table Model 19990315//EN" \ - "file:///usr/share/xml/docbook/xml-dtd-4.4/soextblx.dtd" \ + "file:///usr/share/xml/docbook/xml-dtd-4.5/soextblx.dtd" \ /etc/xml/docbook xmlcatalog --noout --add "public" \ - "-//OASIS//ELEMENTS DocBook XML Information Pool V4.4//EN" \ - "file:///usr/share/xml/docbook/xml-dtd-4.4/dbpoolx.mod" \ + "-//OASIS//ELEMENTS DocBook XML Information Pool V4.5//EN" \ + "file:///usr/share/xml/docbook/xml-dtd-4.5/dbpoolx.mod" \ /etc/xml/docbook xmlcatalog --noout --add "public" \ - "-//OASIS//ELEMENTS DocBook XML Document Hierarchy V4.4//EN" \ - "file:///usr/share/xml/docbook/xml-dtd-4.4/dbhierx.mod" \ + "-//OASIS//ELEMENTS DocBook XML Document Hierarchy V4.5//EN" \ + "file:///usr/share/xml/docbook/xml-dtd-4.5/dbhierx.mod" \ /etc/xml/docbook xmlcatalog --noout --add "public" \ - "-//OASIS//ELEMENTS DocBook XML HTML Tables V4.4//EN" \ - "file:///usr/share/xml/docbook/xml-dtd-4.4/htmltblx.mod" \ + "-//OASIS//ELEMENTS DocBook XML HTML Tables V4.5//EN" \ + "file:///usr/share/xml/docbook/xml-dtd-4.5/htmltblx.mod" \ /etc/xml/docbook xmlcatalog --noout --add "public" \ - "-//OASIS//ENTITIES DocBook XML Notations V4.4//EN" \ - "file:///usr/share/xml/docbook/xml-dtd-4.4/dbnotnx.mod" \ + "-//OASIS//ENTITIES DocBook XML Notations V4.5//EN" \ + "file:///usr/share/xml/docbook/xml-dtd-4.5/dbnotnx.mod" \ /etc/xml/docbook xmlcatalog --noout --add "public" \ - "-//OASIS//ENTITIES DocBook XML Character Entities V4.4//EN" \ - "file:///usr/share/xml/docbook/xml-dtd-4.4/dbcentx.mod" \ + "-//OASIS//ENTITIES DocBook XML Character Entities V4.5//EN" \ + "file:///usr/share/xml/docbook/xml-dtd-4.5/dbcentx.mod" \ /etc/xml/docbook xmlcatalog --noout --add "public" \ - "-//OASIS//ENTITIES DocBook XML Additional General Entities V4.4//EN" \ - "file:///usr/share/xml/docbook/xml-dtd-4.4/dbgenent.mod" \ + "-//OASIS//ENTITIES DocBook XML Additional General Entities V4.5//EN" \ + "file:///usr/share/xml/docbook/xml-dtd-4.5/dbgenent.mod" \ /etc/xml/docbook xmlcatalog --noout --add "rewriteSystem" \ - "http://www.oasis-open.org/docbook/xml/4.4" \ - "file:///usr/share/xml/docbook/xml-dtd-4.4" \ + "http://www.oasis-open.org/docbook/xml/4.5" \ + "file:///usr/share/xml/docbook/xml-dtd-4.5" \ /etc/xml/docbook xmlcatalog --noout --add "rewriteURI" \ - "http://www.oasis-open.org/docbook/xml/4.4" \ - "file:///usr/share/xml/docbook/xml-dtd-4.4" \ + "http://www.oasis-open.org/docbook/xml/4.5" \ + "file:///usr/share/xml/docbook/xml-dtd-4.5" \ /etc/xml/docbook if [ ! -e /etc/xml/catalog ]; then xmlcatalog --noout --create /etc/xml/catalog @@ -79,7 +79,7 @@ xmlcatalog --noout --add "delegateURI" \ "http://www.oasis-open.org/docbook/" \ "file:///etc/xml/docbook" \ /etc/xml/catalog -for DTDVERSION in 4.1.2 4.2 4.3 +for DTDVERSION in 4.1.2 4.2 4.3 4.4 do xmlcatalog --noout --add "public" \ "-//OASIS//DTD DocBook XML V$DTDVERSION//EN" \ @@ -87,11 +87,11 @@ do /etc/xml/docbook xmlcatalog --noout --add "rewriteSystem" \ "http://www.oasis-open.org/docbook/xml/$DTDVERSION" \ - "file:///usr/share/xml/docbook/xml-dtd-4.4" \ + "file:///usr/share/xml/docbook/xml-dtd-4.5" \ /etc/xml/docbook xmlcatalog --noout --add "rewriteURI" \ "http://www.oasis-open.org/docbook/xml/$DTDVERSION" \ - "file:///usr/share/xml/docbook/xml-dtd-4.4" \ + "file:///usr/share/xml/docbook/xml-dtd-4.5" \ /etc/xml/docbook xmlcatalog --noout --add "delegateSystem" \ "http://www.oasis-open.org/docbook/xml/$DTDVERSION/" \ diff --git a/common/blfs-tool-deps/906-docbook-xsl b/common/blfs-tool-deps/906-docbook-xsl index 38fa37b..7610d77 100644 --- a/common/blfs-tool-deps/906-docbook-xsl +++ b/common/blfs-tool-deps/906-docbook-xsl @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # $Id$ diff --git a/common/blfs-tool-deps/907-gpm b/common/blfs-tool-deps/907-gpm index cd977b5..fa2ca01 100644 --- a/common/blfs-tool-deps/907-gpm +++ b/common/blfs-tool-deps/907-gpm @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # $Id$ diff --git a/common/blfs-tool-deps/908-links b/common/blfs-tool-deps/908-links deleted file mode 100644 index 310e617..0000000 --- a/common/blfs-tool-deps/908-links +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -# $Id$ - -set -e -cd $PKGDIR - -./configure --prefix=/usr -make CFLAGS="-O2 -Wno-sign-compare -Wno-pointer-sign" -make install - -exit diff --git a/common/blfs-tool-deps/908-lynx b/common/blfs-tool-deps/908-lynx new file mode 100644 index 0000000..64e81c7 --- /dev/null +++ b/common/blfs-tool-deps/908-lynx @@ -0,0 +1,19 @@ +#!/bin/bash + +# $Id$ + +set -e +cd $PKGDIR + +./configure --prefix=/usr \ + --sysconfdir=/etc/lynx \ + --datadir=/usr/share/doc/lynx-2.8.6 \ + --with-zlib \ + --with-bzlib \ + --with-screen=ncursesw \ + --enable-locale-charset +make +make install-full +chgrp -v -R root /usr/share/doc/lynx-2.8.6/lynx_doc + +exit diff --git a/common/blfs-tool-deps/909-sudo b/common/blfs-tool-deps/909-sudo index bfc84ff..e906ed3 100644 --- a/common/blfs-tool-deps/909-sudo +++ b/common/blfs-tool-deps/909-sudo @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # $Id$ diff --git a/common/blfs-tool-deps/910-wget b/common/blfs-tool-deps/910-wget index 357a6ca..70e577c 100644 --- a/common/blfs-tool-deps/910-wget +++ b/common/blfs-tool-deps/910-wget @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # $Id$ diff --git a/common/blfs-tool-deps/911-subversion b/common/blfs-tool-deps/911-subversion index d02703f..48a65dc 100644 --- a/common/blfs-tool-deps/911-subversion +++ b/common/blfs-tool-deps/911-subversion @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # $Id$ diff --git a/common/common-functions b/common/common-functions index 712986e..dc510d4 100644 --- a/common/common-functions +++ b/common/common-functions @@ -12,10 +12,10 @@ ${DD_BORDER} ${tab_}${tab_}${BOLD}${RED}W A R N I N G${OFF} Looks like the \$BUILDDIR directory contains subdirectories - from a previous HLFS build. + from a previous build. Please format the partition mounted on \$BUILDDIR or set - a different build directory before running jhalfs-X. + a different build directory before running jhalfs. ${OFF} ${DD_BORDER} -EOF- @@ -23,384 +23,12 @@ ${DD_BORDER} } -HEADER="# This file is automatically generated by jhalfs-X -# DO NOT EDIT THIS FILE MANUALLY -# -# Generated on `date \"+%F %X %Z\"`" - - -#------------------------------------------------------# -# NEW Makefile scripting functions # -#------------------------------------------------------# - - -unset get_package_tarball_name -#----------------------------------# -get_package_tarball_name() { # -#----------------------------------# - local script_name=$1 - - # The use of 'head' is necessary to limit the return value to the FIRST match.. - # hopefully this will not cause problems. - # - case $script_name in - tcl) echo $(grep "^tcl" $JHALFSDIR/pkg_tarball_list | head -n1 ) - ;; - linux-headers) - if [ "${PROGNAME}" = "lfs" ]; then - # Uses kernel headers directly - echo $(grep "^linux-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) - else - # CLFS/CLFS use massaged headers package - echo $(grep "^linux-headers-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) - fi - ;; - *) echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) - ;; - esac - -} - - -unset wrt_RunaAsRoot -#----------------------------------# -wrt_RunAsRoot() { # Some scripts must be run as root.. -#----------------------------------# - local ENV_MOUNT - local this_script=$1 - local file=$2 - - case ${PROGNAME} in - lfs ) MOUNT_ENV="LFS" ;; - blfs ) MOUNT_ENV="BLFS" ;; - clfs ) MOUNT_ENV="CLFS" ;; - clfs2 ) MOUNT_ENV="CLFS" ;; - hlfs ) MOUNT_ENV="HLFS" ;; - *) echo "undefined progname $PROGNAME"; exit 1 ;; - esac - -( -cat << EOF - @( time { export ${MOUNT_ENV}=\$(MOUNT_PT) && ${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@ 2>&1 ; } ) 2>>logs/\$@ && \\ - \$(PRT_DU_CR) >>logs/\$@ -EOF -) >> $MKFILE.tmp -} - - -#------------------------------------------------------# -#------------------------------------------------------# - -#----------------------------------# -ROOT_RunAsRoot() { # -#----------------------------------# - local file=$1 -( -cat << EOF - @( time { source envars && \$(CMDSDIR)/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\ - \$(PRT_DU_CR) >>logs/$this_script -EOF -) >> $MKFILE.tmp -} - -#----------------------------------# -ROOT_Unpack() { # An alias, for clairity -#----------------------------------# - local FILE=$1 - local optSAVE_PREVIOUS=$2 - - if [[ "${optSAVE_PREVIOUS}" != "1" ]]; then -( -cat << EOF - @\$(call remove_existing_dirs,$FILE) -EOF -) >> $MKFILE.tmp - fi - -( -cat << EOF - @\$(call unpack,$FILE) - @\$(call get_pkg_root_LUSER) -EOF -) >> $MKFILE.tmp -} - -#------------------------------------------------------# -#------------------------------------------------------# - -#----------------------------------# -LUSER_wrt_target() { # Create target and initialize log file -#----------------------------------# - local i=$1 - local PREV=$2 -( -cat << EOF - -$i: $PREV - @\$(call echo_message, Building) - @./progress_bar.sh \$@ \$\$PPID & - @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) \$(MOUNT_PT)\`\n" >logs/\$@ -EOF -) >> $MKFILE.tmp -} - - -#----------------------------------# -LUSER_wrt_RunAsUser() { # Execute script inside time { }, footer to log file -#----------------------------------# - local file=$1 - -( -cat << EOF - @( time { source ~/.bashrc && \$(CMDSDIR)/`dirname $file`/\$@ >> logs/\$@ 2>&1; } ) 2>> logs/\$@ && \\ - \$(PRT_DU) >> logs/\$@ -EOF -) >> $MKFILE.tmp -} - - -#----------------------------------# -LUSER_wrt_unpack() { # Unpack and set 'ROOT' var -#----------------------------------# - local FILE=$1 - local optSAVE_PREVIOUS=$2 - - if [[ "${optSAVE_PREVIOUS}" != "1" ]]; then -( -cat << EOF - @\$(call remove_existing_dirs,$FILE) -EOF -) >> $MKFILE.tmp - fi - -( -cat << EOF - @\$(call unpack,$FILE) - @\$(call get_pkg_root_LUSER) -EOF -) >> $MKFILE.tmp - -} - - -#----------------------------------# -LUSER_wrt_CopyFstab() { # -#----------------------------------# -( -cat << EOF - @( time { cp -v \$(MOUNT_PT)/sources/fstab \$(MOUNT_PT)/etc/fstab >>logs/\$@ 2>&1 ; } ) 2>>logs/\$@ -EOF -) >> $MKFILE.tmp -} - - -#----------------------------------# -LUSER_wrt_test_log() { # Initialize testsuite log file -#----------------------------------# - local TESTLOGFILE=$1 -( -cat << EOF - @echo "export TEST_LOG=$TESTLOGDIR/$TESTLOGFILE" >> envars && \\ - echo -e '\n\`date\`\n' >$TESTLOGDIR/$TESTLOGFILE -EOF -) >> $MKFILE.tmp -} - - -#----------------------------------# -LUSER_RemoveBuildDirs() { # -#----------------------------------# - local name=$1 -( -cat << EOF - @\$(call remove_build_dirs,$name) -EOF -) >> $MKFILE.tmp -} - -#-----------------------------------------------------------------# -#-----------------------------------------------------------------# - -#----------------------------------# -CHROOT_wrt_target() { # Create target and initialize log file -#----------------------------------# - local i=$1 - local PREV=$2 - case $i in - iteration* ) local LOGFILE="${this_script}.log" ;; - * ) local LOGFILE="${this_script}" ;; - esac -( -cat << EOF - -$i: $PREV - @\$(call echo_message, Building) - @./progress_bar.sh \$@ \$\$PPID & - @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) / \`\n" >logs/$LOGFILE -EOF -) >> $MKFILE.tmp -} - - -#----------------------------------# -CHROOT_Unpack() { # -#----------------------------------# - local FILE=$1 - local optSAVE_PREVIOUS=$2 - - if [ "${optSAVE_PREVIOUS}" != "1" ]; then -( -cat << EOF - @\$(call remove_existing_dirs2,$FILE) -EOF -) >> $MKFILE.tmp - fi -( -cat << EOF - @\$(call unpack3,$FILE) - @\$(call get_pkg_root2) -EOF -) >> $MKFILE.tmp -} - - -#----------------------------------# -CHROOT_wrt_test_log() { # -#----------------------------------# - local TESTLOGFILE=$1 -( -cat << EOF - @echo "export TEST_LOG=/\$(SCRIPT_ROOT)/test-logs/$TESTLOGFILE" >> envars && \\ - echo -e "\n\`date\`\n" >test-logs/$TESTLOGFILE -EOF -) >> $MKFILE.tmp -} - - -#----------------------------------# -CHROOT_wrt_RunAsRoot() { # -#----------------------------------# - local file=$1 -( -cat << EOF - @( time { source envars && \$(crCMDSDIR)/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\ - \$(PRT_DU_CR) >>logs/$this_script -EOF -) >> $MKFILE.tmp - -} - - -#----------------------------------# -CHROOT_wrt_CopyFstab() { # -#----------------------------------# -( -cat << EOF - @( time { cp -v /sources/fstab /etc/fstab >>logs/${this_script} 2>&1 ; } ) 2>>logs/${this_script} -EOF -) >> $MKFILE.tmp -} - - -#----------------------------------# -CHROOT_wrt_RemoveBuildDirs() { # -#----------------------------------# - local name=$1 -( -cat << EOF - @\$(call remove_build_dirs2,$name) -EOF -) >> $MKFILE.tmp -} - - -unset wrt_touch -#----------------------------------# -wrt_touch() { # -#----------------------------------# -( -cat << EOF - @\$(call housekeeping) -EOF -) >> $MKFILE.tmp -} - - -#----------------------------------# -wrt_blfs_tool_targets() { # -#----------------------------------# - - echo "${tab_}${GREEN}Processing... ${L_arrow}BLFS_TOOL ${R_arrow}" - - for file in blfs-tool-deps/* ; do - # Keep the script file name - this_script=`basename $file` - - # Grab the name of the target - name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@'` - - # Find the package. - case $name in - tidy ) pkg_tarball=${TIDY_PKG} ;; - unzip ) pkg_tarball=${UNZIP_PKG} ;; - * ) pkg_tarball=$(get_package_tarball_name $name) ;; - esac - - # Append each name of the script files to a list (this will become - # the names of the targets in the Makefile) - blfs_tool="$blfs_tool ${this_script}" - - #--------------------------------------------------------------------# - # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # - #--------------------------------------------------------------------# - # - # Drop in the name of the target on a new line, and the previous target - # as a dependency. Also call the echo_message function. - CHROOT_wrt_target "${this_script}" "$PREV" - - # Insert instructions for unpacking the package and changing directories - # DocBook-XML is a zip, the build script will handle that. - [[ ! "$name" = "docbook-xml" ]] && CHROOT_Unpack "$pkg_tarball" - - # Run the script. - CHROOT_wrt_RunAsRoot "$file" - - # Remove the build directory(ies) except if the package build fails. - [[ ! "$name" = "docbook-xml" ]] && CHROOT_wrt_RemoveBuildDirs "$name" - - # Touch the tracking file. - case $name in - tidy ) pkg_ver=tidy-051026 ;; - unzip ) pkg_ver=unzip-5.52 ;; - * ) pkg_ver=$(echo $pkg_tarball | sed -e 's/.tar.*//;s/.tgz//;s/.zip//') ;; - esac - echo -e "\t@touch $TRACKING_DIR/$pkg_ver" >> $MKFILE.tmp - - # Include a touch of the target name so make can check - # if it's already been made. - wrt_touch - # - #--------------------------------------------------------------------# - # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # - #--------------------------------------------------------------------# - - # Keep the script file name for Makefile dependencies. - PREV=${this_script} - done -} - -#------------------------------------------------------# -# END Makefile scripting functions # -#------------------------------------------------------# - - - #----------------------------# run_make() { # #----------------------------# # Test if make must be run. if [ "$RUNMAKE" = "y" ] ; then - # Test to make sure we're running the build as root + # Test to make sure we're not running the build as root if [ "$UID" = "0" ] ; then echo "You must not be logged in as root to build the system." exit 1 @@ -422,12 +50,24 @@ clean_builddir() { # if [ "${CLEAN}" = "y" ]; then # Test to make sure that the build directory was populated by jhalfs if [ ! -d $JHALFSDIR ] || [ ! -d $BUILDDIR/sources ] ; then - echo "Looks like $BUILDDIR was not populated by a previous jhalfs-X run." + echo "Looks like $BUILDDIR was not populated by a previous jhalfs run." + exit 1 + # Test that dev filesystems are not mounted in $BUILDDIR + elif mount | grep $BUILDDIR/dev > /dev/null ; then + echo "Looks like kernel fylesystems are yet mounted on $BUILDDIR." exit 1 else # Clean the build directory echo -n "Cleaning $BUILDDIR ..." - sudo rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,tools,cross-tools,usr,var} + # First delete proc and sys directories, if exist. + # Both should be empty, if not be sure to exit. + if [ -d $BUILDDIR/proc ] ; then + sudo rmdir $BUILDDIR/proc || exit 1 + fi + if [ -d $BUILDDIR/sys ] ; then + sudo rmdir $BUILDDIR/sys || exit 1 + fi + sudo rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib,media,mnt,opt,root,sbin,srv,tmp,tools,cross-tools,usr,var} echo "done" echo -n "Cleaning $JHALFSDIR ..." sudo rm -rf $JHALFSDIR @@ -439,481 +79,31 @@ clean_builddir() { # fi } -#----------------------------# -get_book() { # -#----------------------------# - cd $JHALFSDIR +VERBOSITY2=$VERBOSITY - if [ -z $WORKING_COPY ] ; then - # Check for Subversion instead of just letting the script hit 'svn' and fail. - test `type -p svn` || eval "echo \"This feature requires Subversion.\" - exit 1" - echo -n "Downloading the $PROGNAME document, $LFSVRS version... " +[[ $VERBOSITY2 > 0 ]] && echo "" - case $PROGNAME in - lfs) svn_root="LFS" ;; - hlfs) svn_root="HLFS" ;; - clfs) svn_root="cross-lfs" ;; - clfs2) svn_root="cross-lfs" ;; - *) echo "BOOK not defined in function " - exit 1 ;; - esac - # Grab a fresh book if it's missing, otherwise, update it from the - # repo. If we've already extracted the commands, move on to getting the - # sources. - if [ -d ${PROGNAME}-$LFSVRS ] ; then - cd ${PROGNAME}-$LFSVRS - if LC_ALL=C svn up | grep -q At && \ - test -d $JHALFSDIR/${PROGNAME}-commands && \ - test -f $JHALFSDIR/pkg_tarball_list ; then - # Set the canonical book version - echo -ne "done\n" - cd $JHALFSDIR - case $PROGNAME in - clfs | clfs2) - VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;; - *) - VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;; - esac - get_sources - else - echo -ne "done\n" - extract_commands - fi - else - svn co $SVN/${svn_root}/${TREE} ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1 - echo -ne "done\n" - extract_commands - fi +[[ $VERBOSITY2 > 0 ]] && echo -n "Loading ..." +source $COMMON_DIR/libs/func_book_parser +[[ $? > 0 ]] && echo "file libs/func_book_parser did not load.." && exit 1 +[[ $VERBOSITY2 > 0 ]] && echo "OK" - else - echo -ne "Using $BOOK as book's sources ...\n" - extract_commands - fi - echo -ne " Document version ${L_arrow}${BOLD}${VERSION}${R_arrow}\n" -} -#----------------------------# -extract_commands() { # -#----------------------------# +[[ $VERBOSITY2 > 0 ]] && echo -n "Loading ..." +source $COMMON_DIR/libs/func_download_pkgs +[[ $? > 0 ]] && echo "file libs/func_download_pkgs did not load.." && exit 1 +[[ $VERBOSITY2 > 0 ]] && echo "OK" - # Check for libxslt instead of just letting the script hit 'xsltproc' and fail. - test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\" - exit 1" - cd $JHALFSDIR - case $PROGNAME in - clfs | clfs2 ) - VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;; - *) - VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;; - esac +[[ $VERBOSITY2 > 0 ]] && echo -n "Loading ..." +source $COMMON_DIR/libs/func_wrt_Makefile +[[ $? > 0 ]] && echo "file libs/func_wrt_Makefile did not load.." && exit 1 +[[ $VERBOSITY2 > 0 ]] && echo "OK" - # Start clean - if [ -d ${PROGNAME}-commands ]; then - rm -rf ${PROGNAME}-commands - mkdir -v ${PROGNAME}-commands - fi - echo -n "Extracting commands for" - # Dump the commands in shell script form from the HLFS book. - case ${PROGNAME} in - clfs) - echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture" - xsltproc --nonet \ - --xinclude \ - --stringparam method $METHOD \ - --stringparam testsuite $TEST \ - --stringparam bomb-testsuite $BOMB_TEST \ - --stringparam vim-lang $VIMLANG \ - --stringparam timezone $TIMEZONE \ - --stringparam page $PAGE \ - --stringparam lang $LANG \ - -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1 - ;; +[[ $VERBOSITY2 > 0 ]] && echo -n "Loading ..." +source $COMMON_DIR/libs/func_blfs_deps +[[ $? > 0 ]] && echo "file libs/func_blfs_deps did not load.." && exit 1 +[[ $VERBOSITY2 > 0 ]] && echo "OK" - clfs2) - echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture" - xsltproc --nonet \ - --xinclude \ - --stringparam vim-lang $VIMLANG \ - --stringparam timezone $TIMEZONE \ - --stringparam page $PAGE \ - --stringparam lang $LANG \ - -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1 - ;; - hlfs) - echo -n " ${L_arrow}${BOLD}$MODEL${R_arrow} HLFS libc implementation" - xsltproc --nonet \ - --xinclude \ - --stringparam model $MODEL \ - --stringparam testsuite $TEST \ - --stringparam bomb-testsuite $BOMB_TEST \ - --stringparam timezone $TIMEZONE \ - --stringparam page $PAGE \ - --stringparam lang $LANG \ - --stringparam lc_all $LC_ALL \ - --stringparam grsecurity_host $GRSECURITY_HOST \ - -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1 - ;; - lfs) - echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build" - xsltproc --nonet \ - --xinclude \ - --stringparam testsuite $TEST \ - --stringparam bomb-testsuite $BOMB_TEST \ - --stringparam vim-lang $VIMLANG \ - --stringparam timezone $TIMEZONE \ - --stringparam page $PAGE \ - --stringparam lang $LANG \ - -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1 - ;; - *) exit 1 ;; - esac - - [[ "${BLFS_TOOL}" = "y" ]] && copy_blfs_deps_scripts - - echo " ...OK" - - # Make the scripts executable. - chmod -R +x $JHALFSDIR/${PROGNAME}-commands - - # Create the packages file. We need it for proper Makefile creation - create_package_list - - # Done. Moving on... - get_sources - -} - -#----------------------------# -create_package_list() { # -#----------------------------# - - # Create the packages file. We need it for proper Makefile creation - rm -f pkg_tarball_list - echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK $ARCH" - case ${PROGNAME} in - clfs | clfs2) - xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \ - $BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1 - ;; - hlfs) - xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \ - $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1 - ;; - lfs) - xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \ - $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1 - ;; - esac - - if [[ "${BLFS_TOOL}" = "y" ]] ; then -( -cat << EOF -$LIBXML_PKG -$LIBXSLT_PKG -$TIDY_PKG -$UNZIP_PKG -$DBXML_PKG -$DBXSL_PKG -$LINKS_PKG -$SUDO_PKG -$WGET_PKG -$SVN_PKG -$GPM_PKG -EOF -) >> pkg_tarball_list - fi - - echo " ...OK" - -} - - -#----------------------------# -get_sources() { # Download file, write name to MISSING_FILES.DMP if an error -#----------------------------# - local saveIFS=$IFS - local IFS line URL1 URL2 FILE BOOKMD5 MD5 HAVEMD5 fromARCHIVE - - # Test if the packages must be downloaded - [ ! "$GETPKG" = "y" ] && return - - gs_wrt_message(){ - echo "${RED}$1${OFF}" - echo "$1" >> MISSING_FILES.DMP - } - # Housekeeping - [[ ! -d $BUILDDIR/sources ]] && mkdir $BUILDDIR/sources - cd $BUILDDIR/sources - [[ -f MD5SUMS ]] && rm MD5SUMS - [[ -f MISSING_FILES.DMP ]] && rm MISSING_FILES.DMP - [[ -f urls.lst ]] && rm urls.lst - - # Generate URLs file - create_urls - - IFS=$'\x0A' # Modify the 'internal field separator' to break on 'LF' only - for line in `cat urls.lst`; do - IFS=$saveIFS # Restore the system defaults - - # Skip some packages if they aren't needed - case $line in - */tcl* | */expect* | */dejagnu* | */tree* | */gcc-testsuite* ) - [[ "$TEST" = "0" ]] && continue - ;; - */vim-*-lang* ) - [[ "$VIMLANG" = "0" ]] && continue - ;; - *linux/linux-* ) - [[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] && \ - [[ "$GETKERNEL" = "n" ]] && continue - ;; - esac - - # Locations - URL1=`echo $line | cut -d" " -f2` # Preferred URL - URL2=`echo $line | cut -d" " -f1` # Fallback Upstream URL - FILE=`basename $URL1` # File name - BOOKMD5=`echo $line | cut -d" " -f3` # MD5 book value - - # Validation pair - MD5="$BOOKMD5 $FILE" - HAVEMD5=1 - - set -e - # If the file exists in the archive copy it to the - # $BUILDDIR/sources dir. MD5SUM will be validated later. - if [ ! -z ${SRC_ARCHIVE} ] && - [ -d ${SRC_ARCHIVE} ] && - [ -f ${SRC_ARCHIVE}/$FILE ]; then - cp ${SRC_ARCHIVE}/$FILE . - echo "$FILE: -- copied from $SRC_ARCHIVE" - fromARCHIVE=1 - else - echo "${BOLD}${YELLOW}$FILE: not found in ${SRC_ARCHIVE}${OFF}" - fromARCHIVE=0 - # If the file does not exist yet in /sources download a fresh one - if [ ! -f $FILE ] ; then - if ! wget $URL1 && ! wget $URL2 ; then - gs_wrt_message "$FILE not found in the SRC_ARCHIVE or on any server..SKIPPING" - continue - fi - fi - fi - - # IF the md5sum does not match the existing files - if ! echo "$MD5" | md5sum -c - >/dev/null ; then - [[ $fromARCHIVE = "1" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match SRC_ARCHIVE copy${OFF}" - [[ $fromARCHIVE = "0" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match REMOTE copy${OFF}" - # Remove the old file and download a new one - rm -fv $FILE - # Force storage in SRC_ARCHIVE - fromARCHIVE=0; - # Try to retrieve again the file. Servers in reverse order. - if ! wget $URL2 && ! wget $URL1 ; then - gs_wrt_message "$FILE not found on the servers.. SKIPPING" - continue - fi - fi - - # Validate the MD5SUM one last time - if ! echo "$MD5" | md5sum -c - >/dev/null ; then - gs_wrt_message "$FILE does not match MD5SUMS value" - # Force generation of MD5SUM - HAVEMD5=0 - fi - - # Generate a fresh MD5SUM for this file - if [[ "$HAVEMD5" = "0" ]] ; then - echo "${BOLD}${YELLOW}Generating a new MD5SUM for ${OFF}$FILE" - echo "NEW MD5SUM: $(md5sum $FILE)" >> MISSING_FILES.DMP - fi - - # Good or bad we write the original md5sum to a file - echo "$MD5" >> MD5SUMS - - # Copy the freshly downloaded file - # to the source archive. - if [ ! -z ${SRC_ARCHIVE} ] && - [ -d ${SRC_ARCHIVE} ] && - [ -w ${SRC_ARCHIVE} ] && - [ "$fromARCHIVE" = "0" ] ; then - echo "Storing file:<$FILE> in the package archive" - cp -f $FILE ${SRC_ARCHIVE} - fi - - done - - if [[ -s MISSING_FILES.DMP ]]; then - echo -e "\n\n${tab_}${RED} One or more files were not retrieved or have bad MD5SUMS.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n" - # Do not allow the automatic execution of the Makefile. - echo "${tab_}${BOLD}${RED}*** ${YELLOW}Automatic execution of the generated makefile has been inhibited. ${RED}***${OFF}${nl_}" - RUNMAKE="n" - fi -} - -#----------------------------# -create_urls() { # -#----------------------------# - cd $JHALFSDIR - - case ${PROGNAME} in - clfs) - echo -n "Creating CLFS <${ARCH}> specific URLs file" - xsltproc --nonet --xinclude \ - --stringparam server $SERVER \ - -o $BUILDDIR/sources/urls.lst urls.xsl \ - $BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1 - echo " ...OK" - ;; - clfs2) - echo -n "Creating CLFS2 <${ARCH}> specific URLs file" - xsltproc --nonet --xinclude \ - --stringparam server $SERVER \ - -o $BUILDDIR/sources/urls.lst urls.xsl \ - $BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1 - echo " ...OK" - ;; - hlfs) - echo -n "Creating HLFS <${MODEL}> specific URLs file" - xsltproc --nonet --xinclude \ - --stringparam server $SERVER \ - --stringparam model $MODEL \ - -o $BUILDDIR/sources/urls.lst urls.xsl \ - $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1 - echo " ...OK" - ;; - lfs) - echo -n "Creating LFS specific URLs file" - xsltproc --nonet --xinclude \ - --stringparam server $SERVER \ - -o ../sources/urls.lst urls.xsl \ - $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1 - echo " ...OK" - ;; - esac - - cd $BUILDDIR/sources - - if [[ "${BLFS_TOOL}" = "y" ]]; then - add_blfs_deps_urls - fi - - if [[ "${CUSTOM_TOOLS}" = "y" ]]; then - add_CustomToolsURLS - fi - -} - -#----------------------------# Hardcoded URLs and MD5. -add_blfs_deps_urls() { # No easy way to extract it. -#----------------------------# Some FTP mirrors may not work - - local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/" - - if [[ "${DEP_LIBXML}" = "y" ]] ; then - echo "${LIBXML_URL} ${BLFS_SERVER}libxml2/${LIBXML_PKG} ${LIBXML_MD5}" >> urls.lst - fi - - if [[ "${DEP_LIBXSLT}" = "y" ]] ; then - echo "${LIBXSLT_URL} ${BLFS_SERVER}libxslt/${LIBXSLT_PKG} ${LIBXSLT_MD5}" >> urls.lst - fi - - if [[ "${DEP_TIDY}" = "y" ]] ; then - echo "${TIDY_URL} ${BLFS_SERVER}tidy/${TIDY_PKG} ${TIDY_MD5}" >> urls.lst - echo "${TIDY_PATCH_URL} ${BLFS_SERVER}tidy/${TIDY_PATCH} ${TIDY_PATCH_MD5}" >> urls.lst - echo "${TIDY_DOCS_URL} ${BLFS_SERVER}tidy/${TIDY_DOCS} ${TIDY_DOCS_MD5}" >> urls.lst - fi - - if [[ "${DEP_UNZIP}" = "y" ]] ; then - echo "${UNZIP_URL} ${BLFS_SERVER}unzip/${UNZIP_PKG} ${UNZIP_MD5}" >> urls.lst - fi - - if [[ "${DEP_DBXML}" = "y" ]] ; then - echo "${DBXML_URL} ${BLFS_SERVER}docbook-xml/${DBXML_PKG} ${DBXML_MD5}" >> urls.lst - fi - - if [[ "${DEP_DBXSL}" = "y" ]] ; then - echo "${DBXSL_URL} ${BLFS_SERVER}docbook-xsl/${DBXSL_PKG} ${DBXSL_MD5}" >> urls.lst - fi - - if [[ "${DEP_LINKS}" = "y" ]] ; then - echo "${LINKS_URL} ${BLFS_SERVER}links/${LINKS_PKG} ${LINKS_MD5}" >> urls.lst - fi - - if [[ "${DEP_SUDO}" = "y" ]] ; then - echo "${SUDO_URL} ${BLFS_SERVER}sudo/${SUDO_PKG} ${SUDO_MD5}" >> urls.lst - echo "${SUDO_PATCH_URL} ${BLFS_SERVER}sudo/${SUDO_PATCH} ${SUDO_PATCH_MD5}" >> urls.lst - fi - - if [[ "${DEP_WGET}" = "y" ]] ; then - echo "${WGET_URL} ${BLFS_SERVER}wget/${WGET_PKG} ${WGET_MD5}" >> urls.lst - fi - - if [[ "${DEP_SVN}" = "y" ]] ; then - echo "${SVN_URL} ${BLFS_SERVER}subversion/${SVN_PKG} ${SVN_MD5}" >> urls.lst - fi - - if [[ "${DEP_GPM}" = "y" ]] ; then - echo "${GPM_URL} ${BLFS_SERVER}gpm/${GPM_PKG} ${GPM_MD5}" >> urls.lst - echo "${GPM_PATCH_1_URL} ${BLFS_SERVER}gpm/${GPM_PATCH_1} ${GPM_PATCH_1_MD5}" >> urls.lst - echo "${GPM_PATCH_2_URL} ${BLFS_SERVER}gpm/${GPM_PATCH_2} ${GPM_PATCH_2_MD5}" >> urls.lst - fi - -} - -#----------------------------# Maybe there is a better way to do this, but this -copy_blfs_deps_scripts() { # method avoid to place the test on all -#----------------------------# $PROGNAME/master.sh scripts. - - mkdir -p ${PROGNAME}-commands/blfs-tool-deps - - if [[ "${DEP_LIBXML}" = "y" ]] ; then - mv blfs-tool-deps/901-libxml2 ${PROGNAME}-commands/blfs-tool-deps - fi - - if [[ "${DEP_LIBXSLT}" = "y" ]] ; then - mv blfs-tool-deps/902-libxslt ${PROGNAME}-commands/blfs-tool-deps - fi - - if [[ "${DEP_TIDY}" = "y" ]] ; then - mv blfs-tool-deps/903-tidy ${PROGNAME}-commands/blfs-tool-deps - fi - - if [[ "${DEP_UNZIP}" = "y" ]] ; then - mv blfs-tool-deps/904-unzip ${PROGNAME}-commands/blfs-tool-deps - fi - - if [[ "${DEP_DBXML}" = "y" ]] ; then - mv blfs-tool-deps/905-docbook-xml ${PROGNAME}-commands/blfs-tool-deps - fi - - if [[ "${DEP_DBXSL}" = "y" ]] ; then - mv blfs-tool-deps/906-docbook-xsl ${PROGNAME}-commands/blfs-tool-deps - fi - - if [[ "${DEP_LINKS}" = "y" ]] ; then - mv blfs-tool-deps/908-links ${PROGNAME}-commands/blfs-tool-deps - fi - - if [[ "${DEP_SUDO}" = "y" ]] ; then - mv blfs-tool-deps/909-sudo ${PROGNAME}-commands/blfs-tool-deps - fi - - if [[ "${DEP_WGET}" = "y" ]] ; then - mv blfs-tool-deps/910-wget ${PROGNAME}-commands/blfs-tool-deps - fi - - if [[ "${DEP_SVN}" = "y" ]] ; then - mv blfs-tool-deps/911-subversion ${PROGNAME}-commands/blfs-tool-deps - fi - - if [[ "${DEP_GPM}" = "y" ]] ; then - mv blfs-tool-deps/907-gpm ${PROGNAME}-commands/blfs-tool-deps - fi - - rm -rf blfs-tool-deps - -} +[[ $VERBOSITY2 > 0 ]] && echo -n " ..." \ No newline at end of file diff --git a/common/create-sbu_du-report.sh b/common/create-sbu_du-report.sh index a49396e..e0a44ed 100755 --- a/common/create-sbu_du-report.sh +++ b/common/create-sbu_du-report.sh @@ -6,6 +6,8 @@ set -e LOGSDIR=$1 VERSION=$2 +LINE="================================================================================" + # Make sure that we have a directory as first argument [[ ! -d "$LOGSDIR" ]] && \ echo -e "\nUSAGE: create-sbu_du-report.sh logs_directory [book_version]\n" && exit @@ -19,12 +21,14 @@ VERSION=$2 # If there is iteration logs directories, copy the logs inside iteration-1 # to the top level dir -[[ -d "$LOGSDIR"/iteration-1 ]] && \ - cp $LOGSDIR/iteration-1/* $LOGSDIR +[[ -d "$LOGSDIR"/build_1 ]] && \ + cp $LOGSDIR/build_1/* $LOGSDIR # Set the report file REPORT="$VERSION"-SBU_DU-$(date --iso-8601).report +[ -f $REPORT ] && : >$REPORT + # Dump generation time stamp and book version echo -e "\n`date`\n" > "$REPORT" echo -e "Book version is:\t$VERSION\n" >> "$REPORT" @@ -44,82 +48,74 @@ echo -e "\n\t\tMemory info:\n" >> "$REPORT" free >> "$REPORT" # Parse only that logs that have time data -BUILDLOGS=`grep -l "^real\>" $LOGSDIR/*` +BUILDLOGS="`grep -l "^Totalseconds:" ${LOGSDIR}/*`" # Match the first timed log to extract the SBU unit value from it -BASELOG=`grep -l "^real\>" $LOGSDIR/* | head -n1` -echo -e "\n\nUsing $BASELOG to obtain the SBU unit value." >> "$REPORT" -BASEMINUTES=`grep "^real\>" $BASELOG | cut -f2 | sed -e 's/m.*//'` -BASESECONDS=`grep "^real\>" $BASELOG | cut -f2 | sed -e 's/.*m//;s/s//'` -SBU_UNIT=`echo "scale=3; $BASEMINUTES * 60 + $BASESECONDS" | bc` -echo -e "The SBU unit value is equal to $SBU_UNIT seconds.\n" >> "$REPORT" +BASELOG=`grep -l "^Totalseconds:" $LOGSDIR/* | head -n1` +echo -e "\nUsing ${BASELOG#*[[:digit:]]-} to obtain the SBU unit value." +SBU_UNIT=`sed -n 's/^Totalseconds:\s\([[:digit:]]*\)$/\1/p' $BASELOG` +echo -e "\nThe SBU unit value is equal to $SBU_UNIT seconds.\n" +echo -e "\n\n$LINE\n\nThe SBU unit value is equal to $SBU_UNIT seconds.\n" >> "$REPORT" # Set the first value to 0 for grand totals calculation SBU2=0 INSTALL2=0 INSTALLMB2=0 +# Start the loop for log in $BUILDLOGS ; do -#Start SBU calculation - # Build time - BUILDTIME=`grep "^real\>" $log | cut -f2` - # Build time in seconds - MINUTES=`grep "^real\>" $log | cut -f2 | sed -e 's/m.*//'` - SECS=`grep "^real\>" $log | cut -f2 | sed -e 's/.*m//;s/s//'` - TIME=`echo "scale=3; $MINUTES * 60 + $SECS" | bc` - # Calculate build time in SBU - SBU=`echo "scale=3; $TIME / $SBU_UNIT" | bc` - # Append SBU value to SBU2 for grand total - SBU2="$SBU2 + $SBU" +# Strip the filename + PACKAGE="${log#*[[:digit:]]*-}" -#Start disk usage calculation - # Disk usage before unpacking the package +# Start SBU calculation +# Build time + TIME=`sed -n 's/^Totalseconds:\s\([[:digit:]]*\)$/\1/p' $log` + SECS=`perl -e 'print ('$TIME' % '60')';` + MINUTES=`perl -e 'printf "%.0f" , (('$TIME' - '$SECS') / '60')';` + SBU=`perl -e 'printf "%.1f" , ('$TIME' / '$SBU_UNIT')';` + +# Append SBU value to SBU2 for grand total + SBU2=`perl -e 'printf "%.1f" , ('$SBU2' + '$SBU')';` + +# Start disk usage calculation +# Disk usage before unpacking the package DU1=`grep "^KB: " $log | head -n1 | cut -f1 | sed -e 's/KB: //'` - DU1MB=`echo "scale=2; $DU1 / 1024" | bc` - # Disk usage before deleting the source and build dirs + DU1MB=`perl -e 'printf "%.3f" , ('$DU1' / '1024')';` +# Disk usage before deleting the source and build dirs DU2=`grep "^KB: " $log | tail -n1 | cut -f1 | sed -e 's/KB: //'` - DU2MB=`echo "scale=2; $DU2 / 1024" | bc` - # Calculate disk space required to do the build - REQUIRED1=`echo "$DU2 - $DU1" | bc` - REQUIRED2=`echo "scale=2; $DU2MB - $DU1MB" | bc` + DU2MB=`perl -e 'printf "%.3f" , ('$DU2' / '1024')';` +# Calculate disk space required to do the build + REQUIRED1=`perl -e 'print ('$DU2' - '$DU1')';` + REQUIRED2=`perl -e 'printf "%.3f" , ('$DU2MB' - '$DU1MB')';` - # Append installed files disk usage to the previous entry, - # except for the first parsed log +# Append installed files disk usage to the previous entry, +# except for the first parsed log if [ "$log" != "$BASELOG" ] ; then - INSTALL=`echo "$DU1 - $DU1PREV" | bc` - INSTALLMB=`echo "scale=2; $DU1MB - $DU1MBPREV" | bc` - echo -e "Installed files disk usage:\t\t\t\t$INSTALL KB or $INSTALLMB MB\n" >> "$REPORT" + INSTALL=`perl -e 'print ('$DU1' - '$DU1PREV')';` + INSTALLMB=`perl -e 'printf "%.3f" , ('$DU1MB' - '$DU1MBPREV')';` + echo -e "Installed files disk usage:\t\t\t\t$INSTALL KB or $INSTALLMB MB\n" >> $REPORT # Append install values for grand total - INSTALL2="$INSTALL2 + $INSTALL" - INSTALLMB2="$INSTALLMB2 + $INSTALLMB" + INSTALL2=`perl -e 'printf "%.3f" , ('$INSTALL2' + '$INSTALL')';` + INSTALLMB2=`perl -e 'printf "%.3f" , ('$INSTALLMB2' + '$INSTALLMB')';` fi - # Set variables to calculate installed files disk usage +# Set variables to calculate installed files disk usage DU1PREV=$DU1 DU1MBPREV=$DU1MB - # Append log name - echo -e "\n\t$log" >> "$REPORT" - - # Dump time values - echo -e "Build time is:\t\t\t$BUILDTIME" >> "$REPORT" - echo -e "Build time in seconds is\t$TIME" >> "$REPORT" - echo -e "Approximate SBU time is:\t$SBU" >> "$REPORT" - - # Dump disk usage values - echo -e "\nDisk usage before unpacking the package:\t\t$DU1 KB or $DU1MB MB" >> "$REPORT" - echo -e "Disk usage before deleting the source and build dirs:\t$DU2 KB or $DU2MB MB" >> "$REPORT" - echo -e "Required space to build the package:\t\t\t$REQUIRED1 KB or $REQUIRED2 MB\n" >> "$REPORT" +# Dump time and disk usage values + echo -e "$LINE\n\t\t\t\t[$PACKAGE]\n" >> $REPORT + echo -e "Build time is:\t\t\t\t\t\t$MINUTES minutes and $SECS seconds" >> $REPORT + echo -e "Build time in seconds is:\t\t\t\t$TIME" >> $REPORT + echo -e "Approximate SBU time is:\t\t\t\t$SBU" >> $REPORT + echo -e "Disk usage before unpacking the package:\t\t$DU1 KB or $DU1MB MB" >> $REPORT + echo -e "Disk usage before deleting the source and build dirs:\t$DU2 KB or $DU2MB MB" >> $REPORT + echo -e "Required space to build the package:\t\t\t$REQUIRED1 KB or $REQUIRED2 MB" >> $REPORT done # Dump grand totals -TOTALSBU=`echo "scale=3; ${SBU2}" | bc` -echo -e "\nTotal time required to build the systen:\t$TOTALSBU SBU\n" >> "$REPORT" -TOTALINSTALL=`echo "${INSTALL2}" | bc` -TOTALINSTALLMB=`echo "scale=2; ${INSTALLMB2}" | bc` -echo -e "Total Installed files disk usage - (including /tools but not /sources):\t$TOTALINSTALL KB or $TOTALINSTALLMB MB\n" >> "$REPORT" - - +echo -e "\n$LINE\n\nTotal time required to build the systen:\t\t$SBU2 SBU" >> $REPORT +# Total disk usage: including /tools but not /sources. +echo -e "Total Installed files disk usage:\t\t\t$INSTALL2 KB or $INSTALLMB2 MB" >> $REPORT diff --git a/common/custom_pkgs b/common/custom_pkgs deleted file mode 100644 index 3e05f5a..0000000 --- a/common/custom_pkgs +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/sh - -#----------------------------------# -add_CustomTools() { # Add any users supplied scripts -#----------------------------------# - PREV_SCRIPT="" - CUSTOM_LIST="" - - echo "Adding custom packages... ${BOLD}START${OFF}" - - cd $JHALFSDIR - > ${MKFILE}.tmp2 - - # First some build commands and a placeholder for the build list. - # This will not cause problems if there are no custom scripts. -( cat << xEOFx - - -mk_CUSTOM_TOOLS: - @\$(call echo_CHROOT_request) - @ sudo mkdir -p /home/georgeb/TRIAL/var/lib/jhalfs/BLFS - @( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make CUSTOM_TOOLS") - @touch \$@ - -CUSTOM_TOOLS: -xEOFx -) >> ${MKFILE}.tmp2 - - - for this_script in custom-commands/config/*; do - if [[ `basename ${this_script}` = "*" ]]; then - break - fi - source $this_script - THIS_SCRIPT=$(basename ${this_script}) - echo "$tab_${GREEN}Adding${OFF} ${THIS_SCRIPT}" - -( cat << EOF - -${THIS_SCRIPT}: ${PREV_SCRIPT} - @\$(call echo_message, Building) - @./progress_bar.sh \$@ \$\$PPID & - @\$(call remove_existing_dirs2,${PKG_FILE}) - @\$(call unpack3,${PKG_FILE}) - @\$(call get_pkg_root2) - @( time { source envars && /\$(SCRIPT_ROOT)/custom-commands/scripts/${THIS_SCRIPT} >>logs/${THIS_SCRIPT} 2>&1 ; } ) 2>>logs/${THIS_SCRIPT} - @\$(call remove_build_dirs2,${PKG}) - @touch \$@ - @touch /var/lib/jhalfs/BLFS/${PKG}-${PKG_VERSION} - @\$(call housekeeping) -EOF -) >> ${MKFILE}.tmp2 - - # Create the build script file -( cat <<- xEOFx -set -e -cd \$PKGDIR -`cat tmp` -exit -xEOFx -) > custom-commands/scripts/$THIS_SCRIPT - chmod 755 custom-commands/scripts/$THIS_SCRIPT - rm -f tmp - - PREV_SCRIPT=$THIS_SCRIPT - CUSTOM_LIST="${CUSTOM_LIST}${THIS_SCRIPT} " - done - - # Add the dependancy list. - sed "s|^CUSTOM_TOOLS:|CUSTOM_TOOLS: ${CUSTOM_LIST}|" -i ${MKFILE}.tmp2 - cat ${MKFILE}.tmp2 >> ${MKFILE} - rm ${MKFILE}.tmp2 - echo "Adding custom packages... ${BOLD}DONE${OFF}" -} - - - -#----------------------------------# -add_CustomToolsURLS() { # Add any users supplied scripts URL information -#----------------------------------# - local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/" - local this_script - local URL PKG PKG_VERSION PKG_FILE MD5 - - > urls.lst.tmp - for this_script in $JHALFSDIR/custom-commands/config/*; do - if [[ `basename ${this_script}` = "*" ]]; then - CUSTOM_TOOLS="n" - break - fi - source $this_script - echo "${URL} ${BLFS_SERVER}${PKG}/${PKG_FILE} ${MD5}" >> urls.lst.tmp - # Add any patches.. - for PATCH in PATCH{1..10}; do - [[ -n ${!PATCH} ]] && echo "dummy-url ${!PATCH}" >> urls.lst.tmp - done - done - cat urls.lst.tmp >> $BUILDDIR/sources/urls.lst - rm urls.lst.tmp -} diff --git a/common/libs/func_blfs_deps b/common/libs/func_blfs_deps new file mode 100644 index 0000000..33de8c0 --- /dev/null +++ b/common/libs/func_blfs_deps @@ -0,0 +1,201 @@ +#!/bin/bash + +# $Id$ + +#----------------------------# Hardcoded URLs and MD5. +add_blfs_deps_urls() { # No easy way to extract it. +#----------------------------# Some FTP mirrors may not work + + local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/" + + if [[ "${DEP_LIBXML}" = "y" ]] ; then + echo "${LIBXML_URL} ${BLFS_SERVER}libxml2/${LIBXML_PKG} ${LIBXML_MD5}" >> urls.lst + fi + + if [[ "${DEP_LIBXSLT}" = "y" ]] ; then + echo "${LIBXSLT_URL} ${BLFS_SERVER}libxslt/${LIBXSLT_PKG} ${LIBXSLT_MD5}" >> urls.lst + fi + + if [[ "${DEP_TIDY}" = "y" ]] ; then + echo "${TIDY_URL} ${BLFS_SERVER}tidy/${TIDY_PKG} ${TIDY_MD5}" >> urls.lst + fi + + if [[ "${DEP_UNZIP}" = "y" ]] ; then + echo "${UNZIP_URL} ${BLFS_SERVER}unzip/${UNZIP_PKG} ${UNZIP_MD5}" >> urls.lst + echo "${UNZIP_PATCH_URL} ${BLFS_SERVER}unzip/${UNZIP_PATCH} ${UNZIP_PATCH_MD5}" >> urls.lst + fi + + if [[ "${DEP_DBXML}" = "y" ]] ; then + echo "${DBXML_URL} ${BLFS_SERVER}docbook-xml/${DBXML_PKG} ${DBXML_MD5}" >> urls.lst + fi + +# if [[ "${DEP_DBXSL}" = "y" ]] ; then +# echo "${DBXSL_URL} ${BLFS_SERVER}docbook-xsl/${DBXSL_PKG} ${DBXSL_MD5}" >> urls.lst +# fi + + if [[ "${DEP_LYNX}" = "y" ]] ; then + echo "${LYNX_URL} ${BLFS_SERVER}lynx/${LYNX_PKG} ${LYNX_MD5}" >> urls.lst + fi + + if [[ "${DEP_SUDO}" = "y" ]] ; then + echo "${SUDO_URL} ${BLFS_SERVER}sudo/${SUDO_PKG} ${SUDO_MD5}" >> urls.lst + echo "${SUDO_PATCH_URL} ${BLFS_SERVER}sudo/${SUDO_PATCH} ${SUDO_PATCH_MD5}" >> urls.lst + fi + + if [[ "${DEP_WGET}" = "y" ]] ; then + echo "${WGET_URL} ${BLFS_SERVER}wget/${WGET_PKG} ${WGET_MD5}" >> urls.lst + fi + + if [[ "${DEP_SVN}" = "y" ]] ; then + echo "${SVN_URL} ${BLFS_SERVER}subversion/${SVN_PKG} ${SVN_MD5}" >> urls.lst + fi + + if [[ "${DEP_GPM}" = "y" ]] ; then + echo "${GPM_URL} ${BLFS_SERVER}gpm/${GPM_PKG} ${GPM_MD5}" >> urls.lst + echo "${GPM_PATCH_1_URL} ${BLFS_SERVER}gpm/${GPM_PATCH_1} ${GPM_PATCH_1_MD5}" >> urls.lst + echo "${GPM_PATCH_2_URL} ${BLFS_SERVER}gpm/${GPM_PATCH_2} ${GPM_PATCH_2_MD5}" >> urls.lst + fi + +} + +#----------------------------# Maybe there is a better way to do this, but this +copy_blfs_deps_scripts() { # method avoid to place the test on all +#----------------------------# $PROGNAME/master.sh scripts. + + mkdir -p ${PROGNAME}-commands/blfs-tool-deps + + if [[ "${DEP_LIBXML}" = "y" ]] ; then + mv blfs-tool-deps/901-libxml2 ${PROGNAME}-commands/blfs-tool-deps + fi + + if [[ "${DEP_LIBXSLT}" = "y" ]] ; then + mv blfs-tool-deps/902-libxslt ${PROGNAME}-commands/blfs-tool-deps + fi + + if [[ "${DEP_TIDY}" = "y" ]] ; then + mv blfs-tool-deps/903-tidy ${PROGNAME}-commands/blfs-tool-deps + fi + + if [[ "${DEP_UNZIP}" = "y" ]] ; then + mv blfs-tool-deps/904-unzip ${PROGNAME}-commands/blfs-tool-deps + fi + + if [[ "${DEP_DBXML}" = "y" ]] ; then + mv blfs-tool-deps/905-docbook-xml ${PROGNAME}-commands/blfs-tool-deps + fi + +# if [[ "${DEP_DBXSL}" = "y" ]] ; then +# mv blfs-tool-deps/906-docbook-xsl ${PROGNAME}-commands/blfs-tool-deps +# fi + + if [[ "${DEP_LYNX}" = "y" ]] ; then + mv blfs-tool-deps/908-lynx ${PROGNAME}-commands/blfs-tool-deps + fi + + if [[ "${DEP_SUDO}" = "y" ]] ; then + mv blfs-tool-deps/909-sudo ${PROGNAME}-commands/blfs-tool-deps + fi + + if [[ "${DEP_WGET}" = "y" ]] ; then + mv blfs-tool-deps/910-wget ${PROGNAME}-commands/blfs-tool-deps + fi + + if [[ "${DEP_SVN}" = "y" ]] ; then + mv blfs-tool-deps/911-subversion ${PROGNAME}-commands/blfs-tool-deps + fi + + if [[ "${DEP_GPM}" = "y" ]] ; then + mv blfs-tool-deps/907-gpm ${PROGNAME}-commands/blfs-tool-deps + fi + + rm -rf blfs-tool-deps + +} + + +#----------------------------------# +wrt_blfs_tool_targets() { # +#----------------------------------# + PREV="" + + echo "${tab_}${GREEN}Processing... ${L_arrow}BLFS_TOOL ${R_arrow}" + + for file in blfs-tool-deps/* ; do + # Keep the script file name + this_script=`basename $file` + + # Grab the name of the target + name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@'` + + # Find the package. + case $name in + lynx ) pkg_tarball=${LYNX_PKG} ;; + tidy ) pkg_tarball=${TIDY_PKG} ;; + unzip ) pkg_tarball=${UNZIP_PKG} ;; + * ) pkg_tarball=$(get_package_tarball_name $name) ;; + esac + + # Append each name of the script files to a list (this will become + # the names of the targets in the Makefile) + blfs_tool="$blfs_tool ${this_script}" + + #--------------------------------------------------------------------# + # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # + #--------------------------------------------------------------------# + # + # Drop in the name of the target on a new line, and the previous target + # as a dependency. Also call the echo_message function. + if [ "$PROGNAME" = "clfs2" ]; then + LUSER_wrt_target "${this_script}" "$PREV" + else + CHROOT_wrt_target "${this_script}" "$PREV" + fi + + # Insert instructions for unpacking the package and changing directories + # DocBook-XML is a zip, the build script will handle that. + if [ "$PROGNAME" = "clfs2" ]; then + [[ ! "$name" = "docbook-xml" ]] && LUSER_wrt_unpack "$pkg_tarball" + else + [[ ! "$name" = "docbook-xml" ]] && CHROOT_Unpack "$pkg_tarball" + fi + + # Run the script. + if [ "$PROGNAME" = "clfs2" ]; then + LUSER_wrt_RunAsUser "${file}" + else + CHROOT_wrt_RunAsRoot "$file" + fi + + # Remove the build directory(ies) except if the package build fails. + if [ "$PROGNAME" = "clfs2" ]; then + [[ ! "$name" = "docbook-xml" ]] && LUSER_RemoveBuildDirs "$name" + else + [[ ! "$name" = "docbook-xml" ]] && CHROOT_wrt_RemoveBuildDirs "$name" + fi + + # Touch the tracking file. + case $name in + docbook-xml ) pkg_ver=DocBook-4.5 ;; + lynx ) pkg_ver=lynx-2.8.6 ;; + tidy ) pkg_ver=html-tidy-cvs_20070326 ;; + unzip ) pkg_ver=unzip-5.52 ;; + * ) pkg_ver=$(echo $pkg_tarball | sed -e 's/.tar.*//;s/.tgz//;s/.zip//') ;; + esac + if [ "$PROGNAME" = "clfs2" ]; then + echo -e "\t@touch \$(MOUNT_PT)$TRACKING_DIR/$pkg_ver" >> $MKFILE.tmp + else + echo -e "\t@touch $TRACKING_DIR/$pkg_ver" >> $MKFILE.tmp + fi + + # Include a touch of the target name so make can check + # if it's already been made. + wrt_touch + # + #--------------------------------------------------------------------# + # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # + #--------------------------------------------------------------------# + + # Keep the script file name for Makefile dependencies. + PREV=${this_script} + done +} diff --git a/common/libs/func_book_parser b/common/libs/func_book_parser new file mode 100644 index 0000000..55a2212 --- /dev/null +++ b/common/libs/func_book_parser @@ -0,0 +1,216 @@ +#!/bin/bash + +# $Id$ + +#----------------------------# +get_book() { # +#----------------------------# + cd $JHALFSDIR + + if [ -z $WORKING_COPY ] ; then + # Check for Subversion instead of just letting the script hit 'svn' and fail. + test `type -p svn` || eval "echo \"This feature requires Subversion.\" + exit 1" + echo -n "Downloading the $PROGNAME document, $LFSVRS version... " + + case $PROGNAME in + lfs) svn_root="LFS" ;; + hlfs) svn_root="HLFS" ;; + clfs) svn_root="cross-lfs" ;; + clfs2) svn_root="cross-lfs" ;; + clfs3) svn_root="cross-lfs" ;; + *) echo "BOOK not defined in function " + exit 1 ;; + esac + # Grab a fresh book if it's missing, otherwise, update it from the + # repo. If we've already extracted the commands, move on to getting the + # sources. + if [ -d ${PROGNAME}-$LFSVRS ] ; then + cd ${PROGNAME}-$LFSVRS + if LC_ALL=C svn up | grep -q At && \ + test -d $JHALFSDIR/${PROGNAME}-commands && \ + test -f $JHALFSDIR/pkg_tarball_list ; then + # Set the canonical book version + echo -ne "done\n" + cd $JHALFSDIR + case $PROGNAME in + clfs | clfs2 | clfs3 ) + VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;; + *) + VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;; + esac + get_sources + else + echo -ne "done\n" + extract_commands + fi + else + svn co $SVN/${svn_root}/${TREE} ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1 + echo -ne "done\n" + extract_commands + fi + + else + echo -ne "Using $BOOK as book's sources ...\n" + extract_commands + fi + echo -ne " Document version ${L_arrow}${BOLD}${VERSION}${R_arrow}\n" +} + +#----------------------------# +extract_commands() { # +#----------------------------# + + # Check for libxslt instead of just letting the script hit 'xsltproc' and fail. + test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\" + exit 1" + + cd $JHALFSDIR + case $PROGNAME in + clfs | clfs2 | clfs3 ) + VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;; + *) + VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;; + esac + + # Start clean + if [ -d ${PROGNAME}-commands ]; then + rm -rf ${PROGNAME}-commands + mkdir -v ${PROGNAME}-commands + fi + echo -n "Extracting commands for" + + # Dump the commands in shell script form from the HLFS book. + case ${PROGNAME} in + clfs) + echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... " + xsltproc --nonet \ + --xinclude \ + --stringparam method $METHOD \ + --stringparam testsuite $TEST \ + --stringparam bomb-testsuite $BOMB_TEST \ + --stringparam vim-lang $VIMLANG \ + --stringparam timezone $TIMEZONE \ + --stringparam page $PAGE \ + --stringparam lang $LANG \ + --stringparam sparc $SPARC64_PROC \ + -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1 + ;; + + clfs2) + echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... " + xsltproc --nonet \ + --xinclude \ + --stringparam vim-lang $VIMLANG \ + --stringparam timezone $TIMEZONE \ + --stringparam page $PAGE \ + --stringparam lang $LANG \ + -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1 + ;; + + clfs3) + echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... " + xsltproc --nonet \ + --xinclude \ + --stringparam endian x$ENDIAN \ + --stringparam timezone $TIMEZONE \ + --stringparam page $PAGE \ + --stringparam lang $LANG \ + -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1 + ;; + + hlfs) + echo -n " ${L_arrow}${BOLD}$MODEL + $KERNEL${R_arrow} HLFS flavour... " + xsltproc --nonet \ + --xinclude \ + --stringparam model $MODEL \ + --stringparam kernel $KERNEL \ + --stringparam testsuite $TEST \ + --stringparam bomb-testsuite $BOMB_TEST \ + --stringparam features x$SSP$ASLR$PAX$HARDENED_TMP$WARNINGS$MISC$BLOWFISH \ + --stringparam timezone $TIMEZONE \ + --stringparam page $PAGE \ + --stringparam lang $LANG \ + --stringparam grsecurity_host $GRSECURITY_HOST \ + -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1 + ;; + lfs) + echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build... " + xsltproc --nonet \ + --xinclude \ + --stringparam testsuite $TEST \ + --stringparam bomb-testsuite $BOMB_TEST \ + --stringparam vim-lang $VIMLANG \ + --stringparam timezone $TIMEZONE \ + --stringparam page $PAGE \ + --stringparam lang $LANG \ + -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1 + ;; + *) echo -n " ${L_arrow}${BOLD}${PROGNAME}${R_arrow} book invalid, terminate build... " + exit 1 ;; + esac + + [[ "${BLFS_TOOL}" = "y" ]] && copy_blfs_deps_scripts + + echo "done" + + # Make the scripts executable. + chmod -R +x $JHALFSDIR/${PROGNAME}-commands + + # Create the packages file. We need it for proper Makefile creation + create_package_list + + # Done. Moving on... + get_sources + +} + +#----------------------------# +create_package_list() { # +#----------------------------# + + # Create the packages file. We need it for proper Makefile creation + rm -f pkg_tarball_list + echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK" + if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi + echo -n "... " + case ${PROGNAME} in + clfs | clfs2 | clfs3 ) + xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \ + $BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1 + ;; + hlfs) + xsltproc --nonet --xinclude \ + --stringparam model $MODEL \ + --stringparam kernel $KERNEL \ + -o pkg_tarball_list packages.xsl \ + $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1 + ;; + lfs) + xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \ + $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1 + ;; + esac + + if [[ "${BLFS_TOOL}" = "y" ]] ; then +( +cat << EOF +$LIBXML_PKG +$LIBXSLT_PKG +$TIDY_PKG +$UNZIP_PKG +$DBXML_PKG +$DBXSL_PKG +$LYNX_PKG +$SUDO_PKG +$WGET_PKG +$SVN_PKG +$GPM_PKG +EOF +) >> pkg_tarball_list + fi + + echo "done" + +} + diff --git a/common/func_check_version.sh b/common/libs/func_check_version.sh similarity index 59% rename from common/func_check_version.sh rename to common/libs/func_check_version.sh index d5038e0..7c71077 100644 --- a/common/func_check_version.sh +++ b/common/libs/func_check_version.sh @@ -34,13 +34,25 @@ inline_doc write_error_and_die() { echo -e "\n\t\t$TXT version -->${tst_version}<-- is too old. This script requires ${ref_version} or greater\n" - exit 1 + # Ask the user instead of bomb, to make happy that packages which version + # ouput don't follow our expectations + echo "If you are sure that you have instaled a proper version of ${BOLD}$TXT${OFF}" + echo "but jhalfs has failed to detect it, press 'c' and 'ENTER' keys to continue," + echo -n "otherwise press 'ENTER' key to stop jhalfs. " + read ANSWER + if [ x$ANSWER != "xc" ] ; then + echo "${nl_}Please, install a proper $TXT version.${nl_}" + exit 1 + else + minor=$ref_minor + revision=$ref_revision + fi } echo -ne "${TXT}${dotSTR:${#TXT}} ${L_arrow}${BOLD}${tst_version}${OFF}${R_arrow}" # echo -ne "$TXT:\t${L_arrow}${BOLD}${tst_version}${OFF}${R_arrow}" - IFS=".-(p" # Split up w.x.y.z as well as w.x.y-rc (catch release candidates) + IFS=".-(pa" # Split up w.x.y.z as well as w.x.y-rc (catch release candidates) set -- $ref_version # set postional parameters to minimum ver values ref_major=$1; ref_minor=$2; ref_revision=$3 # @@ -66,33 +78,26 @@ check_prerequisites() { # #----------------------------# # LFS/HLFS/CLFS prerequisites - if [ ! "${PROGNAME}" = "hlfs" ]; then - check_version "2.6.2" "`uname -r`" "KERNEL" - check_version "2.0.5" "$BASH_VERSION" "BASH" - check_version "3.0.0" "`gcc -dumpversion`" "GCC" - libcVer="`/lib/libc.so.6 | head -n1`" - libcVer="${libcVer##*version }" - check_version "2.2.5" ${libcVer%%,*} "GLIBC" - check_version "2.12" "$(ld --version | head -n1 | cut -d" " -f4)" "BINUTILS" - check_version "1.14" "$(tar --version | head -n1 | cut -d" " -f4)" "TAR" - bzip2Ver="$(bzip2 --version 2>&1 < /dev/null | head -n1 | cut -d" " -f8)" - check_version "1.0.2" "${bzip2Ver%%,*}" "BZIP2" - check_version "5.0" "$(chown --version | head -n1 | cut -d")" -f2)" "COREUTILS" - check_version "2.8" "$(diff --version | head -n1 | cut -d" " -f4)" "DIFF" - check_version "4.1.20" "$(find --version | head -n1 | cut -d" " -f4)" "FIND" - check_version "3.0" "$(gawk --version | head -n1 | cut -d" " -f3)" "GAWK" - check_version "2.5" "$(grep --version | head -n1 | cut -d" " -f4)" "GREP" - check_version "1.2.4" "$(gzip --version 2>&1 | head -n1 | cut -d" " -f2)" "GZIP" - check_version "3.79.1" "$(make --version | head -n1 | cut -d " " -f3 | cut -c1-4)" "MAKE" - check_version "2.5.4" "$(patch --version | head -n1 | cut -d" " -f2)" "PATCH" - check_version "3.0.2" "$(sed --version | head -n1 | cut -d" " -f4)" "SED" - else - # HLFS prerequisites - check_version "2.6.2" "$(uname -r)" "KERNEL" - check_version "3.0" "$BASH_VERSION" "BASH" - check_version "3.0" "$(gcc -dumpversion)" "GCC" - check_version "1.14" "$(tar --version | head -n1 | cut -d" " -f4)" "TAR" - fi + check_version "2.6.2" "`uname -r`" "KERNEL" + check_version "3.0" "$BASH_VERSION" "BASH" + check_version "3.0.1" "`gcc -dumpversion`" "GCC" + libcVer="`/lib/libc.so.6 | head -n1`" + libcVer="${libcVer##*version }" + check_version "2.2.5" ${libcVer%%,*} "GLIBC" + check_version "2.12" "$(ld --version | head -n1 | cut -d" " -f4)" "BINUTILS" + check_version "1.15" "$(tar --version | head -n1 | cut -d" " -f4)" "TAR" + bzip2Ver="$(bzip2 --version 2>&1 < /dev/null | head -n1 | cut -d" " -f8)" + check_version "1.0.2" "${bzip2Ver%%,*}" "BZIP2" + check_version "1.875" "$(bison --version | head -n1 | cut -d" " -f4)" "BISON" + check_version "5.2.1" "$(chown --version | head -n1 | cut -d")" -f2)" "COREUTILS" + check_version "2.8" "$(diff --version | head -n1 | cut -d" " -f4)" "DIFF" + check_version "4.1.20" "$(find --version | head -n1 | cut -d" " -f4)" "FIND" + check_version "3.0" "$(gawk --version | head -n1 | cut -d" " -f3)" "GAWK" + check_version "2.5" "$(grep --version | head -n1 | awk '{print $NF}')" "GREP" + check_version "1.2.4" "$(gzip --version 2>&1 | head -n1 | cut -d" " -f2)" "GZIP" + check_version "3.79.1" "$(make --version | head -n1 | cut -d " " -f3 | cut -c1-4)" "MAKE" + check_version "2.5.4" "$(patch --version | head -n1 | cut -d" " -f2)" "PATCH" + check_version "3.0.2" "$(sed --version | head -n1 | cut -d" " -f4)" "SED" # Check for minimum sudo version SUDO_LOC="$(whereis -b sudo | cut -d" " -f2)" @@ -125,8 +130,8 @@ check_prerequisites() { # # Check if the proper DocBook-XML-DTD and DocBook-XSL are correctly installed XML_FILE=" - +
Test file @@ -137,21 +142,21 @@ XML_FILE=" if [[ -z "$DEP_DBXML" ]] ; then if `echo $XML_FILE | xmllint -noout -postvalid - 2>/dev/null` ; then - check_version "4.4" "4.4" "DocBook XML DTD" + check_version "4.5" "4.5" "DocBook XML DTD" else - echo "Warning: not found a working DocBook XML DTD 4.4 installation" + echo "Warning: not found a working DocBook XML DTD 4.5 installation" exit 2 fi fi - if [[ -z "$DEP_DBXSL" ]] ; then - if `echo $XML_FILE | xsltproc --noout - 2>/dev/null` ; then - check_version "1.69.1" "1.69.1" "DocBook XSL" - else - echo "Warning: not found a working DocBook XSL 1.69.1 installation" - exit 2 - fi - fi +# if [[ -z "$DEP_DBXSL" ]] ; then +# if `echo $XML_FILE | xsltproc --noout - 2>/dev/null` ; then +# check_version "1.69.1" "1.69.1" "DocBook XSL" +# else +# echo "Warning: not found a working DocBook XSL 1.69.1 installation" +# exit 2 +# fi +# fi fi # end BLFS_TOOL=Y diff --git a/common/func_compare.sh b/common/libs/func_compare.sh similarity index 72% rename from common/func_compare.sh rename to common/libs/func_compare.sh index 936472d..e9c072c 100644 --- a/common/func_compare.sh +++ b/common/libs/func_compare.sh @@ -14,6 +14,7 @@ wrt_compare_targets() { # CHROOT_wrt_target "$ITERATION" "$PREV" wrt_compare_work "$ITERATION" "$PREV_IT" wrt_logs "$N" + wrt_touch PREV_IT=$ITERATION PREV=$ITERATION done @@ -25,10 +26,8 @@ wrt_system_build() { # local RUN=$1 local PREV_IT=$2 - if [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "chroot" ]] ; then - chroot_final_system_Makefiles $RUN - elif [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "boot" ]] ; then - boot_final_system_Makefiles $RUN + if [[ "$PROGNAME" = "clfs" ]] ; then + final_system_Makefiles $RUN else chapter6_Makefiles $RUN fi @@ -46,8 +45,6 @@ wrt_system_build() { # chapter6="$chapter6 iteration-$RUN" fi fi - - echo -e "\nsystem_build_$RUN: $PREV_IT $system_build" >> $MKFILE.tmp } #----------------------------------# @@ -56,7 +53,7 @@ wrt_compare_work() { # local ITERATION=$1 local PREV_IT=$2 local PRUNEPATH="/dev /home /${SCRIPT_ROOT} /lost+found /media /mnt /opt /proc \ -/sources /root /srv /sys /tmp /tools /usr/local /usr/src /var/log/paco" +/sources /root /srv /sys /tmp /tools /usr/local /usr/src" local ROOT_DIR=/ local DEST_TOPDIR=/${SCRIPT_ROOT} @@ -67,8 +64,8 @@ wrt_compare_work() { # local DEST_ICA=$DEST_TOPDIR/ICA && \ ( cat << EOF - @extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION >>logs/$ITERATION.log 2>&1 && \\ - extras/do_ica_prep $DEST_ICA/$ITERATION >>logs/$ITERATION.log 2>&1 + @extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION >>logs/\$@ 2>&1 && \\ + extras/do_ica_prep $DEST_ICA/$ITERATION >>logs/\$@ 2>&1 EOF ) >> $MKFILE.tmp if [[ "$ITERATION" != "iteration-1" ]] ; then @@ -80,8 +77,8 @@ EOF local DEST_FARCE=$DEST_TOPDIR/farce && \ ( cat << EOF - @extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_FARCE/$ITERATION >>logs/$ITERATION.log 2>&1 && \\ - extras/filelist $DEST_FARCE/$ITERATION $DEST_FARCE/filelist-$ITERATION >>logs/$ITERATION.log 2>&1 + @extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_FARCE/$ITERATION >>logs/\$@ 2>&1 && \\ + extras/filelist $DEST_FARCE/$ITERATION $DEST_FARCE/filelist-$ITERATION >>logs/\$@ 2>&1 EOF ) >> $MKFILE.tmp if [[ "$ITERATION" != "iteration-1" ]] ; then @@ -93,7 +90,7 @@ EOF #----------------------------------# wrt_do_ica_work() { # #----------------------------------# - echo -e "\t@extras/do_ica_work $1 $2 $ICALOGDIR $3 >>logs/$ITERATION.log 2>&1" >> $MKFILE.tmp + echo -e "\t@extras/do_ica_work $1 $2 $ICALOGDIR $3 >>logs/\$@ 2>&1" >> $MKFILE.tmp } #----------------------------------# @@ -104,24 +101,39 @@ wrt_do_farce_work() { # local PREFILE=$3/filelist-$1 local ITEDIR=$3/$2 local ITEFILE=$3/filelist-$2 - echo -e "\t@extras/farce --directory $OUTPUT $PREDIR $PREFILE $ITEDIR $ITEFILE >>logs/$ITERATION.log 2>&1" >> $MKFILE.tmp + echo -e "\t@extras/farce --directory $OUTPUT $PREDIR $PREFILE $ITEDIR $ITEFILE >>logs/\$@ 2>&1" >> $MKFILE.tmp } #----------------------------------# wrt_logs() { # #----------------------------------# - local ITERATION=iteration-$1 + local build=build_$1 + local file ( cat << EOF - @pushd logs 1> /dev/null && \\ - mkdir $ITERATION && \\ - mv ${LOGS} $ITERATION && \\ - popd 1> /dev/null - @touch \$@ && \\ - sleep .25 && \\ - echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ - echo --------------------------------------------------------------------------------\$(WHITE) + @cd logs && \\ + mkdir $build && \\ + mv -f ${system_build} $build && \\ + if [ ! $build = build_1 ] ; then \\ + cd $build && \\ + for file in \`ls .\` ; do \\ + mv -f \$\$file \`echo \$\$file | sed -e 's,-$build,,'\` ; \\ + done ; \\ + fi ; + @cd /\$(SCRIPT_ROOT) + @if [ -d test-logs ] ; then \\ + cd test-logs && \\ + mkdir $build && \\ + mv -f ${system_build} $build && \\ + if [ ! $build = build_1 ] ; then \\ + cd $build && \\ + for file in \`ls .\` ; do \\ + mv -f \$\$file \`echo \$\$file | sed -e 's,-$build,,'\` ; \\ + done ; \\ + fi ; \\ + cd /\$(SCRIPT_ROOT) ; \\ + fi ; EOF ) >> $MKFILE.tmp } diff --git a/common/libs/func_custom_pkgs b/common/libs/func_custom_pkgs new file mode 100644 index 0000000..d865f98 --- /dev/null +++ b/common/libs/func_custom_pkgs @@ -0,0 +1,118 @@ +#!/bin/bash + +# $Id$ + +#----------------------------------# +wrt_CustomTools_target() { # Add any users supplied scripts +#----------------------------------# + PREV="" + + echo " Adding custom packages... ${BOLD}START${OFF}" + + # Create the custom_tools scripts directory + mkdir -p custom-tools + + for file in $JHALFSDIR/custom-commands/*; do + if [[ `basename ${file}` = "*" ]]; then + break + fi + source $file + this_script=$(basename ${file}) + echo "$tab_${GREEN}Adding${OFF} ${this_script}" + + # Create a Makefile entry + if [[ "x${PKG}" = "x" ]]; then + # Create an entry for a self contained cmd script that does not + # reference a package tarball + case $PROGNAME in + clfs2 | clfs3 ) + LUSER_wrt_target "${this_script}" "$PREV" + LUSER_wrt_RunAsUser "custom-tools/${this_script}" + ;; + *) + CHROOT_wrt_target "${this_script}" "$PREV" + CHROOT_wrt_RunAsRoot "custom-tools/${this_script}" + ;; + esac + wrt_touch + + # Create the build script file +( cat <<- xEOFx +#!/bin/bash +set -e + +`cat tmp` +exit +xEOFx +) > custom-tools/${this_script} + + else + # Create an entry for package + case $PROGNAME in + clfs2 | clfs3 ) + LUSER_wrt_target "${this_script}" "$PREV" + LUSER_wrt_unpack "${PKG_FILE}" + LUSER_wrt_RunAsUser "custom-tools/${this_script}" + LUSER_RemoveBuildDirs "${PKG}" + echo -e "\t@touch \$(MOUNT_PT)$TRACKING_DIR/${PKG}-${PKG_VERSION}" >> $MKFILE.tmp + ;; + *) + CHROOT_wrt_target "${this_script}" "$PREV" + CHROOT_Unpack "${PKG_FILE}" + CHROOT_wrt_RunAsRoot "custom-tools/${this_script}" + CHROOT_wrt_RemoveBuildDirs "${PKG}" + echo -e "\t@touch $TRACKING_DIR/${PKG}-${PKG_VERSION}" >> $MKFILE.tmp + ;; + esac + wrt_touch + + # Create the build script file +( cat <<- xEOFx +#!/bin/bash +set -e + +cd \$PKGDIR +`cat tmp` +exit +xEOFx +) > custom-tools/$this_script + fi + + rm -f tmp + PREV=$this_script + custom_list="${custom_list} ${this_script}" + done + + # Make the scripts executable. + chmod +x custom-tools/* + + echo " Adding custom packages... ${BOLD}DONE${OFF}" +} + + +#----------------------------------# +add_CustomToolsURLS() { # Add any users supplied scripts URL information +#----------------------------------# + local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/" + local this_script + local URL PKG PKG_VERSION PKG_FILE MD5 + + > urls.lst.tmp + for this_script in $JHALFSDIR/custom-commands/*; do + if [[ `basename ${this_script}` = "*" ]]; then + CUSTOM_TOOLS="n" + break + fi + source $this_script + # A cmd only script had no PKG defined + [[ "x${PKG}" = "x" ]] && continue + + echo "${URL} ${BLFS_SERVER}${PKG}/${PKG_FILE} ${MD5}" >> urls.lst.tmp + # Add any patches.. + for PATCH in PATCH{1..10}; do + [[ -n ${!PATCH} ]] && echo "dummy-url ${!PATCH}" >> urls.lst.tmp + done + done + cat urls.lst.tmp >> $BUILDDIR/sources/urls.lst + rm urls.lst.tmp +} diff --git a/common/libs/func_download_pkgs b/common/libs/func_download_pkgs new file mode 100644 index 0000000..265a593 --- /dev/null +++ b/common/libs/func_download_pkgs @@ -0,0 +1,195 @@ +#!/bin/bash + +# $Id$ + + +#----------------------------# +get_sources() { # Download file, write name to MISSING_FILES.DMP if an error +#----------------------------# + local saveIFS=$IFS + local IFS line URL1 URL2 FILE BOOKMD5 MD5 HAVEMD5 fromARCHIVE + + # Test if the packages must be downloaded + [ ! "$GETPKG" = "y" ] && return + + gs_wrt_message(){ + echo "${RED}$1${OFF}" + echo "$1" >> MISSING_FILES.DMP + } + # Housekeeping + [[ ! -d $BUILDDIR/sources ]] && mkdir $BUILDDIR/sources + cd $BUILDDIR/sources + [[ -f MD5SUMS ]] && rm MD5SUMS + [[ -f MISSING_FILES.DMP ]] && rm MISSING_FILES.DMP + [[ -f urls.lst ]] && rm urls.lst + + # Generate URLs file + create_urls + + IFS=$'\x0A' # Modify the 'internal field separator' to break on 'LF' only + for line in `cat urls.lst`; do + IFS=$saveIFS # Restore the system defaults + + # Skip some packages if they aren't needed + case $line in + */tcl* | */expect* | */dejagnu* | */tree* | */gcc-testsuite* ) + [[ "$TEST" = "0" ]] && continue + ;; + */vim-*-lang* ) + [[ "$VIMLANG" = "0" ]] && continue + ;; + *linux/linux-* ) + [[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] && \ + [[ "$GETKERNEL" = "n" ]] && continue + ;; + esac + + # Locations + URL1=`echo $line | cut -d" " -f2` # Preferred URL + URL2=`echo $line | cut -d" " -f1` # Fallback Upstream URL + FILE=`basename $URL1` # File name + BOOKMD5=`echo $line | cut -d" " -f3` # MD5 book value + + # Validation pair + MD5="$BOOKMD5 $FILE" + HAVEMD5=1 + + set -e + # If the file exists in the archive copy it to the + # $BUILDDIR/sources dir. MD5SUM will be validated later. + if [ ! -z ${SRC_ARCHIVE} ] && + [ -d ${SRC_ARCHIVE} ] && + [ -f ${SRC_ARCHIVE}/$FILE ]; then + cp ${SRC_ARCHIVE}/$FILE . + echo "$FILE: -- copied from $SRC_ARCHIVE" + fromARCHIVE=1 + else + echo "${BOLD}${YELLOW}$FILE: not found in ${SRC_ARCHIVE}${OFF}" + fromARCHIVE=0 + # If the file does not exist yet in /sources download a fresh one + if [ ! -f $FILE ] ; then + if ! wget $URL1 && ! wget $URL2 ; then + gs_wrt_message "$FILE not found in the SRC_ARCHIVE or on any server..SKIPPING" + continue + fi + fi + fi + + # IF the md5sum does not match the existing files + if ! echo "$MD5" | md5sum -c - >/dev/null ; then + [[ $fromARCHIVE = "1" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match SRC_ARCHIVE copy${OFF}" + [[ $fromARCHIVE = "0" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match REMOTE copy${OFF}" + # Remove the old file and download a new one + rm -fv $FILE + # Force storage in SRC_ARCHIVE + fromARCHIVE=0; + # Try to retrieve again the file. Servers in reverse order. + if ! wget $URL2 && ! wget $URL1 ; then + gs_wrt_message "$FILE not found on the servers.. SKIPPING" + continue + fi + fi + + # Validate the MD5SUM one last time + if ! echo "$MD5" | md5sum -c - >/dev/null ; then + gs_wrt_message "$FILE does not match MD5SUMS value" + # Force generation of MD5SUM + HAVEMD5=0 + fi + + # Generate a fresh MD5SUM for this file + if [[ "$HAVEMD5" = "0" ]] ; then + echo "${BOLD}${YELLOW}Generating a new MD5SUM for ${OFF}$FILE" + echo "NEW MD5SUM: $(md5sum $FILE)" >> MISSING_FILES.DMP + fi + + # Good or bad we write the original md5sum to a file + echo "$MD5" >> MD5SUMS + + # Copy the freshly downloaded file + # to the source archive. + if [ ! -z ${SRC_ARCHIVE} ] && + [ -d ${SRC_ARCHIVE} ] && + [ -w ${SRC_ARCHIVE} ] && + [ "$fromARCHIVE" = "0" ] ; then + echo "Storing file:<$FILE> in the package archive" + cp -f $FILE ${SRC_ARCHIVE} + fi + + done + + if [[ -s MISSING_FILES.DMP ]]; then + echo -e "\n\n${tab_}${RED} One or more files were not retrieved or have bad MD5SUMS.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n" + # Do not allow the automatic execution of the Makefile. + echo "${tab_}${BOLD}${RED}*** ${YELLOW}Automatic execution of the generated makefile has been inhibited. ${RED}***${OFF}${nl_}" + RUNMAKE="n" + fi +} + +#----------------------------# +create_urls() { # +#----------------------------# + cd $JHALFSDIR + + case ${PROGNAME} in + clfs) + echo -n "Creating CLFS <${ARCH}> specific URLs file" + xsltproc --nonet --xinclude \ + --stringparam server $SERVER \ + --stringparam family clfs \ + -o $BUILDDIR/sources/urls.lst urls.xsl \ + $BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1 + echo " ...OK" + ;; + clfs2) + echo -n "Creating CLFS2 <${ARCH}> specific URLs file" + xsltproc --nonet --xinclude \ + --stringparam server $SERVER \ + --stringparam family clfs \ + -o $BUILDDIR/sources/urls.lst urls.xsl \ + $BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1 + echo " ...OK" + ;; + clfs3) + echo -n "Creating CLFS3 <${ARCH}> specific URLs file" + xsltproc --nonet --xinclude \ + --stringparam server $SERVER \ + --stringparam family clfs \ + -o $BUILDDIR/sources/urls.lst urls.xsl \ + $BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1 + echo " ...OK" + ;; + hlfs) + echo -n "Creating HLFS <${MODEL}> + <${KERNEL}> specific URLs file" + xsltproc --nonet --xinclude \ + --stringparam server $SERVER \ + --stringparam family lfs \ + --stringparam model $MODEL \ + --stringparam kernel $KERNEL \ + -o $BUILDDIR/sources/urls.lst urls.xsl \ + $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1 + echo " ...OK" + ;; + lfs) + echo -n "Creating LFS specific URLs file" + xsltproc --nonet --xinclude \ + --stringparam server $SERVER \ + --stringparam family lfs \ + -o ../sources/urls.lst urls.xsl \ + $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1 + echo " ...OK" + ;; + esac + + cd $BUILDDIR/sources + + if [[ "${BLFS_TOOL}" = "y" ]]; then + add_blfs_deps_urls + fi + + if [[ "${CUSTOM_TOOLS}" = "y" ]]; then + add_CustomToolsURLS + fi + +} + diff --git a/common/func_validate_configs.sh b/common/libs/func_validate_configs.sh similarity index 66% rename from common/func_validate_configs.sh rename to common/libs/func_validate_configs.sh index e90407b..11b85c2 100644 --- a/common/func_validate_configs.sh +++ b/common/libs/func_validate_configs.sh @@ -12,27 +12,61 @@ validate_config() { # Are the config values sane (within reason) input vars: none externals: color constants - PROGNAME (lfs,clfs,hlfs) + PROGNAME (lfs,hlfs,clfs,clfs2,clfs3,blfs) modifies: none returns: nothing on error: write text to console and dies on success: write text to console and returns inline_doc - # First internal variables, then the ones that change the book's flavour, and lastly system configuration variables - local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL GRSECURITY_HOST TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL PAGE TIMEZONE LANG LC_ALL LUSER LGROUP BLFS_TOOL" - local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD ARCH TARGET TARGET32 TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP BLFS_TOOL" - local -r clfs2_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE ARCH TARGET OPTIMIZE REPORT STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP BLFS_TOOL" - local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP BLFS_TOOL CUSTOM_TOOLS" + # Common settings by Config.in sections and books family + local -r BOOK_common="BOOK CUSTOM_TOOLS" + local -r BOOK_clfsX="ARCH TARGET" + local -r GENERAL_common="LUSER LGROUP LHOME BUILDDIR CLEAN GETPKG SRC_ARCHIVE \ + SERVER GETKERNEL RUNMAKE" + local -r BUILD_chroot="TEST BOMB_TEST STRIP" + local -r BUILD_common="FSTAB CONFIG TIMEZONE PAGE LANG INSTALL_LOG" + local -r ADVANCED_chroot="COMPARE RUN_ICA RUN_FARCE ITERATIONS OPTIMIZE" + local -r ADVANCED_common="REPORT REBUILD_MAKEFILE" + + # BOOK Settings by book + local -r LFS_book="$BOOK_common BLFS_TOOL" + #local -r HLFS_added="SET_SSP SET_ASLR SET_PAX SET_HARDENED_TMP SET_WARNINGS \ + # SET_MISC SET_BLOWFISH" + local -r HLFS_added="" + local -r HLFS_book="$BOOK_common BLFS_TOOL MODEL KERNEL GRSECURITY_HOST $HLFS_added" + local -r CLFS_book="$BOOK_common BLFS_TOOL METHOD $BOOK_clfsX TARGET32 BOOT_CONFIG" + local -r CLFS2_book="$BOOK_common BLFS_TOOL $BOOK_clfsX" + local -r CLFS3_book="$BOOK_common $BOOK_clfsX PLATFORM MIPS_LEVEL" + + # Build Settings by book + local -r LFS_build="$BUILD_chroot VIMLANG $BUILD_common" + 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" + + # Full list of books settings + local -r lfs_PARAM_LIST="$LFS_book $GENERAL_common $LFS_build $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" + local -r clfs3_PARAM_LIST="$CLFS3_book $GENERAL_common $CLFS3_build $ADVANCED_common" local -r blfs_PARAM_LIST="BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR" - local -r blfs_tool_PARAM_LIST="BLFS_BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR DEP_LIBXML DEP_LIBXSLT DEP_TIDY DEP_UNZIP DEP_DBXML DEP_DBXSL DEP_LINKS DEP_SUDO DEP_WGET DEP_SVN DEP_GPM" + # Additional variables (add DEP_DBXSL when required again) + local -r blfs_tool_PARAM_LIST="BLFS_BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR \ + DEP_LIBXML DEP_LIBXSLT DEP_TIDY DEP_UNZIP \ + DEP_DBXML DEP_LYNX DEP_SUDO DEP_WGET \ + DEP_SVN DEP_GPM" + local -r custom_tool_PARAM_LIST="TRACKING_DIR" + # Internal variables local -r ERROR_MSG_pt1='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid,' local -r ERROR_MSG_pt2='rerun make and fix your configuration settings${OFF}' local -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}' - local PARAM_LIST= + local PARAM_LIST= local config_param local validation_str local save_param @@ -97,23 +131,6 @@ inline_doc PARAM_GROUP=${PROGNAME}_PARAM_LIST for config_param in ${!PARAM_GROUP}; do case $config_param in - # Allways display this, if found in ${PROGNAME}_PARAM_LIST - GETPKG | \ - RUNMAKE | \ - TEST | \ - OPTIMIZE | \ - STRIP | \ - VIMLANG | \ - MODEL | \ - METHOD | \ - ARCH | \ - TARGET | \ - GRSECURITY_HOST | \ - BLFS_TOOL | \ - CUSTOM_TOOLS | \ - TIMEZONE | \ - PAGE) echo -e "`eval echo $PARAM_VALS`" ;; - # Envvars that depend on other settings to be displayed GETKERNEL ) if [[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] ; then [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" @@ -124,6 +141,8 @@ inline_doc ITERATIONS) [[ "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;; BOMB_TEST) [[ ! "$TEST" = "0" ]] && echo -e "`eval echo $PARAM_VALS`" ;; TARGET32) [[ -n "${TARGET32}" ]] && echo -e "`eval echo $PARAM_VALS`" ;; + MIPS_LEVEL) [[ "${ARCH}" = "mips" ]] && echo -e "`eval echo $PARAM_VALS`" ;; + SERVER) [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;; # Envars that requires some validation LUSER) echo -e "`eval echo $PARAM_VALS`" @@ -132,32 +151,21 @@ inline_doc LGROUP) echo -e "`eval echo $PARAM_VALS`" [[ "${!config_param}" = "**EDIT ME**" ]] && write_error_and_die ;; - REPORT) echo -e "`eval echo $PARAM_VALS`" - if [[ "${!config_param}" = "y" ]]; then - if [[ `type -p bc` ]]; then - continue - else - echo -e " ${BOLD}The bc binary was not found${OFF}" - echo -e " The SBU and disk usage report creation will be skiped" - REPORT=n - continue - fi - fi ;; - # BOOK validation. Very ugly, need be fixed BOOK) if [[ "${WORKING_COPY}" = "y" ]] ; then validate_dir -z -d else echo -e "`eval echo $PARAM_VALS`" - fi ;; - + fi + ;; # Validate directories, testable states: # fatal -z -d -w, # warning -z+ -w+ SRC_ARCHIVE) [[ "$GETPKG" = "y" ]] && validate_dir -z+ -d -w+ ;; # The build directory/partition MUST exist and be writable by the user BUILDDIR) validate_dir -z -d -w - [[ "xx x/x" =~ "x${!config_param}x" ]] && write_error_and_die ;; + [[ "xx x/x" =~ x${!config_param}x ]] && write_error_and_die ;; + LHOME) validate_dir -z -d ;; # Validate files, testable states: # fatal -z -e -s -w -x -r, @@ -166,9 +174,8 @@ inline_doc CONFIG) validate_file -z+ -e -s ;; BOOT_CONFIG) [[ "${METHOD}" = "boot" ]] && validate_file -z -e -s ;; - # Treatment of 'special' parameters - LANG | \ - LC_ALL) # See it the locale values exist on this machine + # Treatment of LANG parameter + LANG ) # See it the locale value has been set echo -n "`eval echo $PARAM_VALS`" [[ -z "${!config_param}" ]] && echo " -- Variable $config_param cannot be empty!" && @@ -180,6 +187,9 @@ inline_doc BRANCH_ID | BLFS_ROOT | BLFS_XML ) echo "`eval echo $PARAM_VALS`" ;; TRACKING_DIR ) validate_dir -z -d -w ;; + # Display non-validated envars found in ${PROGNAME}_PARAM_LIST + * ) echo -e "`eval echo $PARAM_VALS`" ;; + esac done @@ -190,6 +200,12 @@ inline_doc done fi + if [[ "${CUSTOM_TOOLS}" = "y" ]] && [[ "${BLFS_TOOL}" = "n" ]] ; then + for config_param in ${custom_tool_PARAM_LIST}; do + echo -e "`eval echo $PARAM_VALS`" + done + fi + set -e echo "${nl_}***${BOLD}${GREEN} ${PARAM_GROUP%%_*T} config parameters look good${OFF} ***${nl_}" } diff --git a/common/libs/func_wrt_Makefile b/common/libs/func_wrt_Makefile new file mode 100644 index 0000000..20fadc3 --- /dev/null +++ b/common/libs/func_wrt_Makefile @@ -0,0 +1,386 @@ +#!/bin/bash + +# $Id$ + +#=== MAKEFILE HEADER === + +#----------------------------------# +wrt_Makefile_header() { # +#----------------------------------# +( + cat << EOF +# This file is automatically generated by jhalfs +# DO NOT EDIT THIS FILE MANUALLY +# +# Generated on `date "+%F %X %Z"` + + +SHELL = /bin/bash + +SRC = /sources +MOUNT_PT = $BUILDDIR +PKG_LST = $PKG_LST +LUSER = $LUSER +LGROUP = $LGROUP +LHOME = $LHOME +SCRIPT_ROOT = $SCRIPT_ROOT + +BASEDIR = \$(MOUNT_PT) +SRCSDIR = \$(BASEDIR)/sources +CMDSDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$PROGNAME-commands +LOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$LOGDIRBASE +TESTLOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$TESTLOGDIRBASE + +crCMDSDIR = /\$(SCRIPT_ROOT)/$PROGNAME-commands +crLOGDIR = /\$(SCRIPT_ROOT)/$LOGDIRBASE +crTESTLOGDIR = /\$(SCRIPT_ROOT)/$TESTLOGDIRBASE +crFILELOGDIR = /\$(SCRIPT_ROOT)/$FILELOGDIRBASE + +SU_LUSER = su - \$(LUSER) -c +LUSER_HOME = \$(LHOME)/\$(LUSER) +PRT_DU = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) --exclude=lost+found \$(MOUNT_PT) \`\n" +PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) --exclude=lost+found / \`\n" + +ADD_REPORT = $REPORT +ADD_CUSTOM_TOOLS = $CUSTOM_TOOLS +ADD_BLFS_TOOLS = $BLFS_TOOL + + +export PATH := \${PATH}:/usr/sbin + +include makefile-functions + +EOF +) > $MKFILE +} + +#======================= + + +#==== PACKAGES NAMES === + +#----------------------------------# +get_package_tarball_name() { # +#----------------------------------# + local script_name=`echo ${1} | sed -e 's@[0-9]\{1\}-@@'` + + # The use of 'head' is necessary to limit the return value to the FIRST match.. + # hopefully this will not cause problems. + # + case $script_name in + tcl) echo $(grep "^tcl" $JHALFSDIR/pkg_tarball_list | head -n1 ) + ;; + powerpc-utils) echo $(grep "^powerpc-utils" $JHALFSDIR/pkg_tarball_list | head -n1 ) + ;; + uClibc) + if [[ "${PROGNAME}" = "clfs3" ]]; then + echo $(grep "^uClibc-" $JHALFSDIR/pkg_tarball_list | head -n1 ) + else + echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) + fi + ;; + linux-headers) + if [[ "${PROGNAME}" = "lfs" ]] || [[ "${PROGNAME}" = "hlfs" ]] ; then + # Uses kernel headers directly + echo $(grep "^linux-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) + else + # CLFS{,2,3} use massaged headers package + echo $(grep "^linux-headers-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) + fi + ;; + *) echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) + ;; + esac + +} + +#======================= + + +#==== TARGET HEADER ==== + +#----------------------------------# +LUSER_wrt_target() { # Create target and initialize log file +#----------------------------------# + local i=$1 + local PREV=$2 +( +cat << EOF + +$i: $PREV + @\$(call echo_message, Building) + @export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID & + @echo "\$(nl_)\`date\`\$(nl_)" >logs/\$@ + @\$(PRT_DU) >>logs/\$@ +EOF +) >> $MKFILE.tmp +} + +#----------------------------------# +CHROOT_wrt_target() { # Create target and initialize log file +#----------------------------------# + local i=$1 + local PREV=$2 +( +cat << EOF + +$i: $PREV + @\$(call echo_message, Building) + @export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID & + @echo "\$(nl_)\`date\`\$(nl_)" >logs/\$@ + @\$(PRT_DU_CR) >>logs/\$@ +EOF +) >> $MKFILE.tmp +} + +#======================= + + +#======== UNPACK ======= + +#----------------------------------# +LUSER_wrt_unpack() { # Unpack and set 'ROOT' var +#----------------------------------# + local FILE=$1 + local optSAVE_PREVIOUS=$2 + + if [[ "${optSAVE_PREVIOUS}" != "1" ]]; then +( +cat << EOF + @\$(call remove_existing_dirs,$FILE) +EOF +) >> $MKFILE.tmp + fi + +( +cat << EOF + @\$(call unpack,$FILE) + @\$(call get_pkg_root_LUSER) +EOF +) >> $MKFILE.tmp +} + +#----------------------------------# +CHROOT_Unpack() { # +#----------------------------------# + local FILE=$1 + local optSAVE_PREVIOUS=$2 + + if [ "${optSAVE_PREVIOUS}" != "1" ]; then +( +cat << EOF + @\$(call remove_existing_dirs2,$FILE) +EOF +) >> $MKFILE.tmp + fi +( +cat << EOF + @\$(call unpack2,$FILE) + @\$(call get_pkg_root2) +EOF +) >> $MKFILE.tmp +} + +#======================= + + +#===== TESTS LOGS ====== + +#----------------------------------# +LUSER_wrt_test_log() { # Initialize testsuite log file +#----------------------------------# + local TESTLOGFILE=$1 +( +cat << EOF + @echo "export TEST_LOG=\$(TESTLOGDIR)/$TESTLOGFILE" >> envars && \\ + echo "\$(nl_)\`date\`\$(nl_)" >\$(TESTLOGDIR)/\$@ +EOF +) >> $MKFILE.tmp +} + +#----------------------------------# +CHROOT_wrt_test_log() { # +#----------------------------------# + local TESTLOGFILE=$1 +( +cat << EOF + @echo "export TEST_LOG=\$(crTESTLOGDIR)/$TESTLOGFILE" >> envars && \\ + echo "\$(nl_)\`date\`\$(nl_)" >test-logs/\$@ +EOF +) >> $MKFILE.tmp +} + +#======================= + + +#======== RUN AS ======= + +#----------------------------------# +wrt_RunAsRoot() { # Some scripts must be run as root.. +#----------------------------------# + local MOUNT_ENV + local file=$1 + + case ${PROGNAME} in + lfs ) MOUNT_ENV="LFS" ;; + clfs ) MOUNT_ENV="CLFS" ;; + clfs2 ) MOUNT_ENV="CLFS" ;; + clfs3 ) MOUNT_ENV="CLFS" ;; + hlfs ) MOUNT_ENV="HLFS" ;; + *) echo "undefined progname $PROGNAME"; exit 1 ;; + esac + +( +cat << EOF + @export ${MOUNT_ENV}=\$(MOUNT_PT) && \\ + ${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@ 2>&1 && \\ + \$(PRT_DU) >>logs/\$@ +EOF +) >> $MKFILE.tmp +} + +#----------------------------------# +LUSER_wrt_RunAsUser() { # Calculate time with perl, footer to log file +#----------------------------------# + local file=$1 + +( +cat << EOF + @source ~/.bashrc && \\ + \$(CMDSDIR)/`dirname $file`/\$@ >> logs/\$@ 2>&1 && \\ + \$(PRT_DU) >>logs/\$@ +EOF +) >> $MKFILE.tmp +} + +#----------------------------------# +CHROOT_wrt_RunAsRoot() { # +#----------------------------------# + local file=$1 +( +cat << EOF + @source envars && \\ + \$(crCMDSDIR)/`dirname $file`/\$@ >>logs/\$@ 2>&1 && \\ + \$(PRT_DU_CR) >>logs/\$@ +EOF +) >> $MKFILE.tmp + +} + +#======================= + + +#====== COPY FSTAB ===== + +#----------------------------------# +LUSER_wrt_CopyFstab() { # +#----------------------------------# +( +cat << EOF + @cp -v \$(MOUNT_PT)/sources/fstab \$(MOUNT_PT)/etc/fstab >>logs/\$@ 2>&1 && \\ + \$(PRT_DU) >>logs/\$@ +EOF +) >> $MKFILE.tmp +} + +#----------------------------------# +CHROOT_wrt_CopyFstab() { # +#----------------------------------# +( +cat << EOF + @cp -v /sources/fstab /etc/fstab >>logs/\$@ 2>&1 && \\ + \$(PRT_DU_CR) >>logs/\$@ +EOF +) >> $MKFILE.tmp +} + +#======================= + + +#==== INSTALLED FILES LOGS ==== + +#----------------------------------# +LUSER_wrt_TouchTimestamp() { # +#----------------------------------# +( +cat << EOF + @\$(call touch_timestamp_LUSER) +EOF +) >> $MKFILE.tmp +} + +#----------------------------------# +CHROOT_wrt_TouchTimestamp() { # +#----------------------------------# +( +cat << EOF + @\$(call touch_timestamp) +EOF +) >> $MKFILE.tmp +} + +#----------------------------------# +LUSER_wrt_LogNewFiles() { # +#----------------------------------# + local name=$1 +( +cat << EOF + @\$(call log_new_files_LUSER,$name) +EOF +) >> $MKFILE.tmp +} + +#----------------------------------# +CHROOT_wrt_LogNewFiles() { # +#----------------------------------# + local name=$1 +( +cat << EOF + @\$(call log_new_files,$name) +EOF +) >> $MKFILE.tmp +} + +#======================= + + +#==== RM BUILD DIRS ==== + +#----------------------------------# +LUSER_RemoveBuildDirs() { # +#----------------------------------# + local name=$1 +( +cat << EOF + @\$(call remove_build_dirs,$name) +EOF +) >> $MKFILE.tmp +} + +#----------------------------------# +CHROOT_wrt_RemoveBuildDirs() { # +#----------------------------------# + local name=$1 +( +cat << EOF + @\$(call remove_build_dirs2,$name) +EOF +) >> $MKFILE.tmp +} + +#======================= + + +#======== TOUCH ======== + +#----------------------------------# +wrt_touch() { # +#----------------------------------# +( +cat << EOF + @\$(call housekeeping) +EOF +) >> $MKFILE.tmp +} + +#======================= diff --git a/common/makefile-functions b/common/makefile-functions index 2333c1d..626567b 100644 --- a/common/makefile-functions +++ b/common/makefile-functions @@ -10,16 +10,24 @@ WHITE = "" YELLOW = "" OFF = "" -BOLD = "" REVERSE = "" +tab_ = " " +nl_ = "" + +#==== BUILD MESSAGES === define echo_PHASE - @clear @echo $(BOLD)-------------------------------------------------------------------------------- - @echo -e \\t\\tExecuting $(BLUE)$(1)$(WHITE) scripts + @echo $(tab_)$(tab_)Executing $(BLUE)$(1)$(WHITE) scripts @echo $(BOLD)-------------------------------------------------------------------------------- - #echo $(WHITE) + @echo $(WHITE) +endef + +define sh_echo_PHASE + echo $(BOLD)--------------------------------------------------------------------------------;\ + echo $(tab_)$(tab_)Executing $(BLUE)$(1)$(WHITE) scripts; \ + echo $(BOLD)--------------------------------------------------------------------------------echo $(WHITE) endef define echo_SU_request @@ -30,15 +38,13 @@ define echo_SU_request endef define echo_SULUSER_request - @clear @echo $(BOLD)-------------------------------------------------------------------------------- @echo $(BOLD)$(BLUE)$@ @echo $(WHITE)You are going to log into the user account $(BOLD)$(YELLOW)$(LUSER)$(OFF) - @echo su requires a password + @echo sudo requires a password endef define echo_CHROOT_request - @clear @echo $(BOLD)-------------------------------------------------------------------------------- @echo $(BOLD)$(BLUE)$@ @echo $(WHITE)You are going to CHROOT into $(MOUNT_PT) $(BOLD)$(YELLOW)$(LUSER)$(OFF) @@ -50,39 +56,44 @@ define echo_message @echo $(BOLD)$(1) target $(BLUE)$@$(BOLD)$(WHITE) endef +#======================= + + +#=== BUILD FUNCTIONS === + define remove_existing_dirs @PKG_PATH=`ls -t $(SRCSDIR)/$(1) | head -n1` && \ ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \ - rm -rf $(SRCSDIR)/$$ROOT && \ - rm -rf $(SRCSDIR)/$${ROOT%-*}-build + [ -n "$$ROOT" ] && \ + if [ -d $(SRCDIR)/$$ROOT ]; then \ + rm -rf $(SRCSDIR)/$$ROOT && \ + rm -rf $(SRCSDIR)/$${ROOT%-*}-build; \ + fi; endef define remove_existing_dirs2 @PKG_PATH=`ls -t $(SRC)/$(1) | head -n1` && \ ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \ - rm -rf $(SRC)/$$ROOT && \ - rm -rf $(SRC)/$${ROOT%-*}-build + [ -n "$$ROOT" ] && \ + if [ -d $(SRC)/$$ROOT ]; then \ + rm -rf $(SRC)/$$ROOT && \ + rm -rf $(SRC)/$${ROOT%-*}-build; \ + fi; endef -define remove_build_dirs - @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \ - rm -rf $(SRCSDIR)/$$ROOT && \ - rm -rf $(SRCSDIR)/$(1)-build +#==# + +define unpack + @cd $(SRCSDIR) && \ + tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST) endef -define remove_build_dirs2 - @ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \ - rm -rf $(SRC)/$$ROOT && \ - rm -rf $(SRC)/$(1)-build +define unpack2 + @cd $(SRC) && \ + tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST) endef -define housekeeping - @touch $@ && \ - sleep .25 && \ - echo -e "\n" $(BOLD)Target $(BLUE)$@ $(WHITE)$(BOLD)OK && \ - echo --------------------------------------------------------------------------------$(WHITE) - -endef +#==# define get_pkg_root @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \ @@ -104,30 +115,70 @@ define get_pkg_root_LUSER echo "export PKGDIR=$(SRCSDIR)/$$ROOT" > envars endef -define unpack - @cd $(SRCSDIR) && \ - tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST) +#==# + +define touch_timestamp + @touch $(SRC)/timestamp-marker && sleep 1 endef -define unpack2 - @cd $(SRCSDIR) && \ - /tools/bin/tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST) +define touch_timestamp_LUSER + @touch $(SRCSDIR)/timestamp-marker && sleep 1 endef -define unpack3 - @cd $(SRC) && \ - tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST) +define log_new_files + @find / -xdev ! -path "/$(SCRIPT_ROOT)/*" ! -path "/tmp/*" ! -path "$(SRC)/*" \ + -newer $(SRC)/timestamp-marker -not -type d \ + -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(crFILELOGDIR)/$(1) endef +define log_new_files_LUSER + @find $(BASEDIR) -xdev ! -path "$(BASEDIR)/$(SCRIPT_ROOT)/*" ! -path "$(BASEDIR)/tmp/*" ! -path "$(SRCSDIR)/*" \ + -newer $(SRCSDIR)/timestamp-marker -not -type d \ + -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(BASEDIR)$(crFILELOGDIR)/$(1) +endef + +#==@ + +define remove_build_dirs + @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \ + rm -rf $(SRCSDIR)/$$ROOT && \ + rm -rf $(SRCSDIR)/$(1)-build +endef + +define remove_build_dirs2 + @ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \ + rm -rf $(SRC)/$$ROOT && \ + rm -rf $(SRC)/$(1)-build +endef + +#==# + +define housekeeping + @touch $@ && \ + sleep .25 && \ + echo -e "\n" $(BOLD)Target $(BLUE)$@ $(WHITE)$(BOLD)OK && \ + echo --------------------------------------------------------------------------------$(WHITE) && \ + if [ "$(BREAKPOINT)" = "$@" ] ; then \ + echo $(tab_)$(RED)The build has been stopped at $(BLUE)$@ $(RED)as requested$(WHITE) ; \ + false ; \ + fi +endef + +#======================= + + +#==== FINAL MESSAGES === + define echo_report - @echo - @echo $(BOLD) The report file $(BLUE)$(1)$(BOLD) has been created - @echo - @echo ${WHITE}Please send the $(BOLD)$(MOUNT_PT)/jhalfs/$(1)$(WHITE) - @echo file to $(BOLD)manuel@linuxfromscratch.org$(WHITE) - @echo - @echo That will help us to keep more accurate SBU and - @echo disk usage values into the book. Thanks. + echo ; \ + echo $(BOLD) The report file $(BLUE)$(1)$(BOLD) has been created ; \ + echo ; \ + echo $(WHITE)Please send the $(BOLD)$(MOUNT_PT)/jhalfs/$(1)$(WHITE) ; \ + echo file to $(BOLD)manuel@linuxfromscratch.org$(WHITE) ; \ + echo ; \ + echo That will help us to keep more accurate SBU and ; \ + echo disk usage values into the book. Thanks. ; \ + echo $(BOLD)--------------------------------------------------------------------------------$(WHITE) endef define echo_finished @@ -135,39 +186,39 @@ define echo_finished @echo -------------------------------------------------------------------------------- @echo $(BOLD) Finished the build of $(BLUE)$(1)$(BOLD) @echo -------------------------------------------------------------------------------- - @echo -e \\t\\t$(RED)W A R N I N G$(BOLD) + @echo $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD) @echo -------------------------------------------------------------------------------- @echo @echo To be able to boot your new system you need to follow @echo the next steps:$(WHITE) @echo - @echo -e \\t- Enter to the chroot using the command found - @echo -e \\tin the section -Entering the Chroot Environment- - @echo -e \\texcept if building CLFS with METHOD=boot. + @echo $(tab_)- Enter to the chroot using the command found + @echo $(tab_)in the section -Entering the Chroot Environment- + @echo $(tab_)except if building CLFS with METHOD=boot. @echo - @echo -e \\t- Set a password for the root user. + @echo $(tab_)- Set a password for the root user. @echo - @echo -e \\t- Edit or create /etc/fstab, /etc/hosts, /etc/sysconfig/clock, - @echo -e \\t/etc/sysconfig/console, /etc/sysconfig/network, - @echo -e \\t/etc/sysconfig//network-devices/ifconfig.eth0/ipv4 and - @echo -e \\tany other configuration file required to suit your needs. + @echo $(tab_)- Edit or create /etc/fstab, /etc/hosts, /etc/sysconfig/clock, + @echo $(tab_)/etc/sysconfig/console, /etc/sysconfig/network, + @echo $(tab_)/etc/sysconfig//network-devices/ifconfig.eth0/ipv4 and + @echo $(tab_)any other configuration file required to suit your needs. @echo - @echo -e \\t- Exit from the chroot. + @echo $(tab_)- Exit from the chroot. @echo - @echo -e \\t- Set-up the boot loader, except if building CLFS with METHOD=boot. - @echo -e \\tYou can set-up the host bootloader or the new boot-loader - @echo -e \\tinstalled on the new system. - @echo -e \\tIf the last, you must to mount the virtual filesystems, re-enter - @echo -e \\tthe chroot and be sure that /dev is populated with the - @echo -e \\trequired devices before configure the boot-loader. When ready, - @echo -e \\texit from the chroot and umount the filesystems + @echo $(tab_)- Set-up the boot loader, except if building CLFS with METHOD=boot. + @echo $(tab_)You can set-up the host bootloader or the new boot-loader + @echo $(tab_)installed on the new system. + @echo $(tab_)If the last, you must to mount the virtual filesystems, re-enter + @echo $(tab_)the chroot and be sure that /dev is populated with the + @echo $(tab_)required devices before configure the boot-loader. When ready, + @echo $(tab_)exit from the chroot and umount the filesystems @echo @echo If you are an experienced LFS user, several of those steps can be @echo skipped or done in a different way. But then, that is something @echo that you already know and there is no need to discuss it here. @echo $(BOLD) @echo -------------------------------------------------------------------------------- - @echo -e \\t\\t$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD) + @echo $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD) @echo --------------------------------------------------------------------------------$(WHITE) endef @@ -176,22 +227,22 @@ define echo_boot_finished @echo -------------------------------------------------------------------------------- @echo $(BOLD) Finished building a minimal boot system for $(BLUE)$(1)$(BOLD) @echo -------------------------------------------------------------------------------- - @echo -e \\t\\t$(RED)W A R N I N G$(BOLD) + @echo $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD) @echo -------------------------------------------------------------------------------- @echo @echo The build is not complete. Follow the next steps:$(WHITE) @echo - @echo -e \\t- Edit or create $(MOUNT_PT)/etc/fstab - @echo -e \\t and any other configuration file required to suit your needs. + @echo $(tab_)- Edit or create $(MOUNT_PT)/etc/fstab + @echo $(tab_) and any other configuration file required to suit your needs. @echo $(BOLD) @echo $(BOLD)$(YELLOW) @echo 1.If it is necessary, transfer the newly created partition to the target machine @echo 2.Boot the new partition. @echo 3.Once you are logged in issue the following commands - @echo -e \\t $(BOLD})cd /jhalfs - @echo -e \\t $(BOLD)make makesys + @echo $(tab_) $(BOLD)cd /jhalfs + @echo $(tab_) $(BOLD)make makesys @echo The build process should resume. Follow any instructions that appear. @echo -------------------------------------------------------------------------------- - @echo -e \\t\\t$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD) + @echo $(tab_)$(tab_)$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD) @echo --------------------------------------------------------------------------------$(WHITE) endef diff --git a/common/packages.xsl b/common/packages.xsl index 4ca007b..5eab0a7 100644 --- a/common/packages.xsl +++ b/common/packages.xsl @@ -7,12 +7,22 @@ + + + + + + - + diff --git a/common/progress_bar.sh b/common/progress_bar.sh old mode 100755 new mode 100644 index 622dc15..41926fe --- a/common/progress_bar.sh +++ b/common/progress_bar.sh @@ -1,4 +1,3 @@ -#!/bin/bash # $Id$ @@ -24,6 +23,13 @@ declare -a GRAPHIC_STR="| / - \\ + " declare -i SEC=0 # Seconds accumulator declare -i PREV_SEC=0 +# Prevent segfault on stripping phases +if [[ "$BASHBIN" = "/tools/bin/bash" ]] ; then + SLEEP=/tools/bin/sleep +else + SLEEP=/bin/sleep +fi + write_or_exit() { # make has been killed or failed or run to completion, leave [[ ! -e /proc/${MAKE_PPID} ]] && echo -n "${CURSOR_ON}" && exit @@ -44,7 +50,7 @@ while true ; do # Loop through the animation string for GRAPHIC_CHAR in ${GRAPHIC_STR} ; do write_or_exit "${CSI}$((SEC + 3))G${GRAPHIC_CHAR}" - sleep .12 # This value MUST be less than .2 seconds. + $SLEEP .12 # This value MUST be less than .2 seconds. done # A BASH internal variable, the number of seconds the script diff --git a/common/urls.xsl b/common/urls.xsl index 4a60bd8..b136eb5 100644 --- a/common/urls.xsl +++ b/common/urls.xsl @@ -10,9 +10,15 @@ ftp://ftp.osuosl.org + + lfs + + + + @@ -23,8 +29,10 @@ duplicated URLs due that may be splitted for PDF output --> @@ -42,10 +50,10 @@ - + - dummy-url + @@ -54,7 +62,9 @@ - /pub/lfs/conglomeration/ + /pub/ + + /conglomeration/