methods/ai_client.rb
# Code to change timeout and default menu entry in grub
Code to change timeout and default menu entry in grub
Code to change timeout and default menu entry in grub
def update_ai_client_grub_cfg(options)
  copy        = []
  netboot_mac = options['mac'].gsub(/:/,"")
  netboot_mac = "01"+netboot_mac
  netboot_mac = netboot_mac.upcase
  grub_file   = options['tftpdir']+"/grub.cfg."+netboot_mac
  if options['verbose'] == true
    handle_output(options,"Updating:\tGrub config file #{grub_file}")
  end
  if File.exist?(grub_file)
    text=File.read(grub_file)
    text.each do |line|
      if line.match(/set timeout=30/)
        copy.push("set timeout=5")
        copy.push("set default=1")
      else
        copy.push(line)
      end
    end
    File.open(grub_file,"w") {|file| file.puts copy}
    print_contents_of_file(options,"",grub_file)
  end
end
def update_ai_client_grub_cfg ( options ) copy = [ ] netboot_mac = options [ 'mac' ] . gsub ( / : / , "" ) netboot_mac = "01" + netboot_mac netboot_mac = netboot_mac . upcase grub_file = options [ 'tftpdir' ] + "/grub.cfg." + netboot_mac if options [ 'verbose' ] == true handle_output ( options , "Updating:\tGrub config file #{grub_file}" ) end if File . exist? ( grub_file ) text = File . read ( grub_file ) text . each do | line | if line . match ( / set timeout=30 / ) copy . push ( "set timeout=5" ) copy . push ( "set default=1" ) else copy . push ( line ) end end File . open ( grub_file , "w" ) { | file | file . puts copy } print_contents_of_file ( options , "" , grub_file ) end end
Code to change timeout and default menu entry in grub
Code to change timeout and default menu entry in grub
options
<not_specific>