diff --git a/BLFS/packages.sh b/BLFS/packages.sh index 739e73f..af649e8 100755 --- a/BLFS/packages.sh +++ b/BLFS/packages.sh @@ -4,6 +4,8 @@ # 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 @@ -12,41 +14,66 @@ DOC_MODE=$2 # Action to take, only update at the moment 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 + 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" ;; - * ) - echo -e "\n\tUnknown option ${DOC_MODE} ignored.\n" - ;; - esac -fi + esac + fi +} + +BOOK_Source $BLFS_XML $DOC_MODE echo -en "\n\tGenerating packages file ..." generate_packages