git: 0ce96f7c97a1 - main - emulators/wine-proton: Adjust pkg32.sh to pkg 1.17.3

From: Gerald Pfeifer <gerald_at_FreeBSD.org>
Date: Tue, 26 Oct 2021 20:49:33 UTC
The branch main has been updated by gerald:

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

commit 0ce96f7c97a168d3b01e4f46296a410761f5c302
Author:     Alex S <iwtcex@gmail.com>
AuthorDate: 2021-10-26 20:48:48 +0000
Commit:     Gerald Pfeifer <gerald@FreeBSD.org>
CommitDate: 2021-10-26 20:48:48 +0000

    emulators/wine-proton: Adjust pkg32.sh to pkg 1.17.3
    
    After recent changes, given an uninitialized root dir pkg now fails
    with:
    
      pkg: Error opening the trusted directory /usr/share/keys/pkg/trusted
      pkg: Error loading trusted certificates
    
    This works around it for our WoW setup.
    
    PR:             259404
    Approved:       maintainer (= author)
---
 emulators/wine-proton/files/pkg32.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/emulators/wine-proton/files/pkg32.sh b/emulators/wine-proton/files/pkg32.sh
index 7aebca5b7cd1..6e87ee27add3 100644
--- a/emulators/wine-proton/files/pkg32.sh
+++ b/emulators/wine-proton/files/pkg32.sh
@@ -1,4 +1,5 @@
 #!/bin/sh -e
+
 if [ "$(id -u)" = 0 ]
 then
   echo "Don't run this script as root!"
@@ -7,7 +8,12 @@ fi
 
 I386_ROOT="${WINE_i386_ROOT:-$HOME/.i386-wine-pkg}"
 
-mkdir -p "$I386_ROOT"
+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
+
 ABI=$(pkg config ABI | sed s/amd64/i386/)
 echo pkg -o ABI="$ABI" -o INSTALL_AS_USER=true -o RUN_SCRIPTS=false --rootdir "$I386_ROOT" "$@"
 exec pkg -o ABI="$ABI" -o INSTALL_AS_USER=true -o RUN_SCRIPTS=false --rootdir "$I386_ROOT" "$@"