wrap-wine.sh raw

   1  #!/usr/bin/env bash
   2  #
   3  # Copyright (c) 2020-2022 The Limenka developers
   4  # Distributed under the MIT software license, see the accompanying
   5  # file COPYING or http://www.opensource.org/licenses/mit-license.php.
   6  
   7  export LC_ALL=C.UTF-8
   8  
   9  for b_name in {"${BASE_OUTDIR}/bin"/*,src/univalue/{test_json,unitester,object}}.exe; do
  10      # shellcheck disable=SC2044
  11      for b in $(find "${BASE_ROOT_DIR}" -executable -type f -name "$(basename "$b_name")"); do
  12        if (file "$b" | grep "Windows"); then
  13          echo "Wrap $b ..."
  14          mv "$b" "${b}_orig"
  15          echo '#!/usr/bin/env bash' > "$b"
  16          echo "( wine \"${b}_orig\" \"\$@\" ) || ( sleep 1 && wine \"${b}_orig\" \"\$@\" )" >> "$b"
  17          chmod +x "$b"
  18        fi
  19      done
  20  done
  21