diff --git a/apps/Hangover/credits b/apps/Hangover/credits new file mode 100644 index 0000000000..2b00e6f76e --- /dev/null +++ b/apps/Hangover/credits @@ -0,0 +1 @@ +@AndreRH diff --git a/apps/Hangover/description b/apps/Hangover/description new file mode 100644 index 0000000000..a787d63eda --- /dev/null +++ b/apps/Hangover/description @@ -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 diff --git a/apps/Hangover/icon-24.png b/apps/Hangover/icon-24.png new file mode 100644 index 0000000000..144a830817 Binary files /dev/null and b/apps/Hangover/icon-24.png differ diff --git a/apps/Hangover/icon-64.png b/apps/Hangover/icon-64.png new file mode 100644 index 0000000000..791570564a Binary files /dev/null and b/apps/Hangover/icon-64.png differ diff --git a/apps/Hangover/install-64 b/apps/Hangover/install-64 new file mode 100755 index 0000000000..67ea7931c2 --- /dev/null +++ b/apps/Hangover/install-64 @@ -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 + +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 diff --git a/apps/Hangover/uninstall b/apps/Hangover/uninstall new file mode 100755 index 0000000000..0dc9d98cec --- /dev/null +++ b/apps/Hangover/uninstall @@ -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 diff --git a/apps/Hangover/website b/apps/Hangover/website new file mode 100644 index 0000000000..5498f52817 --- /dev/null +++ b/apps/Hangover/website @@ -0,0 +1 @@ +https://github.com/AndreRH/hangover diff --git a/apps/Wine (x64)/install-64 b/apps/Wine (x64)/install-64 index b0f1d72b77..7ece93fe52 100755 --- a/apps/Wine (x64)/install-64 +++ b/apps/Wine (x64)/install-64 @@ -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 diff --git a/etc/categories b/etc/categories index 4b584ffe32..95c32c1176 100644 --- a/etc/categories +++ b/etc/categories @@ -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 diff --git a/etc/category-overrides-jetson-18.04 b/etc/category-overrides-jetson-18.04 index ffeb8458c5..12e5a0a1a4 100644 --- a/etc/category-overrides-jetson-18.04 +++ b/etc/category-overrides-jetson-18.04 @@ -20,6 +20,7 @@ Flow|hidden FreeTube|hidden Gnome Software|Tools Godot|hidden +Hangover|hidden Kodi|hidden LibreWolf|hidden Lightpad|hidden diff --git a/etc/category-overrides-jetson-generic b/etc/category-overrides-jetson-generic index 2b0d9a2d22..7cc6016de5 100644 --- a/etc/category-overrides-jetson-generic +++ b/etc/category-overrides-jetson-generic @@ -9,6 +9,7 @@ Flow|hidden FreeTube|hidden Gnome Software|Tools Godot|hidden +Hangover|hidden Kodi|hidden Lightpad|hidden Minecraft Pi (Modded)|hidden