From 1bf09c15a7bc85a01a996453bc9d11fa36ba1331 Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Thu, 23 Mar 2023 18:38:51 +0100 Subject: [PATCH] Implementation of dependency checking 4 Implement generation of a modified script if dependency checking is requested. --- BLFS/gen_pkg_book.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/BLFS/gen_pkg_book.sh b/BLFS/gen_pkg_book.sh index dd8f633..e953013 100755 --- a/BLFS/gen_pkg_book.sh +++ b/BLFS/gen_pkg_book.sh @@ -297,4 +297,50 @@ xsltproc --xinclude --nonet \ chmod -R +x scripts echo -e "done\n" +if [ -n "$DEP_CHECK" ]; then + if (( ${#TARGET[*]} != 1 )); then + printf "\nWARNING: If dependencies are checked, only one package\n" + printf " shoud be selected. Not generating check code.\n" + exit + fi + + LIST_LFS="$(xsltproc $ListLFS $LFS_FULL)" + LIST_NEEDED="$(echo $FULL_LIST)" + LIST_INSTALLED="$(porg -a | sed 's/-[[:digit:]].*//')" + LIST_UNNEEDED= + for p in $LIST_INSTALLED; do + case " $LIST_LFS " in *" $p "*) continue ;; esac + case " $LIST_NEEDED " in *" $p "*) continue ;; esac + LIST_UNNEEDED="$LIST_UNNEEDED $p" + done + cat >head.tmp <tail.tmp <script.tmp + cat head.tmp script.tmp tail.tmp >scripts/*${TARGET} + rm *.tmp +fi #clean_configuration