Skip to content

Commit

Permalink
bee-cache: implement option print-missing-files
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Ruester authored and mariux committed Jun 2, 2015
1 parent b3853c9 commit ecaeb56
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/bee-cache.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -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} "${@}"
Expand Down Expand Up @@ -211,6 +228,7 @@ function usage() {
print-uniq-files <pkgname>
print-conflicting-files <pkgname>
print-conflicts <pkgname>
print-missing-files [pkgname]
EOF
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ecaeb56

Please sign in to comment.