fix(linux): preserve AppImage executable bit via .tar.gz and auto-integrate Ubuntu icons
Browsers strip POSIX executable permissions (+x) from raw .AppImage files downloaded directly over HTTP, leaving the downloaded binary non-executable in Ubuntu Files (Nautilus). Additionally, Ubuntu displays a generic cog icon for standalone AppImages in both Nautilus and the Ubuntu Dock on Wayland unless desktop metadata, high-DPI icons, and GVfs custom icon attributes are registered. - Wrap `Asteria-<arch>.AppImage` (`0755`) in a `.AppImage.tar.gz` archive in `package-linux.sh` and point CI wiki links to the archive so extracting the download preserves executable permissions out of the box. - Copy `.DirIcon` as a regular PNG file rather than a symlink so SquashFS icon extractors that do not follow symlinks receive valid image bytes. - Add non-blocking first-launch integration in `AppRun` to install `hicolor` icons and `asteria-qt.desktop` (`StartupWMClass=asteria-qt`) under `XDG_DATA_HOME` and apply `metadata::custom-icon` on `$APPIMAGE` via `gio` for Nautilus. - Embed 128x128, 256x256, and 512x512 icons in Qt resources and register them with `QApplication::setWindowIcon()`.
This commit is contained in:
7 files changed
+63
-7
No files matched your search
+5
-3
@@ -327,6 +327,7 @@ package-linux:
|
|||||||
name: "asteria-qt-linux-appimage-${CI_COMMIT_SHORT_SHA}"
|
name: "asteria-qt-linux-appimage-${CI_COMMIT_SHORT_SHA}"
|
||||||
paths:
|
paths:
|
||||||
- Asteria-x86_64.AppImage
|
- Asteria-x86_64.AppImage
|
||||||
|
- Asteria-x86_64.AppImage.tar.gz
|
||||||
expire_in: 1 day
|
expire_in: 1 day
|
||||||
when: on_success
|
when: on_success
|
||||||
rules:
|
rules:
|
||||||
@@ -350,6 +351,7 @@ package-linux-arm64:
|
|||||||
name: "asteria-qt-linux-arm64-appimage-${CI_COMMIT_SHORT_SHA}"
|
name: "asteria-qt-linux-arm64-appimage-${CI_COMMIT_SHORT_SHA}"
|
||||||
paths:
|
paths:
|
||||||
- Asteria-arm64.AppImage
|
- Asteria-arm64.AppImage
|
||||||
|
- Asteria-arm64.AppImage.tar.gz
|
||||||
expire_in: 1 day
|
expire_in: 1 day
|
||||||
when: on_success
|
when: on_success
|
||||||
rules:
|
rules:
|
||||||
@@ -462,8 +464,8 @@ update-wiki:
|
|||||||
- API_URL="${CI_API_V4_URL:-https://gitlab.com/api/v4}/projects/${CI_PROJECT_ID}"
|
- API_URL="${CI_API_V4_URL:-https://gitlab.com/api/v4}/projects/${CI_PROJECT_ID}"
|
||||||
- WIKI_URL="${API_URL}/wikis/home"
|
- WIKI_URL="${API_URL}/wikis/home"
|
||||||
- ARTIFACTS_URL="${PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_REF_NAME}/download"
|
- ARTIFACTS_URL="${PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_REF_NAME}/download"
|
||||||
- LINUX_URL="${PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_REF_NAME}/raw/Asteria-x86_64.AppImage?job=package-linux"
|
- LINUX_URL="${PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_REF_NAME}/raw/Asteria-x86_64.AppImage.tar.gz?job=package-linux"
|
||||||
- LINUX_ARM64_URL="${PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_REF_NAME}/raw/Asteria-arm64.AppImage?job=package-linux-arm64"
|
- LINUX_ARM64_URL="${PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_REF_NAME}/raw/Asteria-arm64.AppImage.tar.gz?job=package-linux-arm64"
|
||||||
- WINDOWS_URL="${ARTIFACTS_URL}?job=package-windows"
|
- WINDOWS_URL="${ARTIFACTS_URL}?job=package-windows"
|
||||||
- WINDOWS_ARM64_URL="${ARTIFACTS_URL}?job=package-windows-arm64"
|
- WINDOWS_ARM64_URL="${ARTIFACTS_URL}?job=package-windows-arm64"
|
||||||
- MACOS_URL="${PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_REF_NAME}/raw/Asteria.dmg?job=package-macos"
|
- MACOS_URL="${PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_REF_NAME}/raw/Asteria.dmg?job=package-macos"
|
||||||
@@ -472,7 +474,7 @@ update-wiki:
|
|||||||
--header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
|
--header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
|
||||||
"${WIKI_URL}")
|
"${WIKI_URL}")
|
||||||
|
|
||||||
NEW_SECTION=$(printf '## Latest dev builds (v%s)\n\n> Updated automatically by pipeline [#%s](%s) from `%s` @ %s\n\n| Platform | Download |\n|----------|----------|\n| Linux (x86_64) | [AppImage](%s) |\n| Linux (ARM64) | [AppImage](%s) |\n| Windows (x86_64) | [Portable zip](%s) |\n| Windows (ARM64) | [Portable zip](%s) |\n| macOS | [DMG](%s) |' \
|
NEW_SECTION=$(printf '## Latest dev builds (v%s)\n\n> Updated automatically by pipeline [#%s](%s) from `%s` @ %s\n\n| Platform | Download |\n|----------|----------|\n| Linux (x86_64) | [AppImage (.tar.gz)](%s) |\n| Linux (ARM64) | [AppImage (.tar.gz)](%s) |\n| Windows (x86_64) | [Portable zip](%s) |\n| Windows (ARM64) | [Portable zip](%s) |\n| macOS | [DMG](%s) |' \
|
||||||
"${ASTERIA_VERSION}" "${CI_PIPELINE_ID}" "${CI_PIPELINE_URL}" "${CI_COMMIT_REF_NAME}" "${CI_COMMIT_SHORT_SHA}" \
|
"${ASTERIA_VERSION}" "${CI_PIPELINE_ID}" "${CI_PIPELINE_URL}" "${CI_COMMIT_REF_NAME}" "${CI_COMMIT_SHORT_SHA}" \
|
||||||
"${LINUX_URL}" "${LINUX_ARM64_URL}" "${WINDOWS_URL}" "${WINDOWS_ARM64_URL}" "${MACOS_URL}")
|
"${LINUX_URL}" "${LINUX_ARM64_URL}" "${WINDOWS_URL}" "${WINDOWS_ARM64_URL}" "${MACOS_URL}")
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ cmake -S . -B build-linux-arm64 -G Ninja \
|
|||||||
-DQT_HOST_PATH=/opt/qt/6.12.0/gcc_64
|
-DQT_HOST_PATH=/opt/qt/6.12.0/gcc_64
|
||||||
cmake --build build-linux-arm64 --target asteria-qt
|
cmake --build build-linux-arm64 --target asteria-qt
|
||||||
```
|
```
|
||||||
AppImage Packaging (uses `scripts/bundle-linux-appdir.py` + `appimagetool` for both `x86_64` and `arm64`):
|
AppImage Packaging (uses `scripts/bundle-linux-appdir.py` + `appimagetool` for both `x86_64` and `arm64`, outputting `Asteria-<arch>.AppImage` (`0755`) and a permission-preserving `Asteria-<arch>.AppImage.tar.gz` archive; `AppRun` auto-integrates `~/.local/share/applications/asteria-qt.desktop`, `hicolor` icons, and Nautilus `metadata::custom-icon` on first launch):
|
||||||
```bash
|
```bash
|
||||||
packaging/package-linux.sh build-linux /opt/qt/6.12.0/gcc_64 dist x86_64
|
packaging/package-linux.sh build-linux /opt/qt/6.12.0/gcc_64 dist x86_64
|
||||||
packaging/package-linux.sh build-linux-arm64 /opt/qt/6.12.0/gcc_arm64 dist arm64
|
packaging/package-linux.sh build-linux-arm64 /opt/qt/6.12.0/gcc_arm64 dist arm64
|
||||||
|
|||||||
@@ -306,6 +306,9 @@ qt_add_qml_module(asteria-qt
|
|||||||
packaging/icons/32x32/asteria-qt.png
|
packaging/icons/32x32/asteria-qt.png
|
||||||
packaging/icons/48x48/asteria-qt.png
|
packaging/icons/48x48/asteria-qt.png
|
||||||
packaging/icons/64x64/asteria-qt.png
|
packaging/icons/64x64/asteria-qt.png
|
||||||
|
packaging/icons/128x128/asteria-qt.png
|
||||||
|
packaging/icons/256x256/asteria-qt.png
|
||||||
|
packaging/icons/512x512/asteria-qt.png
|
||||||
RESOURCE_PREFIX /
|
RESOURCE_PREFIX /
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
Type=Application
|
Type=Application
|
||||||
Name=Asteria
|
Name=Asteria
|
||||||
Comment=Cross-platform book reader
|
Comment=Cross-platform book reader
|
||||||
Exec=asteria-qt
|
Exec=asteria-qt %f
|
||||||
Icon=asteria-qt
|
Icon=asteria-qt
|
||||||
|
StartupWMClass=asteria-qt
|
||||||
Categories=Office;Viewer;
|
Categories=Office;Viewer;
|
||||||
MimeType=text/plain;
|
MimeType=application/epub+zip;application/x-fictionbook+xml;application/vnd.comicbook+zip;application/vnd.comicbook-rar;text/plain;
|
||||||
@@ -65,4 +65,8 @@ fi
|
|||||||
ARCH="$APPIMAGE_ARCH" appimagetool "${APPIMAGETOOL_ARGS[@]}" \
|
ARCH="$APPIMAGE_ARCH" appimagetool "${APPIMAGETOOL_ARGS[@]}" \
|
||||||
"$APPDIR" "$OUTPUT_DIR/$OUTPUT_NAME"
|
"$APPDIR" "$OUTPUT_DIR/$OUTPUT_NAME"
|
||||||
|
|
||||||
|
chmod 0755 "$OUTPUT_DIR/$OUTPUT_NAME"
|
||||||
|
tar -czf "$OUTPUT_DIR/${OUTPUT_NAME}.tar.gz" -C "$OUTPUT_DIR" "$OUTPUT_NAME"
|
||||||
|
|
||||||
echo "==> AppImage ($ARCH) created: $OUTPUT_DIR/$OUTPUT_NAME ($(du -sh "$OUTPUT_DIR/$OUTPUT_NAME" | cut -f1))"
|
echo "==> AppImage ($ARCH) created: $OUTPUT_DIR/$OUTPUT_NAME ($(du -sh "$OUTPUT_DIR/$OUTPUT_NAME" | cut -f1))"
|
||||||
|
echo "==> Archive ($ARCH) created: $OUTPUT_DIR/${OUTPUT_NAME}.tar.gz ($(du -sh "$OUTPUT_DIR/${OUTPUT_NAME}.tar.gz" | cut -f1))"
|
||||||
@@ -130,7 +130,7 @@ def setup_appdir_metadata(appdir):
|
|||||||
dir_icon = os.path.join(appdir, ".DirIcon")
|
dir_icon = os.path.join(appdir, ".DirIcon")
|
||||||
if os.path.lexists(dir_icon):
|
if os.path.lexists(dir_icon):
|
||||||
os.remove(dir_icon)
|
os.remove(dir_icon)
|
||||||
os.symlink("asteria-qt.png", dir_icon)
|
shutil.copy2(icon_src, dir_icon)
|
||||||
|
|
||||||
apprun_path = os.path.join(appdir, "AppRun")
|
apprun_path = os.path.join(appdir, "AppRun")
|
||||||
with open(apprun_path, "w", encoding="utf-8") as f:
|
with open(apprun_path, "w", encoding="utf-8") as f:
|
||||||
@@ -141,6 +141,49 @@ def setup_appdir_metadata(appdir):
|
|||||||
'export QT_PLUGIN_PATH="$HERE/usr/plugins"\n'
|
'export QT_PLUGIN_PATH="$HERE/usr/plugins"\n'
|
||||||
'export QML2_IMPORT_PATH="$HERE/usr/qml"\n'
|
'export QML2_IMPORT_PATH="$HERE/usr/qml"\n'
|
||||||
'export QML_IMPORT_PATH="$HERE/usr/qml"\n'
|
'export QML_IMPORT_PATH="$HERE/usr/qml"\n'
|
||||||
|
"\n"
|
||||||
|
'# Auto-integrate desktop icon & Nautilus file icon when running as an AppImage\n'
|
||||||
|
'if [ -n "${APPIMAGE:-}" ] && [ -f "$APPIMAGE" ] && [ -n "${HOME:-}" ]; then\n'
|
||||||
|
" (\n"
|
||||||
|
' DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"\n'
|
||||||
|
" for sz in 16 32 48 64 128 256 512; do\n"
|
||||||
|
' SRC_ICON="$HERE/usr/share/icons/hicolor/${sz}x${sz}/apps/asteria-qt.png"\n'
|
||||||
|
' DST_DIR="$DATA_HOME/icons/hicolor/${sz}x${sz}/apps"\n'
|
||||||
|
' if [ -f "$SRC_ICON" ]; then\n'
|
||||||
|
' mkdir -p "$DST_DIR"\n'
|
||||||
|
' cp -f "$SRC_ICON" "$DST_DIR/asteria-qt.png"\n'
|
||||||
|
" fi\n"
|
||||||
|
" done\n"
|
||||||
|
' ICON_256="$DATA_HOME/icons/hicolor/256x256/apps/asteria-qt.png"\n'
|
||||||
|
' APPS_DIR="$DATA_HOME/applications"\n'
|
||||||
|
' mkdir -p "$APPS_DIR"\n'
|
||||||
|
' ESCAPED_APPIMAGE=$(printf "%s" "$APPIMAGE" | sed \'s/"/\\\\"/g\')\n'
|
||||||
|
' cat <<EOF > "$APPS_DIR/asteria-qt.desktop"\n'
|
||||||
|
"[Desktop Entry]\n"
|
||||||
|
"Type=Application\n"
|
||||||
|
"Name=Asteria\n"
|
||||||
|
"Comment=Cross-platform book reader\n"
|
||||||
|
'Exec="$ESCAPED_APPIMAGE" %f\n'
|
||||||
|
"TryExec=$APPIMAGE\n"
|
||||||
|
"Icon=$ICON_256\n"
|
||||||
|
"StartupWMClass=asteria-qt\n"
|
||||||
|
"Categories=Office;Viewer;\n"
|
||||||
|
"MimeType=application/epub+zip;application/x-fictionbook+xml;application/vnd.comicbook+zip;application/vnd.comicbook-rar;text/plain;\n"
|
||||||
|
"EOF\n"
|
||||||
|
' chmod 755 "$APPS_DIR/asteria-qt.desktop"\n'
|
||||||
|
" if command -v gio >/dev/null 2>&1; then\n"
|
||||||
|
' gio set "$APPIMAGE" metadata::custom-icon "file://$ICON_256" 2>/dev/null || true\n'
|
||||||
|
' gio set "$APPS_DIR/asteria-qt.desktop" metadata::trusted true 2>/dev/null || true\n'
|
||||||
|
" fi\n"
|
||||||
|
" if command -v update-desktop-database >/dev/null 2>&1; then\n"
|
||||||
|
' update-desktop-database "$APPS_DIR" 2>/dev/null || true\n'
|
||||||
|
" fi\n"
|
||||||
|
" if command -v gtk-update-icon-cache >/dev/null 2>&1; then\n"
|
||||||
|
' gtk-update-icon-cache -f -t "$DATA_HOME/icons/hicolor" 2>/dev/null || true\n'
|
||||||
|
" fi\n"
|
||||||
|
" ) >/dev/null 2>&1 &\n"
|
||||||
|
"fi\n"
|
||||||
|
"\n"
|
||||||
'exec "$HERE/usr/bin/asteria-qt" "$@"\n'
|
'exec "$HERE/usr/bin/asteria-qt" "$@"\n'
|
||||||
)
|
)
|
||||||
os.chmod(apprun_path, 0o755)
|
os.chmod(apprun_path, 0o755)
|
||||||
|
|||||||
@@ -90,6 +90,9 @@ int main(int argc, char *argv[])
|
|||||||
appIcon.addFile(QStringLiteral(":/Asteria/packaging/icons/32x32/asteria-qt.png"), QSize(32, 32));
|
appIcon.addFile(QStringLiteral(":/Asteria/packaging/icons/32x32/asteria-qt.png"), QSize(32, 32));
|
||||||
appIcon.addFile(QStringLiteral(":/Asteria/packaging/icons/48x48/asteria-qt.png"), QSize(48, 48));
|
appIcon.addFile(QStringLiteral(":/Asteria/packaging/icons/48x48/asteria-qt.png"), QSize(48, 48));
|
||||||
appIcon.addFile(QStringLiteral(":/Asteria/packaging/icons/64x64/asteria-qt.png"), QSize(64, 64));
|
appIcon.addFile(QStringLiteral(":/Asteria/packaging/icons/64x64/asteria-qt.png"), QSize(64, 64));
|
||||||
|
appIcon.addFile(QStringLiteral(":/Asteria/packaging/icons/128x128/asteria-qt.png"), QSize(128, 128));
|
||||||
|
appIcon.addFile(QStringLiteral(":/Asteria/packaging/icons/256x256/asteria-qt.png"), QSize(256, 256));
|
||||||
|
appIcon.addFile(QStringLiteral(":/Asteria/packaging/icons/512x512/asteria-qt.png"), QSize(512, 512));
|
||||||
QApplication::setWindowIcon(appIcon);
|
QApplication::setWindowIcon(appIcon);
|
||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
|
|||||||
Reference in new issue
Block a user