From 82aa9bf6f374df97a0da218e319ecbc3ef3551fe Mon Sep 17 00:00:00 2001 From: Manuel Canales Esparcia Date: Sun, 13 Aug 2006 11:15:07 +0000 Subject: [PATCH] Added support for branches and setting default values. --- BLFS/packages.sh | 83 +++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 44 deletions(-) diff --git a/BLFS/packages.sh b/BLFS/packages.sh index da55f2c..734544b 100755 --- a/BLFS/packages.sh +++ b/BLFS/packages.sh @@ -7,7 +7,12 @@ 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 +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 @@ -18,9 +23,10 @@ source libs/func_packages 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" + 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 ;; - 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 ..." generate_packages