Created
September 11, 2012 12:33
-
-
Save AlD/3698092 to your computer and use it in GitHub Desktop.
remove broken packages (unresolved dependencies) from a Slowlaris host
This file contains hidden or 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 | |
pushd /var/sadm/pkg && | |
for pkg in *; do | |
[ -f $pkg/install/depend ] && | |
egrep '^[PR] ' $pkg/install/depend | | |
tr '[:space:]' ' ' | | |
cut -d\ -f2 | | |
while read dep; do | |
if ! pkginfo -q $dep; then | |
echo ${pkg}\'s dependency $dep not found, removing it... >&2 | |
yes | pkgrm $pkg | |
break 2 | |
fi | |
done | |
done | |
# licensed under GPL, Daniel Albers <[email protected]>, 20120911 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment