#!/bin/sh -e
# List orphaned packages

cd "$ASD_ROOT/var/db/asd/installed/"

for pkg in *; do
    case $pkg in
        # Exemptions for orphans which aren't really
        # orphans. Exclude them from the list.
        baseinit|baselayout|gcc|e2fsprogs|musl|\
        make|busybox|bzip2|grub|asd|git)
            continue
    esac

    grep -q "^$pkg$" ./*/depends || printf '%s\n' "$pkg"
done
