diff --git a/.github/workflows/appimage-sharun.yml b/.github/workflows/appimage-sharun.yml new file mode 100644 index 0000000..33471ed --- /dev/null +++ b/.github/workflows/appimage-sharun.yml @@ -0,0 +1,57 @@ +name: Build WoeUSB-ng AppImage (EXP) + +on: + workflow_dispatch: + +jobs: + build-appimage: + # run the job inside an Arch Linux container + runs-on: ubuntu-latest + container: + image: archlinux:latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Refresh pacman DB and install build dependencies + run: | + pacman -Syu --noconfirm + pacman -S --noconfirm \ + base-devel \ + python \ + python-build \ + python-pip \ + python-virtualenv \ + python-setuptools \ + python-wheel \ + wget \ + xz \ + patchelf \ + gtk3 \ + libjpeg-turbo \ + libtiff \ + libpng \ + expat \ + curl \ + libx11 \ + libxext \ + libxinerama \ + libxcursor \ + libxrandr \ + libxi \ + fuse2 \ + git + ln -sf /usr/bin/python3 /usr/bin/python + + - name: Make AppImage script executable + run: chmod +x pkg/appimage-sharun.sh + + - name: Build AppImage + run: pkg/appimage-sharun.sh + + - name: Upload AppImage + uses: actions/upload-artifact@v4 + with: + name: woeusb-ng-appimage + path: WoeUSB-ng-build/**/*.AppImage diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml new file mode 100644 index 0000000..49ada7e --- /dev/null +++ b/.github/workflows/appimage.yml @@ -0,0 +1,57 @@ +name: Build WoeUSB-ng AppImage (Arch) + +on: + workflow_dispatch: + +jobs: + build-appimage: + # run the job inside an Arch Linux container + runs-on: ubuntu-latest + container: + image: archlinux:latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Refresh pacman DB and install build dependencies + run: | + pacman -Syu --noconfirm + pacman -S --noconfirm \ + base-devel \ + python \ + python-build \ + python-pip \ + python-virtualenv \ + python-setuptools \ + python-wheel \ + wget \ + xz \ + patchelf \ + gtk3 \ + libjpeg-turbo \ + libtiff \ + libpng \ + expat \ + curl \ + libx11 \ + libxext \ + libxinerama \ + libxcursor \ + libxrandr \ + libxi \ + fuse2 \ + git + ln -sf /usr/bin/python3 /usr/bin/python + + - name: Make AppImage script executable + run: chmod +x pkg/appimage.sh + + - name: Build AppImage + run: pkg/appimage.sh + + - name: Upload AppImage + uses: actions/upload-artifact@v4 + with: + name: woeusb-ng-appimage + path: WoeUSB-ng-build/**/*.AppImage diff --git a/WoeUSB/workaround.py b/WoeUSB/workaround.py index 79dd021..d9b1183 100644 --- a/WoeUSB/workaround.py +++ b/WoeUSB/workaround.py @@ -52,7 +52,7 @@ def support_windows_7_uefi_boot(source_fs_mountpoint, target_fs_mountpoint): :param target_fs_mountpoint: :return: """ - grep = subprocess.run(["grep", "--extended-regexp", "--quiet", "^MinServer=7[0-9]{3}\.[0-9]", + grep = subprocess.run(["grep", "--extended-regexp", "--quiet", r"^MinServer=7[0-9]{3}\.[0-9]", source_fs_mountpoint + "/sources/cversion.ini"], stdout=subprocess.PIPE).stdout.decode("utf-8").strip() if grep == "" and not os.path.isfile(source_fs_mountpoint + "/bootmgr.efi"): diff --git a/miscellaneous/WoeUSB-ng.desktop b/miscellaneous/WoeUSB-ng.desktop index 171698f..311cfb5 100644 --- a/miscellaneous/WoeUSB-ng.desktop +++ b/miscellaneous/WoeUSB-ng.desktop @@ -1,8 +1,10 @@ #!/usr/bin/env xdg-open [Desktop Entry] Name=WoeUSB-ng +Comment=Create your own USB stick windows installer from an ISO image or a real DVD. Exec=woeusbgui -Icon=/usr/share/icons/WoeUSB-ng/icon.ico +Icon=woeusb-logo Terminal=false Type=Application Categories=Utility; +StartupNotify=true diff --git a/miscellaneous/woeusb-logo.png b/miscellaneous/woeusb-logo.png new file mode 100644 index 0000000..f34b716 Binary files /dev/null and b/miscellaneous/woeusb-logo.png differ diff --git a/pkg/appimage-sharun.sh b/pkg/appimage-sharun.sh new file mode 100644 index 0000000..4de4569 --- /dev/null +++ b/pkg/appimage-sharun.sh @@ -0,0 +1,100 @@ +#!/bin/bash +set -e + +# --- Paths --- +ROOT=$(pwd) +BUILD="$ROOT/WoeUSB-ng-build" +APPDIR="$BUILD/AppDir" +SRC="$BUILD/WoeUSB-ng" + +echo "Root: $ROOT" +echo "Build dir: $BUILD" +echo "AppDir: $APPDIR" +echo "Source dir: $SRC" + +# --- Clean previous build --- +rm -rf "$BUILD" +mkdir -p "$APPDIR/usr/bin" +mkdir -p "$APPDIR/usr/lib" + +# --- Step 1: Clone repository and apply patch --- +git clone https://github.com/Twig6943/WoeUSB-ng.git "$SRC" +cd "$SRC" +wget -O "pr79.patch" "https://gitlab.com/chaotic-aur/pkgbuilds/-/raw/main/woeusb-ng/pr79.patch" +patch --forward --strip=1 < pr79.patch || true + +# --- Step 2: Detect Python version --- +PYVER=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')") +echo "Using Python version $PYVER" + +# --- Step 2b: Create virtual environment for dependencies --- +python3 -m venv .venv +source .venv/bin/activate +pip install --upgrade pip + +# Install all Python dependencies +pip install \ + wxPython==4.2.3 \ + installer \ + setuptools \ + wheel \ + build \ + termcolor + +# --- Step 3: Install all Python packages into AppDir --- +mkdir -p "$APPDIR/usr/lib/python${PYVER}/site-packages" +VENV_LIB=".venv/lib/python${PYVER}/site-packages" +cp -r $VENV_LIB/* "$APPDIR/usr/lib/python${PYVER}/site-packages/" + +# --- Step 4: Copy WoeUSB source code --- +if [ ! -d "$SRC/src/WoeUSB" ]; then + echo "Error: WoeUSB source folder not found at $SRC/src/WoeUSB" + exit 1 +fi +cp -r "$SRC/src/WoeUSB" "$APPDIR/usr/lib/python${PYVER}/site-packages/" +touch "$APPDIR/usr/lib/python${PYVER}/site-packages/WoeUSB/__init__.py" + +# --- Step 5: Create woeusbgui launcher --- +mkdir -p "$APPDIR/usr/bin" +cat > "$APPDIR/usr/bin/woeusbgui" << 'EOF' +#!/bin/bash +PYVER=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')") +export PYTHONPATH="$(dirname "$(dirname "$(readlink -f "${0}")")")/lib/python${PYVER}/site-packages:$PYTHONPATH" +exec python3 -m WoeUSB.gui "$@" +EOF +chmod +x "$APPDIR/usr/bin/woeusbgui" + +# --- Step 6: Copy desktop, logo, polkit --- +mkdir -p "$APPDIR/usr/share/applications" +cp "$SRC/miscellaneous/WoeUSB-ng.desktop" "$APPDIR/" +cp "$SRC/miscellaneous/WoeUSB-ng.desktop" "$APPDIR/usr/share/applications/" +chmod 644 "$APPDIR/WoeUSB-ng.desktop" "$APPDIR/usr/share/applications/WoeUSB-ng.desktop" + +cp "$SRC/miscellaneous/woeusb-logo.png" "$APPDIR/" +mkdir -p "$APPDIR/usr/share/polkit-1/actions" +cp "$SRC/miscellaneous/com.github.woeusb.woeusb-ng.policy" "$APPDIR/usr/share/polkit-1/actions/" + +# --- Step 7: Create AppRun --- +cat > "$APPDIR/AppRun" << 'EOF' +#!/bin/bash +HERE="$(dirname "$(readlink -f "${0}")")" +PYVER=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")') +export PYTHONPATH="$HERE/usr/lib/python${PYVER}/site-packages:$PYTHONPATH" +exec python3 "$HERE/usr/bin/woeusbgui" "$@" +EOF +chmod +x "$APPDIR/AppRun" + +# --- Step 8: Debug: list AppDir contents --- +echo "Contents of AppDir before building:" +ls -R "$APPDIR" + +# --- Step 9: Download AppImageTool --- +cd "$BUILD" +wget -O "appimagetool-x86_64.AppImage" \ +"https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" +chmod +x "appimagetool-x86_64.AppImage" + +# --- Step 10: Build AppImage in non-FUSE mode --- +./appimagetool-x86_64.AppImage "$APPDIR" "WoeUSB-ng-x86_64.AppImage" --no-appstream + +echo "✅ AppImage built successfully: $BUILD/WoeUSB-ng-x86_64.AppImage" diff --git a/pkg/appimage.sh b/pkg/appimage.sh new file mode 100644 index 0000000..6c2c6dc --- /dev/null +++ b/pkg/appimage.sh @@ -0,0 +1,81 @@ +#!/bin/bash +set -e + +# Remove any previous build +rm -rf "./WoeUSB-ng-build" +mkdir -p "./WoeUSB-ng-build/AppDir/usr" + +# Step 1: Clone repository and apply patch +cd "./WoeUSB-ng-build" +git clone https://github.com/Twig6943/WoeUSB-ng.git +cd "WoeUSB-ng" +wget -O "pr79.patch" "https://gitlab.com/chaotic-aur/pkgbuilds/-/raw/main/woeusb-ng/pr79.patch" +patch --forward --strip=1 < pr79.patch || true + +# Step 2: Create a virtual environment for build tools +python3 -m venv .venv +source .venv/bin/activate +pip install --upgrade pip + +# Install installer before using it +pip install installer + +# Step 4: Install wxPython manually into AppDir/usr +wget -O "wxpython-4.2.3-cp312-cp312-linux_x86_64.whl" \ +"https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-24.04/wxpython-4.2.3-cp312-cp312-linux_x86_64.whl" +python3 -m installer --prefix="../AppDir/usr" "wxpython-4.2.3-cp312-cp312-linux_x86_64.whl" + +# Install remaining Python build tools +pip install setuptools wheel build termcolor + +#wxpython + +# Step 3: Build wheel and install into AppDir/usr +python3 -m build --wheel --no-isolation +python3 -m installer --prefix="../AppDir/usr" dist/*.whl + +# Step 3b: Copy data and locale directories manually +mkdir -p ../AppDir/usr/lib/python3.12/site-packages/WoeUSB +cp -r src/WoeUSB/data ../AppDir/usr/lib/python3.12/site-packages/WoeUSB/ +cp -r src/WoeUSB/locale ../AppDir/usr/lib/python3.12/site-packages/WoeUSB/ + +# Done with build tools, deactivate venv +deactivate + +# Step 5: Copy desktop file (ensure valid location for AppImage) +if [ ! -f "miscellaneous/WoeUSB-ng.desktop" ]; then + echo "Error: Desktop file missing at miscellaneous/WoeUSB-ng.desktop" + exit 1 +fi +mkdir -p "../AppDir/usr/share/applications" +cp "miscellaneous/WoeUSB-ng.desktop" "../AppDir/" +cp "miscellaneous/WoeUSB-ng.desktop" "../AppDir/usr/share/applications/" +chmod 644 "../AppDir/WoeUSB-ng.desktop" +chmod 644 "../AppDir/usr/share/applications/WoeUSB-ng.desktop" + +# Step 6: Copy logo +if [ ! -f "miscellaneous/woeusb-logo.png" ]; then + echo "Error: logo missing at miscellaneous/woeusb-logo.png" + exit 1 +fi +cp "miscellaneous/woeusb-logo.png" "../AppDir/" + +# Step 7: Copy polkit policy +mkdir -p "../AppDir/usr/share/polkit-1/actions" +cp "miscellaneous/com.github.woeusb.woeusb-ng.policy" "../AppDir/usr/share/polkit-1/actions/" + +# Step 8: Create AppRun launcher +cat > "../AppDir/AppRun" << 'EOF' +#!/bin/bash +HERE="$(dirname "$(readlink -f "${0}")")" +export PYTHONPATH="$HERE/usr/lib/python3.12/site-packages:$PYTHONPATH" +exec python3 "$HERE/usr/bin/woeusbgui" "$@" +EOF +chmod +x "../AppDir/AppRun" + +# Step 9: Download AppImageTool and build AppImage +cd .. +wget -O "appimagetool-x86_64.AppImage" \ +"https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" +chmod +x "appimagetool-x86_64.AppImage" +APPIMAGE_EXTRACT_AND_RUN=1 ./appimagetool-x86_64.AppImage "AppDir" "WoeUSB-ng-x86_64.AppImage"