Last active
June 9, 2016 22:30
-
-
Save idlemoor/45ff29d6a856a89591e0b3d97d42d30a to your computer and use it in GitHub Desktop.
Find file collisions in SlackBuilds.org packages
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
cd /store/SBo/master/packages/14.2/i486/ | |
for t in */*/*.t?z; do | |
p=$(dirname $t) | |
echo $p >&2 | |
tar tvf $t | sed -r -e '/^d/d' -e 's/^([^ ]+ +){5}//' -e '/^install\//d' -e "s:^:$p###:" | |
done > /tmp/mega-list | |
cd /store/slackware/current/i586/slackware | |
for t in */*.t?z; do | |
p=$(echo $t | rev | cut -f4- -d- | rev) | |
echo $p >&2 | |
tar tvf $t | sed -r -e '/^d/d' -e 's/^([^ ]+ +){5}//' -e '/^install\//d' -e "s:^:$p###:" | |
done >> /tmp/mega-list | |
sort '-t#' -k4 /tmp/mega-list > /tmp/mega-list.s | |
awk 'BEGIN { FS="###"; p=""; f=""; d=""; } | |
{ | |
if ($2==f) { printf "%s %s\n",p,f; p=$1; d="y"; } | |
else if (d=="y") { printf "%s %s\n\n",p,f; p=$1; f=$2; d=""; } | |
else { p=$1; f=$2; } | |
} | |
END { if (d=="y") printf "%s %s\n\n",p,f; }' < /tmp/mega-list.s > /tmp/collisions | |
declare -A PCOUNT | |
while read p f; do | |
if [ -z "$p" ] && [ -z "$PLIST" ]; then | |
: | |
elif [ -n "$p" ] && [ -z "$PLIST" ]; then | |
PLIST="$p" | |
elif [ -n "$p" ] && [ -n "$PLIST" ]; then | |
PLIST="$PLIST $p" | |
elif [ -z "$p" ] && [ -n "$PLIST" ]; then | |
if [ -n "${PCOUNT["$PLIST"]}" ]; then | |
PCOUNT["$PLIST"]=$(( ${PCOUNT["$PLIST"]} + 1 )) | |
else | |
PCOUNT["$PLIST"]=1 | |
fi | |
PLIST="" | |
fi | |
done < /tmp/collisions | |
for c in "${!PCOUNT[@]}"; do | |
echo "$c" ${PCOUNT["$c"]} | sed | |
done | sort > /tmp/tuples |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment