Skip to content

Commit

Permalink
Wine (x86/x64): ask for user input before prefix removal on wineboot …
Browse files Browse the repository at this point in the history
…failure

closes #2512
  • Loading branch information
theofficialgman committed Jan 5, 2024
1 parent 6fe747c commit b970929
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
13 changes: 11 additions & 2 deletions apps/Wine (x64)/install-64
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ echo
$(declare -f error)
$(declare -f status)
$(declare -f warning)
$(declare -f userinput_func)
if [ "\$(id -u)" == 0 ];then
error "Please don't run this script with sudo."
Expand All @@ -214,7 +215,14 @@ if [ -e "\$HOME/.wine" ];then
# Boot wine and check for errors (make fresh wineprefix)
output="\$(set -o pipefail; wine wineboot 2>&1 | tee /dev/stderr; )" #this won't display any dialog boxes that require a button to be clicked
if [ "\$?" != 0 ]; then
warning "Your previously existing Wine prefix failed with an error (see above). It has been removed and will be re-generated."
text="Your previously existing Wine prefix failed with an error (see terminal log).
Would you like to remove and regeneral your Wine prefix? Doing so will delete everything you may have installed into your Wine prefix."
userinput_func "\$text" "No, keep broken Wine prefix and Exit" "Yes, delete and regenerate Wine prefix"
if [ "\$output" == "No, keep broken Wine prefix and Exit" ]; then
error "User error: Your current Wine prefix caused Wine to error on launch and you chose to keep it. Manually correct your Wine prefix before installing or updating Wine (x64)."
fi
warning "Your previously existing Wine prefix failed with an error (see above). You chose to remove it and so it will be re-generated."
rm -rf "\$HOME/.wine"
wine wineboot #this won't display any dialog boxes that require a button to be clicked
fi
Expand Down Expand Up @@ -430,9 +438,10 @@ sleep 2
while [ ! -z "\$(pgrep -i 'wine C:')" ];do
sleep 1
done
true
EOF

sudo chmod +x /usr/local/bin/generate-wine-prefix
/usr/local/bin/generate-wine-prefix
/usr/local/bin/generate-wine-prefix || exit 1

exit 0
13 changes: 11 additions & 2 deletions apps/Wine (x86)/install-32
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ echo
$(declare -f error)
$(declare -f status)
$(declare -f warning)
$(declare -f userinput_func)
if [ "\$(id -u)" == 0 ];then
error "Please don't run this script with sudo."
Expand All @@ -333,7 +334,14 @@ if [ -e "\$HOME/.wine" ];then
# Boot wine and check for errors (make fresh wineprefix)
output="\$(set -o pipefail; wine wineboot 2>&1 | tee /dev/stderr; )" #this won't display any dialog boxes that require a button to be clicked
if [ "\$?" != 0 ]; then
warning "Your previously existing Wine prefix failed with an error (see above). It has been removed and will be re-generated."
text="Your previously existing Wine prefix failed with an error (see terminal log).
Would you like to remove and regeneral your Wine prefix? Doing so will delete everything you may have installed into your Wine prefix."
userinput_func "\$text" "No, keep broken Wine prefix and Exit" "Yes, delete and regenerate Wine prefix"
if [ "\$output" == "No, keep broken Wine prefix and Exit" ]; then
error "User error: Your current Wine prefix caused Wine to error on launch and you chose to keep it. Manually correct your Wine prefix before installing or updating Wine (x86)."
fi
warning "Your previously existing Wine prefix failed with an error (see above). You chose to remove it and so it will be re-generated."
rm -rf "\$HOME/.wine"
wine wineboot #this won't display any dialog boxes that require a button to be clicked
fi
Expand Down Expand Up @@ -551,10 +559,11 @@ sleep 2
while [ ! -z "\$(pgrep -i 'wine C:')" ];do
sleep 1
done
true
EOF

sudo chmod +x /usr/local/bin/generate-wine-prefix
/usr/local/bin/generate-wine-prefix
/usr/local/bin/generate-wine-prefix || exit 1

exit 0

0 comments on commit b970929

Please sign in to comment.