Fix DEB desktop integration in build workflow

Adds a post-processing step to ensure desktop entry and icon files are correctly placed in DEB packages built via alien, addressing issues where alien may miss proper desktop integration.
This commit is contained in:
Your Name
2025-09-02 19:27:05 +03:00
parent 81480cbebe
commit aebe5f1aa6
+51
View File
@@ -199,6 +199,57 @@ jobs:
# Build DEB (via alien from RPM)
python setup_cxfreeze.py bdist_deb || echo "bdist_deb completed with warnings (alien)"
# Fix DEB desktop integration (alien sometimes misses this)
deb_file=$(ls dist/ytsage_*.deb 2>/dev/null | head -n1 || true)
if [ -n "$deb_file" ]; then
echo "Fixing DEB desktop integration for: $deb_file"
# Create temporary directory for DEB extraction
temp_deb_dir=$(mktemp -d)
cd "$temp_deb_dir"
# Extract the DEB package
ar x "$GITHUB_WORKSPACE/$deb_file"
# Extract the data archive
mkdir -p data
cd data
tar xf ../data.tar.xz
# Ensure desktop files are properly placed
if [ ! -d "usr/share/applications" ]; then
mkdir -p usr/share/applications
fi
if [ ! -d "usr/share/pixmaps" ]; then
mkdir -p usr/share/pixmaps
fi
# Copy desktop entry if it exists in the package but not in the right place
if [ -f "usr/lib/ytsage-${version}/share/applications/ytsage.desktop" ] && [ ! -f "usr/share/applications/ytsage.desktop" ]; then
cp "usr/lib/ytsage-${version}/share/applications/ytsage.desktop" "usr/share/applications/"
echo "Copied desktop entry to proper location"
fi
# Copy icon if it exists in the package but not in the right place
if [ -f "usr/lib/ytsage-${version}/share/pixmaps/ytsage.png" ] && [ ! -f "usr/share/pixmaps/ytsage.png" ]; then
cp "usr/lib/ytsage-${version}/share/pixmaps/ytsage.png" "usr/share/pixmaps/"
echo "Copied icon to proper location"
fi
# Repackage the data archive
tar cJf ../data.tar.xz ./*
cd ..
# Create the fixed DEB package
ar r "${GITHUB_WORKSPACE}/${deb_file}" debian-binary control.tar.xz data.tar.xz
# Clean up
cd "$GITHUB_WORKSPACE"
rm -rf "$temp_deb_dir"
echo "DEB package desktop integration fixed"
fi
echo "Post-build directory listing:"
echo "-- dist --"; ls -lah dist || true
echo "-- build --"; ls -lah build || true