commit: e45e4d50192591385607e892caba9542ea07127e
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 17 14:26:47 2019 +0000
Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Wed Jul 17 14:26:47 2019 +0000
URL: https://gitweb.gentoo.org/proj/qa-scripts.git/commit/?id=e45e4d50
find-binary-files.sh: Output explicit message if no files were found.
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
find-binary-files.sh | 14 ++++++++------
1 file 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. :-)"