From 5769ccdbb2ad4b5b90b7e25b0045d7995b8679bb Mon Sep 17 00:00:00 2001 From: Manuel Canales Esparcia Date: Fri, 26 May 2006 23:53:13 +0000 Subject: [PATCH] Improved packages.sh. Started support for GNOME and KDE meta-packages. --- BLFS/func_packages | 74 ++++++++++++++++++++++++++++++++++++++++++++++ BLFS/packages.sh | 53 ++++++++++++++++++++++++++++----- 2 files changed, 120 insertions(+), 7 deletions(-) create mode 100644 BLFS/func_packages diff --git a/BLFS/func_packages b/BLFS/func_packages new file mode 100644 index 0000000..5a2916e --- /dev/null +++ b/BLFS/func_packages @@ -0,0 +1,74 @@ +#!/bin/bash +# +# $Id$ +# +set -e + +#-----------------------# +generate_packages() { # Master packages file +#-----------------------# + local pkg_id file + + > packages.tmp + + # Extract Id and path for sect1 files + for file in `find $BLFS_XML -name "*.xml"` ; do + pkg_id=`grep "sect1 id" $file | sed -e 's/> packages.tmp + done + + # IDs clean-up (unuseful pages or commented-out packages, could be more) + sed -i '/template/d;/ntroduction/d;/preface/d' packages.tmp + sed -i '/courier.xml/d' packages.tmp + sed -i '/nautilus-media.xml/d;/gal.xml/d;/gpdf.xml/d;/gv.xml/d' packages.tmp + + # Add header with meta-packages pseudo Id +{ + cat << EOF + +=== GNOME META-PACKAGES === +# GNOME base packages +gnome-core $BLFS_XML +# All GNOME packages +gnome-full $BLFS_XML + +=== KDE META-PACKAGES === +# KDE base packages +kde-core $BLFS_XML +# All KDE packages +kde $BLFS_XML +# All KDE packages plus Koffice +kde-full $BLFS_XML + +=== INDIVIDUAL PACKAGES === + +EOF +} > packages + + # Dump packages list + sort packages.tmp >> packages + + # Clean up + rm packages.tmp +} + +# Pre-made *.dep files for meta-packages + +#--------------------------# +generate_gnome_core() { # GNOME core +#--------------------------# + local line base_xml package + + > gnome-core.dep.tmp + + for line in `grep "xi:include" $BLFS_XML/gnome/core/core.xml` ; do + base_xml=`echo $line | sed 's/^.*href="//;s/".*//'` + echo "base_xml = $base_xml" >> base_xml + package=`grep "gnome/core/$base_xml" packages | cut -f1` + [[ -n "$package" ]] && echo $package >> gnome-core.dep.tmp + done + + tac gnome-core.dep.tmp > gnome-core.dep + rm gnome-core.dep.tmp +} + diff --git a/BLFS/packages.sh b/BLFS/packages.sh index 297916b..f7c2736 100755 --- a/BLFS/packages.sh +++ b/BLFS/packages.sh @@ -4,14 +4,53 @@ # set -e +#--------------------- +# packages module +source func_packages +[[ $? > 0 ]] && echo -e "\n\tERROR: func_packages did not load..\n" && exit + + +if [[ -z "$1" ]] ; then + echo -e "n\tYou must to provide the name of the BLFS book sources directory.\n" + exit 1 +fi + BLFS_XML=$1 -> packages.tmp +if [[ ! -d $BLFS_XML ]] ; then + echo -e "\n\t$BLFS_XML is not a directory\n" + exit 1 +fi -for file in `find $BLFS_XML -name "*.xml"` ; do - pkg_id=`grep "sect1 id" $file | sed -e 's/> packages.tmp -done +if [[ ! -f $BLFS_XML/use-unzip.xml ]] ; then + echo -e "\n\tLooks like $BLFS_XML is not a BLFS book sources directory\n" + exit 1 +fi -sort packages.tmp -o packages -rm packages.tmp +if [[ -n "$2" ]] ; then + case $2 in + update ) + 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 + ;; + * ) + echo -e "\n\tUnknown option $2 ignored.\n" + ;; + esac +fi + +echo -en "\n\tGenerating packages file ..." +generate_packages +echo "done." + +echo -en "\tGenerating gnome-core dependencies list ..." +generate_gnome_core +echo "done."