git: e2d68479b41b - main - emulators/wine-devel: Add error handling to WoW 32-bit setup

From: Gerald Pfeifer <gerald_at_FreeBSD.org>
Date: Mon, 07 Jul 2025 08:15:05 UTC
The branch main has been updated by gerald:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e2d68479b41bde07d9632498c606417378137a9b

commit e2d68479b41bde07d9632498c606417378137a9b
Author:     Gerald Pfeifer <gerald@FreeBSD.org>
AuthorDate: 2025-07-07 08:14:11 +0000
Commit:     Gerald Pfeifer <gerald@FreeBSD.org>
CommitDate: 2025-07-07 08:14:12 +0000

    emulators/wine-devel: Add error handling to WoW 32-bit setup
    
    Forward port 497de784080c from emulators/wine:
    
    Abstract ABI_FILE and check for its existence before using it.
    
    On the way change formatting to consume less vertical space.
    
    PR:             278525
    Approved by:    maintainer (Thibault Payet <monwarez@mailoo.org>)
---
 emulators/wine-devel/files/pkg32.sh | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/emulators/wine-devel/files/pkg32.sh b/emulators/wine-devel/files/pkg32.sh
index 64d82459c219..04595f6c104c 100644
--- a/emulators/wine-devel/files/pkg32.sh
+++ b/emulators/wine-devel/files/pkg32.sh
@@ -1,19 +1,23 @@
 #!/bin/sh -e
 
-if [ "$(id -u)" = 0 ]
-then
+if [ "$(id -u)" = 0 ]; then
   echo "Don't run this script as root!"
   exit 1
 fi
 
 I386_ROOT="${WINE_i386_ROOT:-$HOME/.i386-wine-pkg}"
+ABI_FILE=/usr/lib32/libc.so.7
 
-if [ ! -d "$I386_ROOT/usr/share/keys/pkg" ]
-then
+if [ ! -f $ABI_FILE ]; then
+  echo "\"$ABI_FILE\" not found; exiting."
+  exit 1
+fi
+
+if [ ! -d "$I386_ROOT/usr/share/keys/pkg" ]; then
   mkdir -p "$I386_ROOT/usr/share/keys"
   ln -s /usr/share/keys/pkg "$I386_ROOT/usr/share/keys/pkg"
 fi
 
 # Show what we're going to do, then do it.
-echo pkg -o ABI_FILE=/usr/lib32/libc.so.7 -o INSTALL_AS_USER=true -o RUN_SCRIPTS=false --rootdir "$I386_ROOT" "$@"
-exec pkg -o ABI_FILE=/usr/lib32/libc.so.7 -o INSTALL_AS_USER=true -o RUN_SCRIPTS=false --rootdir "$I386_ROOT" "$@"
+echo pkg -o ABI_FILE=$ABI_FILE -o INSTALL_AS_USER=true -o RUN_SCRIPTS=false --rootdir "$I386_ROOT" "$@"
+exec pkg -o ABI_FILE=$ABI_FILE -o INSTALL_AS_USER=true -o RUN_SCRIPTS=false --rootdir "$I386_ROOT" "$@"