Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Hangover #2670

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/Hangover/credits
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@AndreRH
14 changes: 14 additions & 0 deletions apps/Hangover/description
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Hangover runs simple Win64 and Win32 applications on arm64 Linux. Only the application is emulated instead of a whole Wine installation.

Hangover can be used in place of the Wine app on Pi-Apps. It may be worth trying this to see if something that did not run on the emulated Wine will run here.
For example, one app (tested by Botspot) failed to launch the installer on emulated Wine (x64), got stuck installing on Hangover with the Box64 emulator, and successfully installed with the FEX emulator selected. (see how to select an emulator below)

If you have Wine installed already, clicking Install here will uninstall Wine first. Do note that installed applications and configuration left over from Wine in ~/.wine will need to be removed or renamed, as it appears Hangover cannot import it.

Examples on how to run:
$ wine your_x86_64_application.exe # Uses FEX for 64-bit apps
$ wine your_x86_application.exe # To use Box64 for 32-bit apps
$ HODLL=libwow64fex.dll wine your_x86_application.exe # To use FEX for 32-bit apps
$ HODLL=xtajit.dll taskset -c 1 wine your_x86_application.exe # To use QEMU for 32-bit apps (limited to 1 core to workaround a bug)

For more information see https://github.com/AndreRH/hangover/blob/master/README.md
Binary file added apps/Hangover/icon-24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/Hangover/icon-64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
148 changes: 148 additions & 0 deletions apps/Hangover/install-64
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
#!/bin/bash

version=9.22

# https://github.com/raspberrypi/bookworm-feedback/issues/107
PAGE_SIZE="$(getconf PAGE_SIZE)"
if [[ "$PAGE_SIZE" == "16384" ]]; then
#switch to 4K pagesize kernel
if [ -f /boot/config.txt ] || [ -f /boot/firmware/config.txt ]; then
if [ -f /boot/firmware/config.txt ]; then
boot_config="/boot/firmware/config.txt"
elif [ -f /boot/config.txt ]; then
boot_config="/boot/config.txt"
fi
text="Raspberry Pi 5 PiOS images ship by default with a 16K PageSize Linux Kernel.
This kernel causes incompatibilities with some software including Wine https://github.com/raspberrypi/bookworm-feedback/issues/107

Would you like to automatically switch to a 4K PageSize Linux Kernel?"
userinput_func "$text" "No, keep 16K PageSize Kernel and Exit" "Yes, switch to 4K PageSize Kernel"
if [ "$output" == "No, keep 16K PageSize Kernel and Exit" ]; then
error "User error: Your current running kernel is built with 16K PageSize and is incompatible with Wine (x64) with Box64. You must switch to a 4K PageSize kernel (and chose to not do so automatically) before installing Wine (x64)."
fi
echo "" | sudo tee --append $boot_config >/dev/null
echo "[pi5]" | sudo tee --append $boot_config >/dev/null
echo "kernel=kernel8.img" | sudo tee --append $boot_config >/dev/null
echo -e "The 4K PageSize Kernel has been enabled by adding 'kernel=kernel8.img' to $boot_config\nPlease reboot now and install the Wine (x64) app again."
sleep infinity
else
error "User error (reporting allowed): Your current running kernel is built with 16K PageSize and is incompatible with Wine (x64) with Box64. Changing kernels automatically cannot be done since no /boot/config.txt or /boot/firmware/config.txt file was found."
fi
fi

# Hangover conflicts with Wine
"${DIRECTORY}/manage" uninstall "Wine (x64)"

if [ "$__os_codename" == "bullseye" ]; then
ho_distro="debian11"
elif [ "$__os_codename" == "bookworm" ]; then
ho_distro="debian12"
elif [ "$__os_codename" == "focal" ]; then
ho_distro="ubuntu2004"
elif [ "$__os_codename" == "jammy" ]; then
ho_distro="ubuntu2204"
elif [ "$__os_codename" == "noble" ]; then
ho_distro="ubuntu2404"
else
error "User error: You are not using a supported Pi-Apps distribution."
fi

cd /tmp || error "Could not move to /tmp folder"
wget https://github.com/AndreRH/hangover/releases/download/hangover-${version}/hangover_${version}_${ho_distro}_${__os_codename}_arm64.tar || error "Failed to download Hangover!"
tar -xf hangover_${version}_${ho_distro}_${__os_codename}_arm64.tar || error "Failed to extract Hangover!"
rm -f hangover_${version}_${ho_distro}_${__os_codename}_arm64.tar
install_packages /tmp/hangover-libarm64ecfex_${version}_arm64.deb /tmp/hangover-libqemu_${version}~${__os_codename}_arm64.deb /tmp/hangover-libwow64fex_${version}_arm64.deb /tmp/hangover-wine_${version}~${__os_codename}_arm64.deb || exit 1
rm -f ./hangover-libarm64ecfex_${version}_arm64.deb ./hangover-libqemu_${version}~${__os_codename}_arm64.deb ./hangover-libwow64fex_${version}_arm64.deb ./hangover-wine_${version}~${__os_codename}_arm64.deb
AndreRH marked this conversation as resolved.
Show resolved Hide resolved

cat << EOF | sudo tee /usr/local/bin/generate-hangover-prefix >/dev/null
#!/bin/bash
echo

#set up functions
$(declare -f error)
$(declare -f status)
$(declare -f status_green)
$(declare -f warning)
$(declare -f userinput_func)

if [ "\$(id -u)" == 0 ];then
error "Please don't run this script with sudo."
fi

if [ -z "\$WINEPREFIX" ];then
WINEPREFIX="\$HOME/.wine"
fi
export WINEPREFIX

if [ -f "\$WINEPREFIX/system.reg" ];then
registry_exists=true
else
registry_exists=false
fi

export WINEDEBUG=-virtual #hide harmless memory errors

if [ -e "\$WINEPREFIX" ];then
status "Checking Wine prefix at \$WINEPREFIX..."
echo "To choose another prefix, set the WINEPREFIX variable."
echo -n "Waiting 5 seconds... "
sleep 5
echo
# 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
text="Your previously existing Wine prefix failed with an error (see terminal log).

Would you like to remove and regenerate your Wine prefix? Doing so will delete anything 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 "\$WINEPREFIX"
registry_exists=false
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

if [ "\$registry_exists" == false ];then
status "Making registry changes..."
TMPFILE="\$(mktemp)" || exit 1
echo 'REGEDIT4' > \$TMPFILE

echo " - Disabling Wine mime associations" #see https://askubuntu.com/a/400430

echo '
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunServices]
"winemenubuilder"="C:\\\\windows\\\\system32\\\\winemenubuilder.exe -r"

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices]
"winemenubuilder"="C:\\\\windows\\\\system32\\\\winemenubuilder.exe -r"' >> \$TMPFILE

wine regedit \$TMPFILE

rm -f \$TMPFILE
fi #end of if statement that only runs if this script was started when there was no wine registry
true
EOF

sudo chmod +x /usr/local/bin/generate-hangover-prefix
/usr/local/bin/generate-hangover-prefix || exit 1
24 changes: 24 additions & 0 deletions apps/Hangover/uninstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

pkill -9 wine
command -v wineserver >/dev/null && wineserver -k

status -n "Removing terminal commands... "
sudo rm -rf /usr/local/bin/generate-hangover-prefix
status_green "Done"

status -n "Removing mimetypes... "
#See: https://askubuntu.com/a/400430
rm -f ~/.local/share/mime/packages/x-wine*
rm -f ~/.local/share/applications/wine-extension*
rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*
rm -f ~/.local/share/mime/application/x-wine-extension*
status_green "Done"

purge_packages || exit 1

if [ -e "$HOME/.wine" ];then
echo -e "\n\n\e[93mYou just uninstalled the Hangover app, but it's not completely gone yet.
To prevent data loss, your Wine configuration is still\nlocated in the $HOME/.wine folder. Feel free to delete it to save space or to rename the folder for troubleshooting.\e[39m\n"
fi
true
1 change: 1 addition & 0 deletions apps/Hangover/website
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://github.com/AndreRH/hangover
3 changes: 3 additions & 0 deletions apps/Wine (x64)/install-64
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ Would you like to automatically switch to a 4K PageSize Linux Kernel?"
fi
fi

# Wine conflicts with Hangover
"${DIRECTORY}/manage" uninstall Hangover

# Get dependencies
install_packages cabextract p7zip-full || exit 1

Expand Down
1 change: 1 addition & 0 deletions etc/categories
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Gnumeric|Office
Godot|Games
GParted|System Management
Guake Terminal|Terminals
Hangover|Tools/Emulation
Heroes 2|Games
Https File Server|Tools
HTTrack Website Copier|Internet
Expand Down
1 change: 1 addition & 0 deletions etc/category-overrides-jetson-18.04
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Flow|hidden
FreeTube|hidden
Gnome Software|Tools
Godot|hidden
Hangover|hidden
Kodi|hidden
LibreWolf|hidden
Lightpad|hidden
Expand Down
1 change: 1 addition & 0 deletions etc/category-overrides-jetson-generic
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Flow|hidden
FreeTube|hidden
Gnome Software|Tools
Godot|hidden
Hangover|hidden
Kodi|hidden
Lightpad|hidden
Minecraft Pi (Modded)|hidden
Expand Down
Loading