#!/bin/bash set -e echo "Cleaning old AppDir..." rm -rf AppDir MHWildsModManager*.AppImage echo "Creating AppDir structure..." mkdir -p AppDir/usr/bin mkdir -p AppDir/usr/share/mhwmm mkdir -p AppDir/usr/share/applications mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps echo "Copying source files..." cp -r src/mhwmm/* AppDir/usr/share/mhwmm/ cat << 'WRAPPER' > AppDir/usr/bin/mhwmm #!/bin/bash export PYTHONPATH="${APPDIR}/usr/share/mhwmm:${PYTHONPATH}" exec python3 -m mhwmm "$@" WRAPPER chmod +x AppDir/usr/bin/mhwmm echo "Copying desktop and icon..." cp data/ca.schantli.MHWildsModManager.desktop AppDir/usr/share/applications/ cp data/ca.schantli.MHWildsModManager.png AppDir/usr/share/icons/hicolor/256x256/apps/ cp data/ca.schantli.MHWildsModManager.png AppDir/ca.schantli.MHWildsModManager.png python3 -c " with open('AppDir/usr/share/applications/ca.schantli.MHWildsModManager.desktop', 'r') as df: d = df.read() d = d.replace('Exec=bin/mhwmm', 'Exec=python3') with open('AppDir/usr/share/applications/ca.schantli.MHWildsModManager.desktop', 'w') as df: df.write(d) " echo "Building AppImage using Podman (ubuntu:24.04)..." podman run --rm -i --privileged -v $(pwd):/workspace -w /workspace ubuntu:24.04 bash -c "apt-get update && apt-get install -y wget file squashfs-tools binutils gnupg2 gtk-update-icon-cache && wget -q -O /tmp/appimage-builder https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage && chmod +x /tmp/appimage-builder && cd /tmp && ./appimage-builder --appimage-extract && cd /workspace && /tmp/squashfs-root/AppRun --recipe AppImageBuilder.yml --skip-test" echo "Done! AppImage is ready."