Grub Scripted Configuration

This is a really ugly sed one liner that configures grub how I like it.

$ sudo sed --in-place 's/#\(hiddenmenu\)/\1/;s/^\(timeout[ \t]*\)[0-9]*/\12/;s/^\(# lock.*=\)false$/\1true/' /boot/grub/menu.lst
$ _GPASSWD=$(read -s -p "Enter Grub Password (note type carefully): " _GPASSWD; echo $_GPASSWD | mkpasswd --hash=md5 --stdin); echo; sudo sed --in-place "s/# password topsecret/password --md5 $_GPASSWD/" /boot/grub/menu.lst; unset _GPASSWD
$ sudo update-grub

Leave a Reply


Content Copyright © 2005-2008 Chris Smith. All Rights Reserved.