From ecaeb5674aad4bbd1b8639802c5d210be4768472 Mon Sep 17 00:00:00 2001 From: Matthias Ruester Date: Wed, 24 Jul 2013 09:35:38 +0200 Subject: [PATCH] bee-cache: implement option print-missing-files --- src/bee-cache.sh.in | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/bee-cache.sh.in b/src/bee-cache.sh.in index f1bf5f1..50deed2 100644 --- a/src/bee-cache.sh.in +++ b/src/bee-cache.sh.in @@ -147,6 +147,23 @@ function print_uniq_files_for_pkg() { | grep -E "^${pkg} " } +function print_missing_files() { + local pkg=$1 + + if [ -z "${pkg}" ] ; then + pkg="*" + fi + + while read line; do + file=$(cut -d ' ' -f 8- <<< ${line}) + + if [ ! -e "${file}" ]; then + echo "${line}" + fi + done < <( tmp_merge_install_inventory_files "${TMPINSTALL[@]}" ) \ + | grep -E "^${pkg} " +} + function tmp_merge_install_inventory_files() { ${BEEFLOCK} --shared ${BEECACHE_INVENTORY} sort -m -u -r -k8 -k1 \ ${BEECACHE_INVENTORY} "${@}" @@ -211,6 +228,7 @@ function usage() { print-uniq-files print-conflicting-files print-conflicts + print-missing-files [pkgname] EOF } @@ -281,6 +299,9 @@ case "${cmd}" in print-conflicts) print_conflicts "${@}" | cut -d ' ' -f${FIELDS} ;; + print-missing-files) + print_missing_files "${@}" | cut -d ' ' -f${FIELDS} + ;; *) echo >&2 "bee-cache: ${cmd}: Unknown command." exit 1