Reputation: 423
I would like to rebuild/recompile all Debian packages of a machine with specific flags.
How can I do that with less command as possible?
I have found that https://debian-administration.org/article/20/Rebuilding_Debian_packages but it does not explain how to do that for all the packages installed on a system.
Upvotes: 6
Views: 2616
Reputation: 616
You can write a script that does something like this:
for each $pkg in dpkg-query -W -f '${status} ${package}\n' | sed -n 's/^install ok installed //p'
:
This will go through all of your installed packages and generate .deb files for each of them. Probably there are some edge cases etc. that will have to be handled. You could also leave out packages that are not built from C code etc.
Info taken from these questions:
https://unix.stackexchange.com/questions/184812/how-to-update-all-debian-packages-from-source-code
How to override dpkg-buildflags CFLAGS?
Upvotes: 1
Reputation: 973
Try this approach:
dpkg --get-selections > selections
sudo dpkg --clear-selections
sudo dpkg --set-selections < selections
sudo apt-get --reinstall dselect-upgrade
Upvotes: -1