Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- _linux_list="fedora ubuntu slack arch"
- for _linux_key in $_linux_list; do
- # Figure out the boot partition index.
- _linux_boot_uuid=`grep $_linux_key\/boot /etc/fstab | awk '{print $1}' | sed 's/^UUID=//g'`
- # Figure out the kernel path.
- _linux_kern=`ls -t /mnt/$_linux_key/boot/vmlinu* | head -1`
- _linux_kern=`basename "$_linux_kern"`
- if [ -z "$_linux_kern" ]; then
- continue
- fi
- # Figure out the initramfs path.
- _linux_initr=`ls -t /mnt/$_linux_key/boot/initr* | grep -v fall | head -1`
- _linux_initr=`basename "$_linux_initr"`
- if [ -z "$_linux_initr" ]; then
- continue
- fi
- # Get an optional kernel command line from a text file in /etc/cmdline.
- _linux_cmdline=""
- if [ -f /etc/cmdline/$_linux_key ]; then
- _linux_cmdline="`cat /etc/cmdline/$_linux_key`"
- fi
- # Some display names are different.
- case $_linux_key in
- slack)
- _linux_display=slackware
- ;;
- *)
- _linux_display=$_linux_key
- ;;
- esac
- # Create the entry.
- cat << EOF
- menuentry '${_linux_display^}' {
- insmod part_msdos
- insmod ext2
- search --no-floppy --fs-uuid --set=root $_linux_boot_uuid
- linux /$_linux_kern root=/dev/mapper/vg-root$_linux_key ro quiet splash $_linux_cmdline
- initrd /$_linux_initr
- }
- EOF
- done
Advertisement