Guest User

Untitled

a guest
Jan 16th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. #!/bin/bash
  2. INITRD='/boot/initrd.xz'
  3. temp="$(mktemp -t 'initrd.XXXXXX')"
  4.  
  5. if [ -z "$KERNEL_VERSION" ]; then
  6. echo 'KERNEL_VERSION unset, attempting to determine it.' >&2
  7. kv="$(
  8. find /lib/modules/ \
  9. ! -type f \
  10. -name '[0-9]*' \
  11. -maxdepth 1 |
  12. sort -V |
  13. tail -1 |
  14. cut -f 4 -d '/'
  15. )"
  16. if [ -n "$kv" ]; then
  17. echo "Found version \`$kv'." >&2
  18. export KERNEL_VERSION="$kv"
  19. else
  20. echo 'Unable to determine kernel version :-<' >&2
  21. echo 'Proceeding anyway.' >&2
  22. fi
  23. fi
  24.  
  25. # 3.14.33:
  26. # usbhid, hid_generic : needed for USB keyboard support (important when you
  27. # need to enter a LUKS key)
  28. #MODS=xhci-hcd:usbhid:hid_generic
  29.  
  30. # 4.x?:
  31. # someone on reddit suggested these:
  32. #MODS=hid-generic:usbhid:hid:ohci-hcd:ehci-pci:uhci-hcd:ssb-hcd:ehci-hcd:xhci-hcd
  33.  
  34. # from mkinitrd changes (inappropriately included)
  35. MODS=xhci-pci:ohci-pci:ehci-pci:xhci-hcd:ohci-hcd
  36. # more stuff mkinitrd adds for USB keyboards
  37. MODS+=:ehci-hcd:uhci-hcd
  38. # last modules from 3.x
  39. MODS+=:usbhid:hid_generic
  40.  
  41. # filesystems
  42. MODS+=:xfs
  43.  
  44. mkinitrd \
  45. -o "$INITRD" \
  46. -c -L -R \
  47. -m $MODS \
  48. -u \
  49. -f xfs \
  50. -C /dev/md1 \
  51. -h /dev/beta/swap \
  52. -r LABEL=beta-root &&
  53.  
  54. zcat -- "$INITRD" |xz --check=crc32 >"$temp" &&
  55. cp -- "$temp" "$INITRD"
  56. err="$?"
  57.  
  58. rm -f -- "$temp"
  59. exit "$err"
Add Comment
Please, Sign In to add comment