HOWTO: Tell Grub to load windows 7 as default (debian)

… is quite easy if you know what to do (and it’s update safe!):

Will be / Is DEPRECATED. Please refer to: http://www.triggers-world.de/?p=249

Only precondition: win7 or any other OS you want to boot as default is the next OS after the standard debian entries in the grub list / win7 is the only other OS installed

1. Edit /etc/default/grub

#find&edit or add if it doesn't exist
GRUB_DEFAULT=`/bin/bash "/somedir/getlastboot.sh"`

2. in /somedir/ create a getlastboot.sh with the following content

#!/bin/bash

VAR1=`ls -l /boot | grep -v .bak | grep -c initrd.img`
VAR2=`ls -l /boot | grep -v .bak | grep -c vmlinuz`

let DEFAULTX=VAR1+VAR2
echo $DEFAULTX

3. make it executable

chmod 777 getlastboot.sh

4. update-grub

sudo update-grub

(I have not tested it on ubuntu, but it should work there too)