#!/usr/bin/perl # # Programmer: Marcello Mathias Herreshoff # Creation Date: Sun Mar 23 19:00:53 PST 2003 # Last Modified: Sun Mar 23 19:00:53 PST 2003 # Filename: mkhurd_grub_conf.pl # Syntax: perl 5 # License: GPL # # Description: Ask for some info and spit out a piece of menu.lst for \ # booting GNU/Hurd # use strict; my ($hd, $zi_hd, $sec, $zi_sec) = (0, 0, 0, 0); #zi -> zero index my $mach_location; #where is the .gz file my $output; #The actual program: print "First let me ask you some questions about the disk HURD is on.\n"; print "Enter IDE(prim/sec):"; chomp($_ = ); if(/s/i){ print "Secondary.\n"; $zi_hd += 2; }else{ print "Primary.\n"; } print "Enter IDE(master/slave):"; chomp($_ = ); unless(/m/i){ print "Slave.\n"; $zi_hd += 1; }else{ print "Master.\n"; } $hd = $zi_hd+1; #print "DEBUG hd = $hd\n"; print "Next let me ask you about the sector HURD is on.\n"; print "Do you like to count sectors starting at zero or one (0/1)?"; chomp($_ = ); if($_){ #one print "Starting from one, what sector is HURD on:"; chomp($_ = ); $sec = +$_; #Important we numify! print "Starting from one, sector $sec.\n"; $zi_sec = $sec-1; }else{ #zero print "Starting from zero, what sector is HURD on:"; chomp($_ = ); $zi_sec = +$_; #Important we numify! print "Starting from zero, sector $zi_sec.\n"; $sec = $zi_sec+1; } print "Where is mach located on this disk [/boot/gnumach.gz]:"; chomp($_ = ); $mach_location = $_ || '/boot/gnumach.gz'; $output = <"; chomp($_ = ); if(/y/){ open(GRUBCONF, ">> /boot/grub/menu.lst"); print GRUBCONF $output; close GRUBCONF; print "Reboot to use GNU/Hurd\nHappy Hacking!\n" }else{ print "Enter a place to save the configuration, or nothing to quit.\n"; print "Note: Appends if file already existent.\n>"; chomp($_ = ); exit unless($_); open(OUT, ">>", $_); print "Data written to $_.\n"; }