Ignore:
Timestamp:
03/23/2023 05:38:51 PM (19 months ago)
Author:
Pierre Labastie <pierre.labastie@…>
Branches:
ablfs-more, trunk
Children:
4dfe8f9
Parents:
42dfc6e
Message:

Implementation of dependency checking 4

Implement generation of a modified script if dependency checking is
requested.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BLFS/gen_pkg_book.sh

    r42dfc6e r1bf09c1  
    298298echo -e "done\n"
    299299
     300if [ -n "$DEP_CHECK" ]; then
     301   if (( ${#TARGET[*]} != 1 )); then
     302      printf "\nWARNING: If dependencies are checked, only one package\n"
     303      printf "         shoud be selected. Not generating check code.\n"
     304      exit
     305   fi
     306
     307   LIST_LFS="$(xsltproc $ListLFS $LFS_FULL)"
     308   LIST_NEEDED="$(echo $FULL_LIST)"
     309   LIST_INSTALLED="$(porg -a | sed 's/-[[:digit:]].*//')"
     310   LIST_UNNEEDED=
     311   for p in $LIST_INSTALLED; do
     312      case " $LIST_LFS " in *" $p "*)  continue ;; esac
     313      case " $LIST_NEEDED " in *" $p "*)  continue ;; esac
     314      LIST_UNNEEDED="$LIST_UNNEEDED $p"
     315   done
     316   cat >head.tmp <<EOF
     317#!/bin/bash
     318set -e
     319
     320# Remove all unneeded packages
     321VERSIONED_LIST=
     322for p in $LIST_UNNEEDED; do
     323   VERSIONED_LIST="\$VERSIONED_LIST \$(porg \$p)"
     324   porg -rb \$p
     325done
     326
     327# Function to restore packages
     328restore_pack {
     329for p in \$VERSIONED_LIST; do
     330   porgball -e -l /var/lib/packages/\${p}.porg.tar.gz
     331done
     332}
     333
     334trap restore_pack ERR
     335
     336EOF
     337   cat >tail.tmp <<EOF
     338restore_pack
     339exit
     340EOF
     341
     342   sed -e "1,2d" -e '$d' scripts/*${TARGET} >script.tmp
     343   cat head.tmp script.tmp tail.tmp >scripts/*${TARGET}
     344   rm *.tmp
     345fi
    300346#clean_configuration
Note: See TracChangeset for help on using the changeset viewer.