Skip to content

Instantly share code, notes, and snippets.

@kforeverisback
Created June 28, 2024 19:20
Show Gist options
  • Save kforeverisback/a881b82a572b36813ddb62bf6a4935cf to your computer and use it in GitHub Desktop.
Save kforeverisback/a881b82a572b36813ddb62bf6a4935cf to your computer and use it in GitHub Desktop.
Extract and repackage deb (Debian) file
#!/bin/bash
# Extract the data files to `repack` directory
dpkg -x some-package_amd64.deb repack
# Extract the control files to repack/DEBIAN directory
# using DEBIAN as control file output is important to repacakge
dpkg -e some-package_amd64.deb repack/DEBIAN
# Make some modification as necessary
# Repackage
# It will generate repack.deb file
dpkg-deb --build -Zgzip repack/
mv repack.deb package-name-version-arch.deb
# Compressions supported are: gzip, xz, zstd
# I've used -Zgzip, this will make sure the deb file have maximum backward compatibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment