#!/bin/bash

while read -r f; do
  if [[ -e ${f}modules.order ]]; then
    depmod $(basename "$f")
  elif [[ -d $f ]]; then
    rm -f "${f}"modules.{alias,alias.bin,builtin.alias.bin,builtin.bin} \
          "${f}"modules.{dep,dep.bin,devname,softdep,symbols,symbols.bin}
    rmdir --ignore-fail-on-non-empty "$f"
  fi
done

# vim:set ft=sh sw=2 et:
