# Pastebin LriGK6iP #!/bin/sh # This script is designed to behave like 10_linux # # These variables represent the two volumes we're going to peek at: ROOTFS_UUID=348e0ebd-25f4-47ab-9637-29be2520e637 BOOTFS_UUID=ade2a118-7198-4876-8e5b-12a069d2aa41 # Our prober: grub_probe=/usr/sbin/grub-probe # Our workspace: ROOT_VOL=/root/mnt mkdir -p $ROOT_VOL mount /dev/disk/by-uuid/$ROOTFS_UUID $ROOT_VOL mount /dev/disk/by-uuid/$BOOTFS_UUID $ROOT_VOL/boot # Gather information GRUB_DISTRIBUTOR=$(cat $ROOT_VOL/etc/system-release) GRUB_DEVICE="`${grub_probe} --target=device $ROOT_VOL`" GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true GRUB_DEVICE_BOOT="`${grub_probe} --target=device $ROOT_VOL/boot`" GRUB_DEVICE_BOOT_UUID="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true GRUB_FS="`${grub_probe} --target=fs $ROOT_VOL 2> /dev/null || echo unknown`" export GRUB_DEVICE GRUB_DEVICE_UUID GRUB_DEVICE_BOOT GRUB_DEVICE_BOOT_UUID GRUB_FS GRUB_DISTRIBUTOR # We need a slightly customized' version of /etc/grub.d/10_linux: ROOT_VOL_10_LINUX=/root/10_linux.x perl -pn -e 'next unless m!list=.*vmlinu!;s! /! '$ROOT_VOL'/!g' < /etc/grub.d/10_linux > $ROOT_VOL_10_LINUX chmod +x $ROOT_VOL_10_LINUX # Run 10_linux to get our pretty menu items $ROOT_VOL_10_LINUX # Clean up rm -f $ROOT_VOL_10_LINUX umount $ROOT_VOL/boot umount $ROOT_VOL