From 083f2a3f86eb21c8384eabd77a28edc99e6e207d Mon Sep 17 00:00:00 2001 From: Jason Ross Date: Tue, 26 Aug 2025 18:34:16 -0500 Subject: [PATCH] committing working build progress --- .gitignore | 2 + WIKI.md | 2 +- scripts/build_package_linux.sh | 38 ++++++++++++++----- scripts/linux_postinst.sh | 0 .../android-file-handler-linux.spec | 5 ++- 5 files changed, 36 insertions(+), 11 deletions(-) mode change 100644 => 100755 scripts/linux_postinst.sh diff --git a/.gitignore b/.gitignore index 80f6699..84cba60 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ build .actrc bin/ test-act.yml +pkg_dist + # Python cache files __pycache__/ *.py[cod] diff --git a/WIKI.md b/WIKI.md index 1072b13..bb17354 100644 --- a/WIKI.md +++ b/WIKI.md @@ -4,7 +4,7 @@ These instructions describe how Arch users can install the Linux build produced by the project's `simple-release.yml` workflow. The workflow produces an Arch package named similar to: -``` +```bash android-file-handler--1-x86_64.pkg.tar.zst ``` diff --git a/scripts/build_package_linux.sh b/scripts/build_package_linux.sh index 40a5c67..a8bd54c 100755 --- a/scripts/build_package_linux.sh +++ b/scripts/build_package_linux.sh @@ -28,7 +28,21 @@ mkdir -p "$PKG_DIR/usr/local/bin" \ cp dist/android-file-handler "$PKG_DIR/usr/local/bin/android-file-handler" chmod 0755 "$PKG_DIR/usr/local/bin/android-file-handler" -# Create .desktop file +# ...existing code... +# Copy icon if present in repo (fallback optional) — do this before creating the .desktop +ICON_SRC="icon_media/robot_files_256.png" +ICON_DST="$PKG_DIR/usr/share/icons/hicolor/256x256/apps/android-file-handler.png" +ICON_INCLUDED=false +if [ -f "$ICON_SRC" ]; then + mkdir -p "$(dirname "$ICON_DST")" + cp "$ICON_SRC" "$ICON_DST" + chmod 644 "$ICON_DST" + ICON_INCLUDED=true +else + echo "Warning: icon not found at $ICON_SRC; packaging without icon" +fi + +# Create .desktop file (icon name matches installed icon) cat > "$PKG_DIR/usr/share/applications/android-file-handler.desktop" <<'EOF' [Desktop Entry] Type=Application @@ -42,14 +56,20 @@ StartupNotify=true EOF chmod 644 "$PKG_DIR/usr/share/applications/android-file-handler.desktop" -# Copy icon if present in repo (fallback optional) -if [ -f "assets/icons/android-file-handler-256.png" ]; then - cp assets/icons/android-file-handler-256.png "$PKG_DIR/usr/share/icons/hicolor/256x256/apps/android-file-handler.png" - chmod 644 "$PKG_DIR/usr/share/icons/hicolor/256x256/apps/android-file-handler.png" +# Build the Debian package and include postinst script +PKG_ITEMS=( "usr/local/bin/android-file-handler" "usr/share/applications/android-file-handler.desktop" ) +if [ "$ICON_INCLUDED" = true ]; then + PKG_ITEMS+=( "usr/share/icons/hicolor/256x256/apps/android-file-handler.png" ) fi -# Build the Debian package and include postinst script +# Debug listing +echo "Packaging the following items (relative to $PKG_DIR):" +printf ' - %s\n' "${PKG_ITEMS[@]}" +for p in "${PKG_ITEMS[@]}"; do ls -la "$PKG_DIR/$p" || echo " (missing) $PKG_DIR/$p"; done + fpm -s dir -t deb -n android-file-handler -v "$VERSION" \ - --architecture amd64 --prefix /usr/local/bin --deb-user root --deb-group root \ - --after-install scripts/debian/postinst.sh \ - -p "dist/android-file-handler_${VERSION}_amd64.deb" -C "$PKG_DIR" usr/local/bin/android-file-handler usr/share/applications/android-file-handler.desktop usr/share/icons/hicolor/256x256/apps/android-file-handler.png \ No newline at end of file + --architecture amd64 --deb-user root --deb-group root \ + --after-install scripts/linux_postinst.sh \ + -p "dist/android-file-handler_${VERSION}_amd64.deb" -C "$PKG_DIR" "${PKG_ITEMS[@]}" + +echo "Package created at dist/android-file-handler_${VERSION}_amd64.deb" \ No newline at end of file diff --git a/scripts/linux_postinst.sh b/scripts/linux_postinst.sh old mode 100644 new mode 100755 diff --git a/scripts/spec_scripts/android-file-handler-linux.spec b/scripts/spec_scripts/android-file-handler-linux.spec index 73f84c8..91d6397 100644 --- a/scripts/spec_scripts/android-file-handler-linux.spec +++ b/scripts/spec_scripts/android-file-handler-linux.spec @@ -4,7 +4,10 @@ a = Analysis( ['../../src/main.py'], pathex=['src'], binaries=[], - datas=[('../../src/gui', 'gui')], + datas=[ + ('../../src/gui', 'gui'), + ('../../scripts/linux_postinst.sh', 'scripts'), + ], hiddenimports=[ 'gui', 'gui.file_browser',