diff --git a/BLFS/blfs-parser.sh b/BLFS/blfs-parser.sh index 60cfe20..506c2e3 100755 --- a/BLFS/blfs-parser.sh +++ b/BLFS/blfs-parser.sh @@ -10,8 +10,11 @@ declare BLFS_XML declare VERBOSITY=1 # Grab and name the command line options - optTARGET=$1 -optDEPENDENCY=$2 + optTARGET=$1 # Package target +optDEPENDENCY=$2 # Dependencies level, 1/2/3 + SUDO=$3 # Build as user (y) or as root (n) + +[[ -z $SUDO ]] && SUDO=y #--------------------- @@ -113,4 +116,4 @@ validate_dependency "${optDEPENDENCY}" generate_dependency_tree generate_TARGET_xml generate_target_book -create_build_scripts +create_build_scripts "${SUDO}" diff --git a/BLFS/libs/book.xsl b/BLFS/libs/book.xsl index bfc6a1c..1a1c6b5 100644 --- a/BLFS/libs/book.xsl +++ b/BLFS/libs/book.xsl @@ -6,8 +6,8 @@ - + diff --git a/BLFS/libs/func_parser b/BLFS/libs/func_parser index 2f97be8..9963f0d 100644 --- a/BLFS/libs/func_parser +++ b/BLFS/libs/func_parser @@ -126,7 +126,7 @@ create_build_scripts() { # #-------------------------# : <> xsltproc.log 2>&1 echo -e "done\n" diff --git a/BLFS/libs/scripts.xsl b/BLFS/libs/scripts.xsl index 9daacba..6f37254 100644 --- a/BLFS/libs/scripts.xsl +++ b/BLFS/libs/scripts.xsl @@ -9,6 +9,9 @@ + + + @@ -344,11 +347,11 @@ cd $UNPACKDIR - + sudo sh -c " - + " diff --git a/BLFS/packages.sh b/BLFS/packages.sh deleted file mode 100755 index a85b2e0..0000000 --- a/BLFS/packages.sh +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash -# -# $Id$ -# -set -e - -declare -r SVN="svn://svn.linuxfromscratch.org" - -BLFS_XML=$1 # Book directory -DOC_MODE=$2 # Action to take, only update at the moment - -#--------------------- -# packages module -source libs/func_packages -[[ $? > 0 ]] && echo -e "\n\tERROR: func_packages did not load..\n" && exit - -#----------------------------# -BOOK_Source() { # -#----------------------------# -: < /dev/null - svn up - popd 1> /dev/null - echo -e "\n\tBook sources updated." - else - echo -e "\n\tLooks like $BLFS_XML is not a svn working copy." - echo -e "\tSkipping BLFS sources update.\n" - fi - ;; - - get ) - [[ ! -d $BLFS_XML ]] && mkdir -pv $BLFS_XML - svn co $SVN/BLFS/trunk/BOOK $BLFS_XML 2>&1 - ;; - * ) - echo -e "\n\tUnknown option ${DOC_MODE} ignored.\n" - ;; - esac - fi -} - -BOOK_Source $BLFS_XML $DOC_MODE - -echo -en "\n\tGenerating packages file ..." -generate_packages -echo "done." - -echo -en "\tGenerating gnome-core dependencies list ..." -generate_gnome_core -echo "done." - -echo -en "\tGenerating gnome-full dependencies list ..." -generate_gnome_full -echo "done." - -echo -en "\tGenerating kde-core dependencies list ..." -generate_kde_core -echo "done." - -echo -en "\tGenerating kde-full dependencies list ..." -generate_kde_full -echo -e "done.\n" - diff --git a/BLFS/update_book.sh b/BLFS/update_book.sh new file mode 100755 index 0000000..734544b --- /dev/null +++ b/BLFS/update_book.sh @@ -0,0 +1,92 @@ +#!/bin/bash +# +# $Id$ +# +set -e + +declare -r SVN="svn://svn.linuxfromscratch.org" + +BLFS_XML=$1 # Book directory +DOC_MODE=$2 # Action to take, update or get +TREE=$3 # SVN tree for the BLFS book version + +[[ -z $BLFS_XML ]] && BLFS_XML=blfs-xml +[[ -z $DOC_MODE ]] && DOC_MODE=update +[[ -z $TREE ]] && TREE=trunk/BOOK + +#--------------------- +# packages module +source libs/func_packages +[[ $? > 0 ]] && echo -e "\n\tERROR: func_packages did not load..\n" && exit + +#----------------------------# +BOOK_Source() { # +#----------------------------# +: < /dev/null + svn up + popd 1> /dev/null + echo -e "\n\tBook sources updated." + else + echo -e "\n\tLooks like $BLFS_XML is not a svn working copy." + echo -e "\tSkipping BLFS sources update.\n" + fi + ;; + + get ) + [[ ! -d $BLFS_XML ]] && mkdir -pv $BLFS_XML + svn co $SVN/BLFS/$TREE $BLFS_XML 2>&1 + ;; + * ) + echo -e "\n\tUnknown option ${DOC_MODE} ignored.\n" + ;; + esac +} + +BOOK_Source + +echo -en "\n\tGenerating packages file ..." +generate_packages +echo "done." + +echo -en "\tGenerating gnome-core dependencies list ..." +generate_gnome_core +echo "done." + +echo -en "\tGenerating gnome-full dependencies list ..." +generate_gnome_full +echo "done." + +echo -en "\tGenerating kde-core dependencies list ..." +generate_kde_core +echo "done." + +echo -en "\tGenerating kde-full dependencies list ..." +generate_kde_full +echo -e "done.\n" + diff --git a/Config.in b/Config.in index e537ab0..a35a101 100644 --- a/Config.in +++ b/Config.in @@ -22,8 +22,8 @@ menu "--- BOOK Settings" config BOOK_HLFS bool "Hardened Linux From Scratch" -# config BOOK_BLFS -# bool "Beyond Linux From Scratch" + config BOOK_BLFS + bool "Beyond Linux From Scratch" endchoice config RUN_ME @@ -33,7 +33,7 @@ menu "--- BOOK Settings" default "./clfs2" if BOOK_CLFS2 # default "./clfs3" if BOOK_CLFS3 default "./hlfs" if BOOK_HLFS -# default "./blfs" if BOOK_BLFS + default "./blfs" if BOOK_BLFS #--- End BOOK/script #--- Book version @@ -47,6 +47,7 @@ menu "--- BOOK Settings" config WORKING_COPY bool "Working Copy" + depends on !BOOK_BLFS help #-- A local working copy @@ -277,10 +278,29 @@ menu "--- BOOK Settings" default "uclibc" if LIB_UCLIBC #--- End HLFS specific params + #--- BLFS specific params + config BLFS_ROOT + string "Directory root" + default "$HOME/blfs_root" + depends on BOOK_BLFS + help + #-- Full path to the directory where all required + # files and scripts will be stored. + + config BLFS_XML + string "BLFS sources directory" + default "blfs-xml" + depends on BOOK_BLFS + help + #-- The directory name where BLFS book sources + # will be checkout. + #--- End BLFS specific params + #--- End BOOK Settings endmenu menu "--- General Settings" + depends on !BOOK_BLFS #--- Set User Account config CONFIG_USER @@ -383,6 +403,7 @@ menu "--- General Settings" endmenu menu "--- Build Settings" + depends on !BOOK_BLFS #--- Test Suites config CONFIG_TESTS @@ -549,6 +570,7 @@ menu "--- Build Settings" endmenu menu "--- Advanced Features" + depends on !BOOK_BLFS config REPORT bool "Create SBU and disk usage report" diff --git a/README.BLFS b/README.BLFS new file mode 100644 index 0000000..7e8ba54 --- /dev/null +++ b/README.BLFS @@ -0,0 +1,94 @@ +$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 + defaul layout, there are circular dependencies, several packages can be + installed on a non default prifix, build commands can change based on what + dependencies will be used, etc. + + Said that, the goal of jhalfs is try to help you solving packages + dependencies and creating your own build scripts/Makefile. Some of the + auto-generated build scripts and Makefile could work "as is", but as a + general rule you will need to review and edit the scripts while reading + the book. + + NOTE:: The code is yet under development a may contains several bugs + + +2. USAGE:: + + Due the complexity of the BLFS book, the scripts/Mafile generation is + done in several steps: + + 2.1 INSTALLATION:: + Run "make" to launch the menuconfig interface. Select the BLFS book + and it version. Then set the installation directory (default + $HOME/blfs_root) and the BLFS sources directory (default blfs-xml). + + All required files will be placed in the installation directory and + BLFS XML sources will be checkout to the named sub-directory. + + Installed files: + + lib/* functions, xsl, and auto-generates dependencies tree files + README.BLFS this file + TODO developers notes + packages auto-generated file with packages info + alternatives.conf configuration files for alternative packages + makefile.conf envars needed when running the generated Makefile + update_book.sh update the XML book sources and regenerate packages file + and GNOME and KDE dependencies tree + blfs-parser.sh generates linear BLFS books and build scripts + gen-makefile.sh generates Makefile + progress_bar.sh the Makefile progress bar + + From now on, all the work must be done from inside the installation + root directory. + + 2.2 UPDATING BOOK SOURCES:: + If using the SVN book version, from time to time you may want to update + the XML sources. To do that run "./update_book.sh" + + 2.3 PARSING THE BOOK:: + Next step is to create a book and build scripts in dependencies build order + for a target package. A target package can be any of the ones listed in the + packages file. That is done using the blfs-parser.sh script, but we are triying + to make a menuconfig based system. + + The script need three arguments: + + package name as listed in packages file + dependencies level 1 for required, 2 for required an recommendedand, + 3 for required, recommended, and optional + sudo usage y if sudo will be used (you will build as normal user) + n if sudo isn't needed (you will build as root) + + For example: + + ./blfs-parser galeon 3 y + + will create a directory named "galeon". Inside that directory you find a + directory named "HTML" that contains a galeon-based HTML book with all + dependencies in build order and a "scripts" directory with build scripts + that uses sudo for commands that need root priviledges. + + There is also two other directories that contains files generated while + resolving dependencies trees. + + Now is the time to review the generated book and scripts, making in the + scripts any changes you want to fit your needs. Scripts for aditional + packages (i.e., for non-BLFS packages) can be inserted in an easy way. + + 2.4 CREATING THE MAKEFILE + When the build scripts will be ready to be run, the Makefile can be + created. Be sure that you are into the "package" directory and run + + ../gen_makefile.sh + + Review the Makefile and if all look sane, start the build. + + +(Text is needed for the installed packages tracking system and like) + diff --git a/blfs b/blfs index 19dc883..d522792 100755 --- a/blfs +++ b/blfs @@ -1,6 +1,69 @@ #!/bin/bash +# $Id$ + set -e -echo -e "\n BLFS support has been dissabled for now.\n" -exit 0 +#>>>>>>>>>>>>>>>ERROR TRAPPING >>>>>>>>>>>>>>>>>>>> +#-----------------------# +simple_error() { # Basic error trap.... JUST DIE +#-----------------------# + # If +e then disable text output + if [[ "$-" =~ "e" ]]; then + echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2 + fi +} + +see_ya() { + echo -e "\n\t${BOLD}Goodbye and thank you for choosing ${L_arrow}jhalfs${R_arrow}\n" +} +##### Simple error TRAPS +# ctrl-c SIGINT +# ctrl-y +# ctrl-z SIGTSTP +# SIGHUP 1 HANGUP +# SIGINT 2 INTRERRUPT FROM KEYBOARD Ctrl-C +# SIGQUIT 3 +# SIGKILL 9 KILL +# SIGTERM 15 TERMINATION +# SIGSTOP 17,18,23 STOP THE PROCESS +##### +set -e +trap see_ya 0 +trap simple_error ERR +trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" && exit 2' 1 2 3 15 17 18 23 +#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + +VERBOSITY=1 + +[[ $VERBOSITY > 0 ]] && echo -n "Loading config params from ..." +source configuration +[[ $? > 0 ]] && echo "file:configuration did not load.." && exit 1 +[[ $VERBOSITY > 0 ]] && echo "OK" + +[[ -z $BOOK_BLFS ]] && echo -e "\nNo BLFS configuration found. Please configure it." && exit 1 + +TREE=trunk/BOOK + +if [[ ! -z ${BRANCH_ID} ]]; then + case $BRANCH_ID in + dev* | SVN | trunk ) TREE=trunk/BOOK ;; + branch-* ) TREE=branches/${BRANCH_ID#branch-}/BOOK ;; + * ) TREE=tags/${BRANCH_ID}/BOOK ;; + esac +fi + +[[ ! -d $BLFS_ROOT ]] && mkdir -p $BLFS_ROOT + +cp -r BLFS/* $BLFS_ROOT +cp common/progress_bar.sh $BLFS_ROOT +# cp -r menu $BLFS_ROOT + +cd $BLFS_ROOT + +sed -i 's,blfs-xml,'$BLFS_XML',' update_book.sh +sed -i 's,blfs-xml,'$BLFS_XML',' libs/book.xsl + +./update_book.sh $BLFS_XML get $TREE +# make +