#!/bin/sh

# Add <xbmc=autostart,nodiskmount,setvolume loglevel=0> to grub's kernel entries
if [ -f /target/boot/grub/menu.lst ]; then
	# TODO Do not modify single-mode entry
	sed -i -e "/^kernel/s/\(.*\)/\1 xbmc=autostart,nodiskmount,setvolume loglevel=0/" /target/boot/grub/menu.lst

	sed -i -e "/^# kopt=root=/s/\(.*\)/\1 xbmc=autostart,nodiskmount,setvolume loglevel=0/" /target/boot/grub/menu.lst

fi

if [ -f /target/boot/grub/grub.cfg ]; then
	# Watch out for the leading space in kernel line!
	sed -i -e "/^ linux/s/\(.*\)/\1 xbmc=autostart,nodiskmount,setvolume loglevel=0/" /target/boot/grub/grub.cfg

	# TODO modify grub2 templates
fi

