Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- INITRD='/boot/initrd.xz'
- temp="$(mktemp -t 'initrd.XXXXXX')"
- if [ -z "$KERNEL_VERSION" ]; then
- echo 'KERNEL_VERSION unset, attempting to determine it.' >&2
- kv="$(
- find /lib/modules/ \
- ! -type f \
- -name '[0-9]*' \
- -maxdepth 1 |
- sort -V |
- tail -1 |
- cut -f 4 -d '/'
- )"
- if [ -n "$kv" ]; then
- echo "Found version \`$kv'." >&2
- export KERNEL_VERSION="$kv"
- else
- echo 'Unable to determine kernel version :-<' >&2
- echo 'Proceeding anyway.' >&2
- fi
- fi
- # 3.14.33:
- # usbhid, hid_generic : needed for USB keyboard support (important when you
- # need to enter a LUKS key)
- #MODS=xhci-hcd:usbhid:hid_generic
- # 4.x?:
- # someone on reddit suggested these:
- #MODS=hid-generic:usbhid:hid:ohci-hcd:ehci-pci:uhci-hcd:ssb-hcd:ehci-hcd:xhci-hcd
- # from mkinitrd changes (inappropriately included)
- MODS=xhci-pci:ohci-pci:ehci-pci:xhci-hcd:ohci-hcd
- # more stuff mkinitrd adds for USB keyboards
- MODS+=:ehci-hcd:uhci-hcd
- # last modules from 3.x
- MODS+=:usbhid:hid_generic
- # filesystems
- MODS+=:xfs
- mkinitrd \
- -o "$INITRD" \
- -c -L -R \
- -m $MODS \
- -u \
- -f xfs \
- -C /dev/md1 \
- -h /dev/beta/swap \
- -r LABEL=beta-root &&
- zcat -- "$INITRD" |xz --check=crc32 >"$temp" &&
- cp -- "$temp" "$INITRD"
- err="$?"
- rm -f -- "$temp"
- exit "$err"
Add Comment
Please, Sign In to add comment