On Thursday 30 September 2004 15:37, Miguel Albuquerque wrote:
Thank you very much, works great ! So should I assume that with grub i can't do the same ? :-[
Here is a small script that I bashed together a few months ago: ----8<----8<--[bootonce]--8<----8<----8<---- #! /bin/bash # BASH script to use GRUB's boot-once feature GRUB_ENTRY_COUNT=`grep "^[[:blank:]]*title\>" /boot/grub/menu.lst | wc --lines` function is_number() { echo "$1" | egrep -q '^[0-9]+$' } function is_entry() { is_number $1 && [ $1 -ge 0 -a $1 -lt $GRUB_ENTRY_COUNT ] } function usage() { local i echo "Usage: ${0##*/} [0..$[ GRUB_ENTRY_COUNT - 1 ]]" grep "^[[:blank:]]*title\>" /boot/grub/menu.lst | sed 's:^[[:blank:]]*[Tt][Ii][Tt][Ll][Ee][[[:blank:]]\+::' | while read S; do echo "$[ i ]: $S" (( i++ )) done exit 1 } # See if there's a --stage2= option in /etc/grub.conf: [ -f "/etc/SuSE-release" ] && STAGE2="`sed -n '/--stage2=/ s/^.*--stage2=\([^[:blank:]]*\).*$/\1/p' /etc/grub.conf`" # If the file does not exist, remove the STAGE2 variable [ -f "$STAGE2" ] || unset STAGE2 # For debugging put a comment sign in front of the next line: GRUB="grub --batch" # Allow only one parameter is_entry $1 || usage ${GRUB-cat} <<EOF savedefault ${STAGE2+--stage2=$STAGE2} --default=$1 --once quit EOF ---->8---->8---->8---->8---->8---- Watch out if your mail client wraps long lines! Usage: bootonce [entry_number] Without parameters, it displays available entries in GRUB. With a parameter, it sets the GRUB entry to boot into at next boot only. A typical sequence would be: $ bootonce 0: Linux 1: Windows $ bootonce 1 shutdown -r now Instead of 'shutdown -r now', one can logout of KDE, and choose 'Reboot' from the KDM menu. Works for me. The 'bootonce' script is for GRUB only. Cheers, Leen