changeset 257:699a20c57dc8

scripts: Bourne shell compatibility
author Paper <paper@paper.us.eu.org>
date Sun, 18 Feb 2024 16:02:14 -0500
parents 6f3d193cb4b7
children 862d0d8619f6
files scripts/win32/deploy_build.sh
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/win32/deploy_build.sh	Wed Feb 07 17:06:31 2024 -0500
+++ b/scripts/win32/deploy_build.sh	Sun Feb 18 16:02:14 2024 -0500
@@ -10,11 +10,16 @@
 GetNeededLibraries() {
 	# do not run this on untrusted executables.
 	# see: ldd(1)
+	system="$(echo "$MSYSTEM" | tr "[:upper:]" "[:lower:]")"
 	ldd "$1" | while IFS="" read -r dependency; do
-		lib="$(cut -d' ' -f3 <<< $dependency)"
-		if [[ "$lib" == /"${MSYSTEM,,}"/* ]]; then
-			echo "$lib"
-		fi
+		lib="$(printf -- "$dependency" | cut -d' ' -f3)"
+		case $lib in
+			"/$system/"*)
+				printf -- "$lib\n"
+				;;
+			*)
+				;;
+		esac
 	done
 }