Install a moduli(5) manual page.
[dragonfly.git] / contrib / bsdinstaller-1.1.6 / src / backend / lua / install / 300_select_part.lua
1 -- $Id: 300_select_part.lua,v 1.17 2005/02/24 23:08:04 cpressey Exp $
2
3 require "gettext"
4 require "storage_ui"
5
6 return {
7     name = "select_part",
8     title = "Select Partition",
9     action = function(fsm)
10         App.state.sel_part = nil
11
12         local pd = StorageUI.select_part({
13             dd = App.state.sel_disk,
14             short_desc = _(
15                 "Select the primary partition of %s (also "     ..
16                 "known as a `slice' in the BSD tradition) on "  ..
17                 "which to install %s.",
18                 App.state.sel_disk:get_name(),
19                 App.os.name),
20            cancel_desc = _("Return to %s", fsm:prev().title)
21         })
22
23         if pd then
24                 if pd:is_mounted() then
25                         App.ui:inform(
26                             _("One or more subpartitions on the selected "      ..
27                             "primary partition already in use (they are "       ..
28                             "currently mounted in the filesystem.) "            ..
29                             "You should either unmount them before "            ..
30                             "proceeding, or select a different partition "      ..
31                             "or disk on which to install %s.", App.os.name))
32                         return fsm:current()
33                 end
34
35                 if pd:get_activated_swap() > 0 then
36                         local choices = {}
37
38                         choices[_("Reboot")] = "reboot"
39                         choices[_("Return to %s", fsm:prev().title)] = fsm:prev()
40
41                         return App.ui:select(
42                             _("Some subpartitions on the selected primary "     ..
43                             "partition are already activated as swap. "         ..
44                             "Since there is no way to deactivate swap in "      ..
45                             "%s once it is activated, in order "                ..
46                             "to edit the subpartition layout of this "          ..
47                             "primary partition, you must first reboot.",
48                             App.os.name), choices)
49                 end
50
51                 App.state.sel_part = pd
52
53                 if pd:get_capacity() < App.state.disk_min then
54                         App.ui:inform(_(
55                             "WARNING: you should have a primary "       ..
56                             "partition at least %dM in size, or "       ..
57                             "you may encounter problems trying to "     ..
58                             "install %s.",
59                             App.state.disk_min, App.os.name)
60                         )
61                 end
62
63                 if App.state.sel_disk:has_been_touched() or
64                    App.ui:confirm(_(
65                     "WARNING!  ALL data in primary partition #%d,\n\n%s\n\non the "     ..
66                     "disk\n\n%s\n\n will be IRREVOCABLY ERASED!\n\nAre you "            ..
67                     "ABSOLUTELY SURE you wish to take this action?  This is "           ..
68                     "your LAST CHANCE to cancel!",
69                     pd:get_number(), pd:get_desc(),
70                     App.state.sel_disk:get_desc())) then
71                         local cmds = CmdChain.new()
72
73                         pd:cmds_format(cmds)
74                         if cmds:execute() then
75                                 App.ui:inform(_(
76                                     "Primary partition #%d was formatted.",
77                                     pd:get_number())
78                                 )
79                                 return fsm:next()
80                         else
81                                 App.ui:inform(_(
82                                     "Primary partition #%d was "        ..
83                                     "not correctly formatted, and may " ..
84                                     "now be in an inconsistent state. " ..
85                                     "We recommend re-formatting it "    ..
86                                     "before proceeding.",
87                                     pd:get_number())
88                                 )
89                                 return fsm:current()
90                         end
91                 else
92                         App.ui:inform(_(
93                             "Action cancelled - " ..
94                             "no primary partitions were formatted."))
95                         return fsm:prev()
96                 end
97         else
98                 return fsm:prev()
99         end
100     end
101 }