All pastes #899543 Raw Edit

Something

public text v1 · immutable
·published 2008-02-11 05:38 UTC
rendered paste body
#!/usr/bin/ruby

# /etc/init.d/buildmenu

# :MC: this depends on the hostname being set.
# tweak /etc/init.d/hostname.sh to set the host names

shutdown = 'echo "-------"; echo "Press enter to shutdown..."; read pause; poweroff -f'

hostname = `hostname`.chomp

newdisktest = "/usr/bin/disktest"

disktest = "echo '*.* /var/log/kmsg.pipe' >> /etc/syslog.conf ; invoke-rc.d sysklogd restart ; /usr/bin/diag-disk"

timeout = false

if /build/.match(hostname)
    timeout = 30
    default = "install default OS"
elsif /test/.match(hostname)
    timeout = 5
    default = "new disk test"
else
    exit
end

require 'rubytui'
include RubyTUI

$TIMEOUT = timeout

cloner = '/usr/local/bin/lessdisks-cloner'

choice = menuWithDefault("build boot options","choose a boot option",default,
    "install default OS","update default OS",
    "install other system", "diskless terminal", "new disk test", "disk test", "root", "Fix GRUB")

case choice
when "install default OS"
    system "#{cloner} default || bash ; #{shutdown}"
when "update default OS"
    system "#{cloner} update default || bash ; #{shutdown}"
when "install other system"
    system "#{cloner} || bash ; #{shutdown}"
when "new disk test"
    system "#{newdisktest} || bash; #{shutdown}"
when "disk test"
    system "#{disktest} || bash ; #{shutdown}"
when "diskless terminal"
    # do nothing
when "root"
    system "/bin/bash ; #{shutdown}"
when  "Fix GRUB"
    system "/etc/fgdiag/clone-config/lessdisks-postclone/boot-loader || bash ; #{shutdown}"
end