Skip to content

Instantly share code, notes, and snippets.

@rossomax
Created May 31, 2012 15:46
Show Gist options
  • Select an option

  • Save rossomax/2844296 to your computer and use it in GitHub Desktop.

Select an option

Save rossomax/2844296 to your computer and use it in GitHub Desktop.
Extlinux config file maker for Fedora 17
#!/usr/bin/sh
# vim: sts=4 sw=4
#
# Extlinux config file maker for Fedora 17
#
# Install instruction: (do this by root)
# # yum install extlinux
# # extlinux --install /boot/extlinux
# # sh <THIS SCRIPT> > /boot/extlinux/extlinux.conf
#
# Do not remove grub2 because we need some utils by grub2
CFG=/etc/default/grub
tmp=`lsb_release -sd`
NAME=`echo $tmp | sed -e 'y/"/ /'`
if [ ! -f $CFG ]; then
echo "$CFG can not be found"
exit 1
fi
source $CFG
ROOTDEV=`grub2-probe -t device /boot`
ROOT=UUID=`grub2-probe -t fs_uuid -d $ROOTDEV`
echo "DEFAULT vesamenu.c32"
echo "PROMPT 0"
echo
FIRST=1
for KERNEL in `ls -1rv /boot/vmlinuz*`; do
RELEASE=`echo $KERNEL | sed -e 's/^.*vmlinuz-//'`
echo "LABEL $NAME $RELEASE"
if [ x$FIRST != x ]; then
echo " MENU DEFAULT"
unset FIRST
fi
echo " INITRD /boot/initramfs-$RELEASE.img"
echo " KERNEL $KERNEL"
echo " APPEND root=$ROOT $GRUB_CMDLINE_LINUX"
echo
done
cat << __EOF__
LABEL Memtest
MENU LABEL Memtest86+
KERNEL /boot/memtest86+-4.20
LABEL HDT
MENU LABEL Hardware Detection Tool
KERNEL /boot/extlinux/hdt.c32
LABEL Grub2
MENU LABEL Chain load Grub2
KERNEL /boot/grub2/i386-pc/core.img
__EOF__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment