From b0bbde50af5aba136af13bb0f5e3869e101914df Mon Sep 17 00:00:00 2001
From: Simone Rota <sip@crux.nu>
Date: Sat, 29 Apr 2006 10:01:53 +0200
Subject: [PATCH] pkgmk: optimize file detection for stripping. Thanks to aon
 and mark

---
 ChangeLog |  3 +++
 pkgmk.in  | 11 +++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 47361a8..4e7f542 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2006-04-29 Simone Rota (sip at crux dot nu)
+        * Optimized file type detection for stripping in pkgmk
+          Thanks to Antti Nykänen
 2006-04-14 Tilman Sauerbeck (tilman at crux nu)
         * ChangeLog, NEWS: Moved old ChangeLog to NEWS
         * pkgmk.in: Write warnings and errors to stderr instead of stdout
diff --git a/pkgmk.in b/pkgmk.in
index 51fd8f6..bfa1701 100755
--- a/pkgmk.in
+++ b/pkgmk.in
@@ -242,13 +242,16 @@ strip_files() {
 	fi
 
 	find . -type f -printf "%P\n" | $FILTER | while read FILE; do
-		if file -b "$FILE" | grep '^.*ELF.*executable.*not stripped$' &> /dev/null; then
+		case $(file -b "$FILE") in
+		*ELF*executable*not\ stripped)
 			strip --strip-all "$FILE"
-		elif file -b "$FILE" | grep '^.*ELF.*shared object.*not stripped$' &> /dev/null; then
+			;;
+		*ELF*shared\ object*not\ stripped)
 			strip --strip-unneeded "$FILE"
-		elif file -b "$FILE" | grep '^current ar archive$' &> /dev/null; then
+			;;
+		current\ ar\ archive)
 			strip --strip-debug "$FILE"
-		fi
+		esac
 	done
 }
 
-- 
2.45.2