#!/bin/bash

# first get helper functions (e.g. DEBUG, load_scheme, ...)
. "/usr/lib/powersave/scripts/helper_functions"

DEBUG "process function: prepare bootloader" DEBUG

if [ -z "$BOOT_LOADER" ]; then
    DEBUG "No bootloader specified" ERROR
    exit 1

elif [ "$BOOT_LOADER" = "LILO" ]; then
    # handle lilo
    lilo -R -d 0
    ret=$?
    if [ ret = 0 ];then 
	DEBUG "lilo set" ERROR
    else
	DEBUG "lilo could not be set" ERROR	
    fi
    
elif [ "$BOOT_LOADER" = "GRUB" ]; then
	echo "savedefault --once" | grub --no-curses --device-map=/boot/grub/device.map >/dev/null	
fi

