OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
1.9 KiB

  1. # vim: set ft=sh:
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: package/.../mkinitramfs/install/D%libdir_kernel.in.txt
  6. # Copyright (C) 2007 - 2008 The OpenSDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; version 2 of the License. A copy of the
  13. # GNU General Public License can be found in the file COPYING.
  14. # --- SDE-COPYRIGHT-NOTE-END ---
  15. MODINFO=${MODINFO:-/sbin/modinfo}
  16. DEPMOD=${DEPMOD:-/sbin/depmod}
  17. if [ -n "$moddir" ]; then
  18. # sanity checks
  19. for tool in $MODINFO $DEPMOD; do
  20. if [ ! -x "$tool" ]; then
  21. echo "ERROR: $tool is no available"
  22. exit 1
  23. fi
  24. done
  25. modules_missing=
  26. module_install() {
  27. local module= source= target=
  28. if [ -r "$1" ]; then
  29. # absolute path
  30. source="$1"
  31. module=${source##*/}; module=${module%.ko}
  32. else
  33. module="$1"
  34. source="$( find "$moddir/kernel" -name "$module.ko" | head -n 1 )"
  35. fi
  36. if [ -r "$source" ]; then
  37. target="lib/modules/$kernelver/${source#$moddir/}"
  38. if [ ! -f $target ]; then
  39. echo -n " $module"
  40. mkdir -p "${target%/*}"
  41. cp "$source" "$target"
  42. for dep in $( $MODINFO "$source" | grep "^depends:" | tr -s ' ' | cut -d' ' -f2 | tr ',' ' ' ); do
  43. module_install "$dep"
  44. done
  45. fi
  46. else
  47. modules_missing="$modules_missing $module"
  48. echo -n " [$module]"
  49. fi
  50. }
  51. module_list_available() {
  52. find "$moddir" -type f -name '*.ko'
  53. }
  54. module_list_running() {
  55. local x= module=
  56. cat /proc/modules | cut -d' ' -f1 | while read x; do
  57. module=$(find "$moddir" -type f -name "$x.ko")
  58. if [ -n "$module" ]; then
  59. echo "$module"
  60. else
  61. echo "ERROR: $x.ko not found!" >&2
  62. fi
  63. done
  64. }
  65. safe_depmod() {
  66. $DEPMOD -ae -b "$tmpdir" -F "$sysmap" "$kernelver"
  67. }
  68. fi