Added support for branches and setting default values.

This commit is contained in:
Manuel Canales Esparcia 2006-08-13 11:15:07 +00:00
parent cb18ec72f9
commit 82aa9bf6f3

View file

@ -7,7 +7,12 @@ set -e
declare -r SVN="svn://svn.linuxfromscratch.org" declare -r SVN="svn://svn.linuxfromscratch.org"
BLFS_XML=$1 # Book directory BLFS_XML=$1 # Book directory
DOC_MODE=$2 # Action to take, only update at the moment 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 # packages module
@ -18,9 +23,10 @@ source libs/func_packages
BOOK_Source() { # BOOK_Source() { #
#----------------------------# #----------------------------#
: <<inline_doc : <<inline_doc
function: Retrieve a fresh copy or upate an existing copy of the BLFS svn tree function: Retrieve or upate a copy of the BLFS book
input vars: $1 BLFS_XML directory input vars: $1 BLFS_XML book sources directory
$2 DOC_MODE action get/update $2 DOC_MODE action get/update
$3 TREE SVN tree when $2=get
externals: none externals: none
modifies: $BLFS_XML directory tree modifies: $BLFS_XML directory tree
returns: nothing returns: nothing
@ -29,51 +35,40 @@ BOOK_Source() { #
on success: text messages on success: text messages
inline_doc inline_doc
# Redundant definitions but this function may be reused case $DOC_MODE in
local BLFS_XML=$1 update )
local DOC_MODE=$2 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 [[ -z "$BLFS_XML" ]] ; then if [[ -d $BLFS_XML/.svn ]] ; then
echo -e "\n\tYou must to provide the name of the BLFS book sources directory.\n" echo -e "\n\tUpdating the $BLFS_XML book sources ...\n"
exit 1 pushd $BLFS_XML 1> /dev/null
fi svn up
popd 1> /dev/null
if [[ -n "$DOC_MODE" ]] ; then echo -e "\n\tBook sources updated."
case $DOC_MODE in else
update ) echo -e "\n\tLooks like $BLFS_XML is not a svn working copy."
if [[ ! -d $BLFS_XML ]] ; then echo -e "\tSkipping BLFS sources update.\n"
echo -e "\n\t$BLFS_XML is not a directory\n" fi
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 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 $BLFS_XML $DOC_MODE BOOK_Source
echo -en "\n\tGenerating packages file ..." echo -en "\n\tGenerating packages file ..."
generate_packages generate_packages