Merged r2936:2940 from trunk
This commit is contained in:
parent
d0d9e90e30
commit
00f4966aa3
9 changed files with 291 additions and 110 deletions
|
@ -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}"
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
<!-- $Id$ -->
|
||||
|
||||
<!-- NOTE: the base dir (blfs-xml) must be changed to FAKEDIR on the
|
||||
final version and set it to the proper dir via a sed in ./blfs -->
|
||||
<!-- NOTE: the base dir (blfs-xml) is set to the proper dir
|
||||
via a sed in ./blfs -->
|
||||
<xsl:import href="../blfs-xml/stylesheets/blfs-chunked.xsl"/>
|
||||
|
||||
<xsl:param name="mail_server" select="sendmail"/>
|
||||
|
|
|
@ -126,7 +126,7 @@ create_build_scripts() { #
|
|||
#-------------------------#
|
||||
: <<inline_doc
|
||||
function: Create shell scripts of the requested TARGET.
|
||||
input vars: nothing
|
||||
input vars: $1 use sudo n/y
|
||||
externals: TARGET
|
||||
modifies: nothing
|
||||
returns: nothing
|
||||
|
@ -140,6 +140,7 @@ inline_doc
|
|||
|
||||
echo -en "\n\tGenerating the build scripts ..."
|
||||
xsltproc --xinclude --nonet \
|
||||
--stringparam sudo $SUDO \
|
||||
-o ./scripts/ ../libs/scripts.xsl \
|
||||
$TARGET-index.xml >> xsltproc.log 2>&1
|
||||
echo -e "done\n"
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
|
||||
<!-- XSLT stylesheet to create shell scripts from "linear build" BLFS books. -->
|
||||
|
||||
<!-- Build as user (y) or as root (n)? -->
|
||||
<xsl:param name="sudo" select="y"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates select="//sect1"/>
|
||||
</xsl:template>
|
||||
|
@ -344,11 +347,11 @@ cd $UNPACKDIR
|
|||
|
||||
<xsl:template match="screen">
|
||||
<xsl:if test="child::* = userinput and not(@role = 'nodump')">
|
||||
<xsl:if test="@role = 'root'">
|
||||
<xsl:if test="@role = 'root' and $sudo = 'y'">
|
||||
<xsl:text>sudo sh -c "</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="userinput"/>
|
||||
<xsl:if test="@role = 'root'">
|
||||
<xsl:if test="@role = 'root' and $sudo = 'y'">
|
||||
<xsl:text>"</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>
</xsl:text>
|
||||
|
|
|
@ -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() { #
|
||||
#----------------------------#
|
||||
: <<inline_doc
|
||||
function: Retrieve a fresh copy or upate an existing copy of the BLFS svn tree
|
||||
input vars: $1 BLFS_XML directory
|
||||
$2 DOC_MODE action get/update
|
||||
externals: none
|
||||
modifies: $BLFS_XML directory tree
|
||||
returns: nothing
|
||||
output:
|
||||
on error: exit
|
||||
on success: text messages
|
||||
inline_doc
|
||||
|
||||
# Redundant definitions but this function may be reused
|
||||
local BLFS_XML=$1
|
||||
local DOC_MODE=$2
|
||||
|
||||
if [[ -z "$BLFS_XML" ]] ; then
|
||||
echo -e "\n\tYou must to provide the name of the BLFS book sources directory.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -n "$DOC_MODE" ]] ; then
|
||||
case $DOC_MODE in
|
||||
update )
|
||||
if [[ ! -d $BLFS_XML ]] ; then
|
||||
echo -e "\n\t$BLFS_XML is not a directory\n"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f $BLFS_XML/x/x.xml ]] ; then
|
||||
echo -e "\n\tLooks like $BLFS_XML is not a BLFS book sources directory\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -d $BLFS_XML/.svn ]] ; then
|
||||
echo -e "\n\tUpdating the $BLFS_XML book sources ...\n"
|
||||
pushd $BLFS_XML 1> /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"
|
||||
|
92
BLFS/update_book.sh
Executable file
92
BLFS/update_book.sh
Executable file
|
@ -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() { #
|
||||
#----------------------------#
|
||||
: <<inline_doc
|
||||
function: Retrieve or upate a copy of the BLFS book
|
||||
input vars: $1 BLFS_XML book sources directory
|
||||
$2 DOC_MODE action get/update
|
||||
$3 TREE SVN tree when $2=get
|
||||
externals: none
|
||||
modifies: $BLFS_XML directory tree
|
||||
returns: nothing
|
||||
output:
|
||||
on error: exit
|
||||
on success: text messages
|
||||
inline_doc
|
||||
|
||||
case $DOC_MODE in
|
||||
update )
|
||||
if [[ ! -d $BLFS_XML ]] ; then
|
||||
echo -e "\n\t$BLFS_XML is not a directory\n"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f $BLFS_XML/x/x.xml ]] ; then
|
||||
echo -e "\n\tLooks like $BLFS_XML is not a BLFS book sources directory\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -d $BLFS_XML/.svn ]] ; then
|
||||
echo -e "\n\tUpdating the $BLFS_XML book sources ...\n"
|
||||
pushd $BLFS_XML 1> /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"
|
||||
|
28
Config.in
28
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"
|
||||
|
|
94
README.BLFS
Normal file
94
README.BLFS
Normal file
|
@ -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)
|
||||
|
67
blfs
67
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 <configuration>..."
|
||||
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
|
||||
|
||||
|
|
Reference in a new issue