Install a moduli(5) manual page.
[dragonfly.git] / contrib / bsdinstaller-1.1.6 / src / backend / lua / install / 700_install_bootblocks.lua
1 -- $Id: 700_install_bootblocks.lua,v 1.6 2005/02/24 23:08:04 cpressey Exp $
2
3 require "gettext"
4
5 return {
6     name = "install_bootblocks",
7     title = "Install Bootblocks",
8     action = function(fsm)
9         local datasets_list = {}
10         local dataset
11         local dd
12         local disk_ref = {}     -- map from raw name to ref to DiskDescriptor
13
14         for dd in App.state.storage:get_disks() do
15                 local raw_name = dd:get_raw_device_name()
16
17                 disk_ref[raw_name] = dd
18
19                 dataset = {
20                         disk = raw_name,
21                         boot0cfg = "Y",
22                         packet = "N"
23                 }
24                 
25                 if dd:get_capacity() > 8192 then
26                         dataset.packet = "Y"
27                 end
28
29                 table.insert(datasets_list, dataset)
30         end
31
32         local response = App.ui:present({
33             id = "install_bootstrap",
34             name = _("Install Bootblock(s)"),
35             short_desc = _(
36                 "You may now wish to install bootblocks on one or more disks. " ..
37                 "If you already have a boot manager installed, you can skip "   ..
38                 "this step (but you may have to configure your boot manager "   ..
39                 "separately.)  If you installed %s on a disk other "            ..
40                 "than your first disk, you will need to put the bootblock "     ..
41                 "on at least your first disk and the %s disk.",
42                 App.os.name, App.os.name),
43             long_desc = _(
44                 "'Packet Mode' refers to using newer BIOS calls to boot " ..
45                 "from a partition of the disk.  It is generally not " ..
46                 "required unless:\n\n" ..
47                 "- your BIOS does not support legacy mode; or\n" ..
48                 "- your %s primary partition resides on a " ..
49                 "cylinder of the disk beyond cylinder 1024; or\n" ..
50                 "- you just can't get it to boot without it.",
51                 App.os.name
52             ),
53             special = "bsdinstaller_install_bootstrap",
54
55             fields = {
56                 {
57                     id = "disk",
58                     name = _("Disk Drive"),
59                     short_desc = _("The disk on which you wish to install a bootblock"),
60                     editable = "false"
61                 },
62                 {
63                     id = "boot0cfg",
64                     name = _("Install Bootblock?"),
65                     short_desc = _("Install a bootblock on this disk"),
66                     control = "checkbox"
67                 },
68                 {
69                     id = "packet",
70                     name = _("Packet mode?"),
71                     short_desc = _("Select this to use 'packet mode' to boot the disk"),
72                     control = "checkbox"
73                 }
74             },
75         
76             actions = {
77                 {
78                     id = "ok",
79                     name = _("Accept and Install Bootblocks")
80                 },
81                 {
82                     id = "cancel",
83                     name = _("Skip this Step")
84                 }
85             },
86
87             datasets = datasets_list,
88
89             multiple = "true",
90             extensible = "false"
91         })
92
93         if response.action_id == "ok" then
94                 local cmds = CmdChain.new()
95                 local i
96
97                 for i, dataset in response.datasets do
98                         if dataset.boot0cfg == "Y" then
99                                 dd = disk_ref[dataset.disk]
100                                 dd:cmds_install_bootblock(cmds,
101                                     (dataset.packet == "Y"))
102                         end
103                 end
104
105                 cmds:execute()
106         end
107
108         return fsm:next()
109     end
110 }