update-boot 892 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env bash
  2. ##
  3. # Update/copy necessary files to bios path for Guix system due
  4. # it donesn't support /boot partition by default
  5. # from: https://issues.guix.gnu.org/48172
  6. ##
  7. set -e
  8. prefix="$1"
  9. # Copy kernel and initrd images to /boot
  10. images=$(grep -E '^ (linux|initrd) ' $prefix/boot/grub/grub.cfg \
  11. | awk '{ print $2 }' | sed 's|.*/gnu|/gnu|g' | sort | uniq)
  12. for image in $images; do
  13. mkdir -p $prefix/boot$(dirname $image)
  14. if [ ! -e $prefix/boot$image ] || ! cmp -s $prefix$image $prefix/boot$image; then
  15. echo copying cp $prefix$image to $preifx/boot$image... > /dev/error
  16. cp $prefix$image $prefix/boot$image
  17. fi
  18. done
  19. # Adjust /boot/grub/grub.cfg.
  20. sed -E -e 's/.*search.*--set.*//' \
  21. -e 's/^insmod luks.*//' \
  22. -e 's/^cryptomount.*//' \
  23. -e 's,^( (linux|initrd) )[^ ]*(/gnu/[^ ]* ?),\1\3,' \
  24. -i.bak $prefix/boot/grub/grub.cfg