dpkg-repack
Rebuild installed packages into Debian archives
SYNOPSIS
dpkg-repack [options] package...
PARAMETERS
-h, --help
Display this help message and exit.
-o directory, --output-directory directory
Specify the output directory for the .deb file. Defaults to the current directory.
-d, --destdir directory
Deprecated alias for --output-directory.
-c comment, --comment comment
Add a comment to the changelog of the generated package. The comment is added at the beginning of the changelog file.
-C, --changelog
Include the existing changelog file (if it exists) from the original package in the repackaged package. Usually used with -c or --comment.
-l, --link-deps
Use hard links instead of copying the data when rebuilding the package. This can save disk space and time, but may not work in all cases (e.g., when creating packages for different architectures).
-m, --merge-conffiles
Merge current conffiles with those from the installed package (requires package version > 1.40).
-q, --quiet
Quiet mode. Suppress non-error messages.
-s, --source
Generate a source package as well. Requires that the debian source archive is available
DESCRIPTION
dpkg-repack takes an installed Debian package and recreates the corresponding .deb file. This can be useful for creating copies of packages that have been modified or customized after installation.
It extracts the package control files and data from the system, then rebuilds a Debian package archive (.deb) from them. The resulting .deb package can then be installed, distributed, or used for debugging purposes.
Note that configuration files might be automatically changed during an install or upgrade, so dpkg-repack reflects the state of the currently installed package, not necessarily the original .deb. Use it with caution, especially with packages containing conffiles.
It is important to understand that the repackaged package may contain modifications done by the maintainer scripts during install/upgrade. Consider using back-up or other methods to capture original state of your environment if that is desired.
CAVEATS
The repackaged package reflects the current state of the installed package, including any modifications made since installation. This may not be identical to the original .deb file. It is not suitable as the only method to create reproducible builds as install scripts might change contents of the installed binaries.
USAGE EXAMPLES
dpkg-repack package_name
Repacks the specified package into a .deb file in the current directory.
dpkg-repack -o /tmp package_name
Repacks the specified package into a .deb file in the /tmp directory.
dpkg-repack -c "Custom build" package_name
Repacks the specified package and adds the comment "Custom build" to the changelog.