This repository has been archived by the owner on Jan 14, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #518 from rockerbacon/fix-prefix-library-split
Fix installation failure due to incorrect prefix location
- Loading branch information
Showing
4 changed files
with
80 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/usr/bin/env bash | ||
|
||
function log_error() { | ||
echo "ERROR: $@" >&2 | ||
} | ||
|
||
function get_release() { | ||
if [ -z "$(command -v protontricks)" ]; then | ||
if [ -n "$(command -v flatpak)" ]; then | ||
if flatpak info com.github.Matoking.protontricks &> /dev/null; then | ||
echo "flatpak" | ||
return 0 | ||
fi | ||
fi | ||
else | ||
echo "system" | ||
return 0 | ||
fi | ||
|
||
return 1 | ||
} | ||
|
||
function do_protontricks() { | ||
release=$(get_release) | ||
|
||
case "$release" in | ||
flatpak) | ||
WINETRICKS='' \ | ||
flatpak run 'com.github.Matoking.protontricks' "$@" | ||
return $? | ||
;; | ||
system) | ||
protontricks "$@" | ||
return $? | ||
;; | ||
*) | ||
log_error "Protontricks unavailable" | ||
return 1 | ||
;; | ||
esac | ||
} | ||
|
||
function apply() { | ||
appid=$1; shift | ||
do_protontricks "$appid" -q "$@" | ||
return $? | ||
} | ||
|
||
function get_prefix() { | ||
do_protontricks -c 'echo $WINEPREFIX' "$1" | ||
return $? | ||
} | ||
|
||
action=$1 | ||
shift | ||
|
||
case "$action" in | ||
get-prefix) | ||
get_prefix "$1" | ||
;; | ||
get-release) | ||
get_release | ||
;; | ||
apply) | ||
apply "$@" | ||
;; | ||
*) | ||
log_error "invalid action '$action'" | ||
exit 1 | ||
;; | ||
esac | ||
|