Improve DEB package extraction and repackaging logic
Enhanced the workflow to handle multiple data archive compression formats (xz, gz, zst) when extracting and repackaging DEB files. Added checks for the presence of the data archive and updated extraction and repackaging commands to match the detected format, improving robustness and compatibility.
This commit is contained in:
@@ -211,10 +211,41 @@ jobs:
|
|||||||
# Extract the DEB package
|
# Extract the DEB package
|
||||||
ar x "$GITHUB_WORKSPACE/$deb_file"
|
ar x "$GITHUB_WORKSPACE/$deb_file"
|
||||||
|
|
||||||
|
# List extracted files to see what we have
|
||||||
|
echo "Extracted DEB contents:"
|
||||||
|
ls -la
|
||||||
|
|
||||||
|
# Find the data archive (could be data.tar.xz, data.tar.gz, data.tar.zst, etc.)
|
||||||
|
data_archive=""
|
||||||
|
for ext in xz gz zst; do
|
||||||
|
if [ -f "data.tar.$ext" ]; then
|
||||||
|
data_archive="data.tar.$ext"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$data_archive" ]; then
|
||||||
|
echo "Warning: Could not find data archive in DEB package"
|
||||||
|
cd "$GITHUB_WORKSPACE"
|
||||||
|
rm -rf "$temp_deb_dir"
|
||||||
|
else
|
||||||
|
echo "Found data archive: $data_archive"
|
||||||
|
|
||||||
# Extract the data archive
|
# Extract the data archive
|
||||||
mkdir -p data
|
mkdir -p data
|
||||||
cd data
|
cd data
|
||||||
tar xf ../data.tar.xz
|
|
||||||
|
case "$data_archive" in
|
||||||
|
*.tar.xz)
|
||||||
|
tar xf "../$data_archive"
|
||||||
|
;;
|
||||||
|
*.tar.gz)
|
||||||
|
tar xzf "../$data_archive"
|
||||||
|
;;
|
||||||
|
*.tar.zst)
|
||||||
|
tar --zstd -xf "../$data_archive"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Ensure desktop files are properly placed
|
# Ensure desktop files are properly placed
|
||||||
if [ ! -d "usr/share/applications" ]; then
|
if [ ! -d "usr/share/applications" ]; then
|
||||||
@@ -236,12 +267,22 @@ jobs:
|
|||||||
echo "Copied icon to proper location"
|
echo "Copied icon to proper location"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Repackage the data archive
|
# Repackage the data archive with the same compression
|
||||||
tar cJf ../data.tar.xz ./*
|
case "$data_archive" in
|
||||||
|
*.tar.xz)
|
||||||
|
tar cJf "../$data_archive" ./*
|
||||||
|
;;
|
||||||
|
*.tar.gz)
|
||||||
|
tar czf "../$data_archive" ./*
|
||||||
|
;;
|
||||||
|
*.tar.zst)
|
||||||
|
tar --zstd -cf "../$data_archive" ./*
|
||||||
|
;;
|
||||||
|
esac
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
# Create the fixed DEB package
|
# Create the fixed DEB package
|
||||||
ar r "${GITHUB_WORKSPACE}/${deb_file}" debian-binary control.tar.xz data.tar.xz
|
ar r "${GITHUB_WORKSPACE}/${deb_file}" debian-binary control.tar.* "$data_archive"
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
cd "$GITHUB_WORKSPACE"
|
cd "$GITHUB_WORKSPACE"
|
||||||
@@ -249,6 +290,7 @@ jobs:
|
|||||||
|
|
||||||
echo "DEB package desktop integration fixed"
|
echo "DEB package desktop integration fixed"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Post-build directory listing:"
|
echo "Post-build directory listing:"
|
||||||
echo "-- dist --"; ls -lah dist || true
|
echo "-- dist --"; ls -lah dist || true
|
||||||
|
|||||||
Reference in New Issue
Block a user