50-depmod.install 833 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env bash
  2. # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
  3. # ex: ts=8 sw=4 sts=4 et filetype=sh
  4. COMMAND="$1"
  5. KERNEL_VERSION="$2"
  6. ENTRY_DIR_ABS="$3"
  7. KERNEL_IMAGE="$4"
  8. INITRD_OPTIONS_START="5"
  9. [[ $KERNEL_VERSION ]] || exit 1
  10. case "$COMMAND" in
  11. add)
  12. [[ -d "/lib/modules/${KERNEL_VERSION}/kernel" ]] || exit 0
  13. [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
  14. echo "Running depmod -a ${KERNEL_VERSION}"
  15. exec depmod -a "${KERNEL_VERSION}"
  16. ;;
  17. remove)
  18. [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
  19. echo "Removing /lib/modules/${KERNEL_VERSION}/modules.dep and associated files"
  20. exec rm -f /lib/modules/"${KERNEL_VERSION}"/modules.{alias{,.bin},builtin.bin,dep{,.bin},devname,softdep,symbols{,.bin}}
  21. ;;
  22. *)
  23. exit 0
  24. esac