LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-06-2004, 05:22 PM   #1
bglnelissen
Member
 
Registered: Feb 2004
Location: Utrecht Holland
Distribution: MacOS, Debian, Raspbian
Posts: 76

Rep: Reputation: 15
make grub boot from other partition --> only once


Hi,

I updated my mandrake version from 10.0 to 10.1 I thought it was time for a fresh install. I kept my /home/myname so all my settings were saved (other HD). My girlfriend hates the pinguin computer and she wants to use the 'normal one' with the START menu.

The mandrake 10.0 had the lilo bootloader as default which was ok. Mandrake 10.1 has the Grub bootloader, which is also ok. One thing i can't get done with grub:

Cause my girlfriend wants here START menu every time she uses the computer it needs a reboot to windows, no problemo. (VMWARE not an option)
lilo had this wonderfull function which was:
console:

# lilo -r windows (or something like it)

(put this little script under an icon with a windows logo on your desktop, everybody happy)

what made it reboot directly to windows and not the lilo menu with linux for default. So you dont need to sit next to your computer waiting to get it booted in Windows, in the time you wanted to go to the toilet or whatever.

How is this done with Grub? I tried to make another config file, but that did not work so well.
Installing LILO is too easy! therefor not an option

Help will be appreciated.

Greetings Bas


ps
(
opperator, aint it usefull to start a list with all kinds of usefull very small scripts? like:
while [ 1 ];smbstatus -i;sleep 5;done
i think there are a lot of usefull progs and scrips we never thought of.
)
 
Old 12-06-2004, 06:14 PM   #2
Samsara
Member
 
Registered: May 2003
Distribution: Ubuntu, Mac OS X Tiger
Posts: 481

Rep: Reputation: 32
This has not afaik been implemented in GRUB. There was a hack to do this a while back, but I never tried this because it was being described to me as a "dirty hack", and at the time I hesitated to use it. Following this, I wrote a script that would change the grub config file and reboot grub, so it would reboot in windows. However, it would then boot windows every time. That problem could be solved in a very roundabout way by installing the ext3-Extension in Windows and having the reverse perl script there, using the ActivePerl implementation. Or keep using lilo. Or stick around while the machine boots. The sky's wide open...

HTH,

Samsara

PS: I'll try and find that grub hack.
 
Old 12-06-2004, 06:18 PM   #3
Samsara
Member
 
Registered: May 2003
Distribution: Ubuntu, Mac OS X Tiger
Posts: 481

Rep: Reputation: 32
http://www.linuxquestions.org/questi...04/02/2/145115

Or this:

Code:
#!/usr/bin/perl
#--------------------------------------------------------------------
# Copyright (C) 2000, 2001, 2002 by MandrakeSoft,
# Pixel <pixel@mandrakesoft.com>,
# Chmouel Boudjnah <chmouel@mandrakesoft.com>,
# Redistribution of this file is permitted under the terms of the GNU
# Public License (GPL)
#--------------------------------------------------------------------
# $Id: rebootin,v 1.11 2001/12/04 14:22:45 chmouel Exp $
#--------------------------------------------------------------------
## description:
#		Reboot once on a specified image for grub or lilo

use strict;

my $lilo_conf = "/etc/lilo.conf";

my $grub_menu = "/boot/grub/menu.lst";
my $grub_once = "/boot/grub/menu.once";
my @entries;
my $bootloader  = `/usr/sbin/detectloader -q` or die "Can't detect your bootloader\n";chomp $bootloader;
my ($fastboot, $noreboot);

while ( $ARGV[0] =~ /^-/ ) {
    $_ = shift;
    if (/^-f/) {
	$fastboot++;
    } elsif (/^-n/) {
	$noreboot++;
    } else {
	die "Unknow switch $_\n";
    }
}

if ($bootloader =~ /GRUB/) {
    grub_conf();
} elsif ( $bootloader =~ /LILO/) {
    lilo_conf();
} elsif ( $bootloader =~ /YABOOT/) {
    die "Sorry, can't do this with yaboot...\n";
} else {
    die "Can't detect your bootloader\n";
}

sub lilo_conf {
    open F, $lilo_conf or die "lilo is not installed ($lilo_conf is missing)\n";
    @entries = map { /=(\S.*)/ } grep { /\s*label=\S*/ } <F>;
    @entries > 0 or die "Bad lilo.conf (no entry found)\n";
    usage() unless $ARGV[0];
    grep /^$ARGV[0]$/, @entries or usage();
    write_fast_boot() if $fastboot;
    system("lilo -R @ARGV"); die "error while wanting to reboot on $ARGV[0]\n" if $?;
    exec "reboot" unless $noreboot;
}

sub grub_conf {
    open F, $grub_menu or die "grub is not installed ($grub_menu is missing)\n";
    @entries = map { /\s(\S.*)/ } grep { /^title\s/ } my @l = <F>;

    grep { m|^altconfigfile\s.*grub/menu\.once| } @l or die "rebootin is of no use without altconfigfile\n";
    @entries > 0 or die "bad menu.lst (no entry found)\n";
    @ARGV == 1 or usage();

    for (my $i = 0; $i < @entries; $i++) {
	$ARGV[0] eq $entries[$i] and set_grub($i);
    }

    print STDERR "$ARGV[0] not found\n";
    usage(); # not found
}

sub set_grub {
    open F, ">$grub_once" or die "can't write rebootin file ($grub_once), verify the rights\n";
    print F "default $_[0]\ntimeout 0\n";
    write_fast_boot() if $fastboot;
    exec "reboot" unless $noreboot;
}

sub usage {
    die "usage: rebootin <label>\n  where <label> is one of " . join(", ", @entries) . "\n";
}

sub write_fast_boot {
    local *F; open F, ">/fastboot"; close F;
}
from http://linux.tuwien.ac.at/fwiso/CD-I.../sbin/rebootin

Edit: All untested by me, so use at your own risk!

Samsara

Last edited by Samsara; 12-06-2004 at 06:21 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
reinstall grub and make boot floppy hraposo Fedora 1 08-11-2004 09:12 AM
Help with Grub in MBR and /boot partition! zLinuxz Linux - General 11 11-17-2003 11:42 AM
make grub boot Floppy blackx Linux - General 2 05-27-2003 06:25 PM
Mandrake 9 Make Grub Boot Disk Maurice Arthur Linux - Distributions 0 04-19-2003 05:37 PM
GRUB using /boot partition for multiple Linux/Windows boot? cpv204 Linux - Newbie 7 04-01-2003 03:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration