Skip to content

Commit

Permalink
Merge branch 'ruester/improvements'
Browse files Browse the repository at this point in the history
* ruester/improvements:
  bee-cache: implement option print-missing-files
  beesh: add timeout and try count to wget call
  • Loading branch information
mariux committed Jun 2, 2015
2 parents 046bbee + ecaeb56 commit 929b6e5
Show file tree
Hide file tree
Showing 2 changed files with 23 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
2 changes: 2 additions & 0 deletions src/beesh.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ function fetch_one_file() {
${nocheck} \
--output-document="${F}/${file}" \
--no-clobber \
--timeout=60 \
--tries=1 \
"${url}" || true

trap - EXIT
Expand Down

0 comments on commit 929b6e5

Please sign in to comment.