Last active
August 29, 2015 14:05
-
-
Save dochang/f8e216dbe25b5ac7e9c1 to your computer and use it in GitHub Desktop.
backup-packages.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ARCH=$(dpkg --print-architecture) | |
for pkg_spec; do | |
pkg_name=${pkg_spec%%:*} | |
pkg_arch=${pkg_spec##*:} | |
if [ "$pkg_name" = "$pkg_arch" ]; then | |
# no pkg_arch | |
if dpkg -l ${pkg_name}:all >/dev/null 2>&1; then | |
pkg_arch=all | |
else | |
pkg_arch="$ARCH" | |
fi | |
fi | |
rm -fv ${pkg_name}_*_${pkg_arch}.deb | |
dpkg-repack ${pkg_name}:${pkg_arch} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment