I think we should rather check for /lib/modules/$KERNEL_VERSION (i.e. if the kernel has module support); missing modules.dep is actually a reason to call depmod. There is also no need to delete the old file, depmod will simply overwrite this and other files. Also, either print a warning if the depmod binary is missing, or call it unconditionally and let the shell report it. (In reply to Petr Mladek from comment #30) > It works and looks fine to me. > > BTW: The script uses many bash-specific construct but the header mentions: > #! /bin/sh type -P is a bash extension, but this check can go away. The rest looks fine.