aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2019-07-17 16:26:47 +0200
committerUlrich Müller <ulm@gentoo.org>2019-07-17 16:26:47 +0200
commite45e4d50192591385607e892caba9542ea07127e (patch)
tree25c43b7a968542115d9f1c499a15925c581a4311 /find-binary-files.sh
parentBump pkgcheck2html (diff)
downloadqa-scripts-e45e4d50192591385607e892caba9542ea07127e.tar.gz
qa-scripts-e45e4d50192591385607e892caba9542ea07127e.tar.bz2
qa-scripts-e45e4d50192591385607e892caba9542ea07127e.zip
find-binary-files.sh: Output explicit message if no files were found.
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
Diffstat (limited to 'find-binary-files.sh')
-rwxr-xr-xfind-binary-files.sh14
1 files changed, 8 insertions, 6 deletions
diff --git a/find-binary-files.sh b/find-binary-files.sh
index 2c08ca8..3b62e22 100755
--- a/find-binary-files.sh
+++ b/find-binary-files.sh
@@ -8,10 +8,8 @@ shopt -s extglob
portdir=$(portageq get_repo_path / gentoo)
cd "${portdir}" || exit 1
-find . \( -path ./distfiles -o -path ./local -o -path ./metadata \
- -o -path ./packages \) -prune \
- -o ! -type d ! \( -type f -name 'Manifest*.gz' \) -exec file -ih '{}' + \
-| while read line; do
+count=0
+while read line; do
path=${line%:*}
type=${line##*:*( )}
case ${type} in
@@ -39,7 +37,11 @@ find . \( -path ./distfiles -o -path ./local -o -path ./metadata \
*)
size=$(stat -c "%s" "${path}")
echo "${path#./}: ${type} (size=${size})"
+ (( count++ ))
;;
esac
-done \
-| sort
+done < <(find \( -path ./distfiles -o -path ./local -o -path ./metadata \
+ -o -path ./packages \) -prune -o ! -type d ! -name 'Manifest*.gz' \
+ -exec file -ih '{}' + | sort)
+
+[[ ${count} -gt 0 ]] || echo "No binary files found. :-)"