vp-build/common/xbps-src/shutils/update_hash_cache.sh
Juan RP bcdacb66a0 xbps-src: replace basename(1) with ${var##*/}.
Reduce number of fork+exec due to using a subshell to execute basename(1).
2015-09-11 07:55:40 +02:00

13 lines
393 B
Bash

# vim: set ts=4 sw=4 et:
update_hash_cache() {
local cache="$XBPS_SRCDISTDIR/by_sha256"
local distfile curfile
mkdir -p "$cache"
find "$XBPS_SRCDISTDIR" -type f | grep -v by_sha256 | while read -r distfile; do
cksum=$(cat "$distfile" | sha256sum | cut -d " " -f 1)
curfile="${distfile##*/}"
ln -vf "$distfile" "${cache}/${cksum}_${curfile}"
done
}