syslinux/com32/lua/test/syslinux-derivative.lua
<<
>>
Prefs
   1-- get nice output
   2printf = function(s,...)
   3           return io.write(s:format(...))
   4         end
   5
   6-- get syslinux derivative (ISOLINUX, PXELINUX, SYSLINUX)
   7derivative = syslinux.derivative()
   8
   9printf("Run specific command depending on the Syslinux derivate:\n")
  10printf("--------------------------------------------------------\n\n")
  11printf("  Detected Syslinux derivative: %s\n", derivative)
  12
  13if derivative == "SYSLINUX" then
  14        -- swap internal (hd1) hard drive with USB stick (hd0)
  15        commandline = 'chain.c32 hd1 swap'
  16elseif derivative == "ISOLINUX" then
  17        -- boot first hard drive
  18        commandline = 'chain.c32 hd0'
  19elseif derivative == "PXELINUX" then
  20        -- boot first hard drive
  21        commandline = 'chain.c32 hd0'
  22else
  23        printf("Do nothing\n")
  24        return 1
  25end
  26
  27printf("\n  commandline for derivative:   %s\n\n", commandline)
  28
  29
  30-- Count down from 7
  31for time = 7, 1, -1 do
  32        printf("  Boot in %d second(s)...   \r", time)
  33        syslinux.sleep(1)
  34end
  35
  36-- Boot
  37syslinux.run_command(commandline)
  38
  39
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.