Last active
June 26, 2016 22:00
-
-
Save corpix/3f97265309a5435185d59187a3e519cf to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
set -e | |
set -x | |
mkdir recovery | |
cd recovery | |
# Iterate installed packages (pkgname=pkgversion) | |
for pkgfullname in `dpkg -l | grep '^ii' | awk '{print $2"="$3}'`; do | |
# Get package name without version | |
pkgname="$(echo "$pkgfullname"|awk -F= '{print $1}')" | |
# Filter packages with files in /etc/init.d, | |
# download it and extract into current directory | |
dpkg-query -L "$pkgname" | \ | |
grep -F '/etc/init.d' > /dev/null && \ | |
apt-get download "$pkgfullname" && \ | |
dpkg -x "${pkgname}_"*.deb . | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment