Skip to content

Commit

Permalink
Wine (x86/x64): remove and re-generate broken prefixes
Browse files Browse the repository at this point in the history
Wine will return errors such as
`wine: '/home/pi/.wine' is a 32-bit installation, it cannot support 64-bit applications.`
if the currently configured wine prefix can not be used due to the user previously installing a win32 prefix and now attempting to run a win64 prefix. the old prefix must be fully removed to correct this so warn the user that this is the case and remove and re-generate the prefix. See https://github.com/wine-mirror/wine/blob/884cff821481b4819f9bdba455217bd5a3f97744/dlls/ntdll/unix/server.c#L1544-L1670
  • Loading branch information
theofficialgman committed Jul 3, 2023
1 parent b859b99 commit 0f5b8cc
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 28 deletions.
41 changes: 28 additions & 13 deletions apps/Wine (x64)/install-64
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ echo
#set up functions
$(declare -f error)
$(declare -f status)
$(declare -f warning)
if [ "\$(id -u)" == 0 ];then
error "Please don't run this script with sudo."
Expand All @@ -178,25 +179,39 @@ if [ -z "\$WINEPREFIX" ];then
WINEPREFIX="\$HOME/.wine"
fi
export WINEPREFIX
export BOX64_NOBANNER=1 #hide box64 output (for cosmetics)
if [ -e "\$HOME/.wine" ];then
status "Checking Wine prefix at \$WINEPREFIX..."
echo "To choose another prefix, set the WINEPREFIX variable."
echo "Waiting 5 seconds..."
sleep 5
# check for existance of incompatible prefix (see server_init_process https://github.com/wine-mirror/wine/blob/884cff821481b4819f9bdba455217bd5a3f97744/dlls/ntdll/unix/server.c#L1544-L1670)
# 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."
rm -rf "\$HOME/.wine"
wine wineboot #this won't display any dialog boxes that require a button to be clicked
fi
#wait until above process exits
sleep 2
while [ ! -z "\$(pgrep -i 'wine C:')" ];do
sleep 1
done
else
status "Generating Wine prefix at \$WINEPREFIX..."
echo "To choose another prefix, set the WINEPREFIX variable."
echo "Waiting 5 seconds..."
sleep 5
# Boot wine (make fresh wineprefix)
wine wineboot #this won't display any dialog boxes that require a button to be clicked
#wait until above process exits
sleep 2
while [ ! -z "\$(pgrep -i 'wine C:')" ];do
sleep 1
done
fi
echo "To choose another prefix, set the WINEPREFIX variable."
echo "Waiting 5 seconds..."
sleep 5
# Boot wine (make fresh wineprefix)
export BOX64_NOBANNER=1 #hide box64 output (for cosmetics)
wine wineboot #this won't display any dialog boxes that require a button to be clicked
#wait until above process exits
sleep 2
while [ ! -z "\$(pgrep -i 'wine C:')" ];do
sleep 1
done
status "Making registry changes..."
TMPFILE="\$(mktemp)" || exit 1
Expand Down
43 changes: 28 additions & 15 deletions apps/Wine (x86)/install-32
Original file line number Diff line number Diff line change
Expand Up @@ -321,27 +321,40 @@ if [ -z "\$WINEPREFIX" ];then
WINEPREFIX="\$HOME/.wine"
fi
export WINEPREFIX
export BOX86_NOBANNER=1 #hide box86 output (for cosmetics)
export WINEARCH=win32 #Make sure Wine creates a 32-bit prefix
if [ -e "\$HOME/.wine" ];then
status "Checking Wine prefix at \$WINEPREFIX..."
echo "To choose another prefix, set the WINEPREFIX variable."
echo "Waiting 5 seconds..."
sleep 5
# check for existance of incompatible prefix (see server_init_process https://github.com/wine-mirror/wine/blob/884cff821481b4819f9bdba455217bd5a3f97744/dlls/ntdll/unix/server.c#L1544-L1670)
# 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."
rm -rf "\$HOME/.wine"
wine wineboot #this won't display any dialog boxes that require a button to be clicked
fi
#wait until above process exits
sleep 2
while [ ! -z "\$(pgrep -i 'wine C:')" ];do
sleep 1
done
else
status "Generating Wine prefix at \$WINEPREFIX..."
echo "To choose another prefix, set the WINEPREFIX variable."
echo "Waiting 5 seconds..."
sleep 5
# Boot wine (make fresh wineprefix)
wine wineboot #this won't display any dialog boxes that require a button to be clicked
#wait until above process exits
sleep 2
while [ ! -z "\$(pgrep -i 'wine C:')" ];do
sleep 1
done
fi
echo "To choose another prefix, set the WINEPREFIX variable."
echo "Waiting 5 seconds..."
sleep 5
# Boot wine (make fresh wineprefix)
export BOX86_NOBANNER=1 #hide box86 output (for cosmetics)
export WINEARCH=win32 #Make sure Wine creates a 32-bit prefix
#export WINEDLLOVERRIDES="mscoree,mshtml=" #Avoid asking user to install gecko or mono
wine wineboot #this won't display any dialog boxes that require a button to be clicked
#wait until above process exits
sleep 2
while [ ! -z "\$(pgrep -i 'wine C:')" ];do
sleep 1
done
status "Making registry changes..."
TMPFILE="\$(mktemp)" || exit 1
Expand Down

0 comments on commit 0f5b8cc

Please sign in to comment.