Skip to content

Commit

Permalink
fpmprobe: add check for uncompressed file paths
Browse files Browse the repository at this point in the history
  • Loading branch information
James Buren committed Jan 7, 2013
1 parent ff161ad commit 5da9d36
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tools/fpmprobe
Expand Up @@ -6,6 +6,7 @@ TMPDIR=$(mktemp -d)

cd "$TMPDIR"

# Probe for unusual permissions for a path.
permission_probe()
{
local p
Expand All @@ -21,6 +22,7 @@ permission_probe()
fi
}

# Probe for paths which should never exist in a package.
paths_probe()
{
local error
Expand All @@ -40,6 +42,32 @@ paths_probe()
fi
}

# Probe for uncompressed file paths in packages.
compressed_probe()
{
local error

if echo "$2" | grep -q -E '\b(gzip|XZ|directory)\b'; then
return
fi

case "$1" in
./usr/share/consolefonts/*.fon) error=1 ;;
./usr/share/consolefonts/*.psf) error=1 ;;
./usr/share/consolefonts/*.psfu) error=1 ;;
./usr/share/fonts/X11/*/*.pcf) error=1 ;;
./usr/share/fonts/X11/*/*.bdf) error=1 ;;
./usr/share/man/*) error=1 ;;
./usr/man/*) error=1 ;;
./lib/modules/*/kernel/*.ko) error=1 ;;
*) error=0 ;;
esac

if [ "$error" -eq 1 ]; then
echo "$1: uncompressed file"
fi
}

for i in /pub/frugalware/frugalware-current/frugalware-x86_64/*.fpm; do
if [ ! -f "$i" ]; then
continue
Expand All @@ -53,6 +81,7 @@ for i in /pub/frugalware/frugalware-current/frugalware-x86_64/*.fpm; do
k=$(file "$j")
k=${k#*: }
paths_probe "$j" "$k"
compressed_probe "$j" $k"
done
echo "End: $i"
rm -rf .* * 2>&1
Expand Down

0 comments on commit 5da9d36

Please sign in to comment.