4 menu = "/boot/grub/menu.lst"
5 once = "/boot/grub/menu.once"
7 if ((getline < menu) > 0)
10 print "grub is not installed (" menu " is missing)"
15 while (getline < menu) {
16 if ( /^title[ \t]+/ ) {
17 gsub(/^title[ \t]+/,"")
18 entries[nrentries] = $0
21 if ( /^altconfigfile[ \t]+.*grub\/menu\.once/ )
25 print "rebootin is of no use without altconfigfile"
29 print "bad menu.lst (no entry found)"
33 print "usage: rebootin <label>\n where <label> is one of "
34 for (n = 0 ; n < nrentries ; n++)
39 for (n = 0 ; n < nrentries ; n++)
40 if ( ARGV[1] == entries[n] ) {
42 print dflt "\ntimeout 0\n" > once
44 getline be_safe < once
45 if ( be_safe != dflt ) {
46 print "can't write rebootin file (" once "), verify the rights"
49 system("/sbin/shutdown -r now")
53 print "\"" ARGV[1] "\" not found"