Skip to content

Instantly share code, notes, and snippets.

@dpq
Created August 27, 2013 18:40
Show Gist options
  • Save dpq/6357355 to your computer and use it in GitHub Desktop.
Save dpq/6357355 to your computer and use it in GitHub Desktop.
Rebuild all installed Debian packages from source.
mkdir world; cd world
for PKG in `aptitude search ~i | awk '{ print $3; }'`; do
apt-get source $PKG
PKGDIR=`find . -maxdepth 1 -mindepth 1 -type d`
cd $PKGDIR
MISSINGDEPS=`cat debian/control | grep Build-Depends | sed 's/,//g' | sed 's/([^)]*)//g' | sed 's/\[[^][]*\]//g' | sed 's/Build-Depends\://'`
aptitude -y install $MISSINGDEPS
dpkg-buildpackage
cd ..
dpkg -i *.deb
rm -r *
done
cd ..
rmdir world
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment