lix-os-utilities/leaves.sh

19 lines
467 B
Bash
Executable File

#!/usr/bin/env sh
set -e
# given a sorted list of packages, finds the ones which appear in none of the
# dependencies of the listed packages.
[ "$1" ] || { >&2 echo "usage: leaves <file>" && exit 1; }
tmp="$(mktemp)"
#trap "rm $tmp" EXIT INT HUP
cat "$1" | while read foobar; do
echo "getting $foobar dependencies..."
lix deps "$foobar" | cut -d' ' -f1 >> "$tmp"
done
cp "$tmp" "$tmp.bak"
cat "$tmp" | sort | uniq > "$tmp"
comm -23 "$1" "$tmp"
echo "$tmp"