Install a moduli(5) manual page.
[dragonfly.git] / contrib / bsdinstaller-1.1.6 / src / backend / lua / main.lua
1 -- demo/main.lua
2 -- $Id: main.lua,v 1.19 2005/04/03 20:28:22 cpressey Exp $
3 -- Main menu for demonstration application for dfuibe_lua.
4
5 App = require "app"; App.init()
6 require "storage"
7 require "dfui"
8 require "fsm"
9 require "menu"
10 require "storage_ui"
11 require "target_system"
12
13 Pty = require("pty")
14
15 GetText = require "gettext"
16 GetText.set_package("dfuibe_lua")
17 GetText.set_locale_dir("/usr/local/share/locale")
18 GetText.init()
19
20 App.start{
21     name = "Demonstration App",
22     logfile = "demo.log",
23     ui = DFUI.new{
24         transport = "tcp",      -- XXX default from command line options...
25         rendezvous = "9999"
26     }
27 }
28
29 --
30 -- Set one of the following options to run this installer in `mock mode':
31 --
32 -- App.option.fake_execution = true     -- don't actually execute anything
33 -- App.option.confirm_execution = true  -- always ask before executing
34 --
35 -- You might also wish to change the root from whence things are drawn:
36 --
37 -- App.dir.root = "/usr/release/root/"  -- or what have you
38 --
39 -- These can be set from the dfuibe_lua command line like so:
40 --    option.fake_execution=true dir.root=/usr/release/root
41 --
42
43 -- Create a storage-descriptor for the application.
44 App.state.storage = StorageDescriptor.new()
45 App.state.storage:survey()
46
47 -- put welcome notify-box here
48
49 --
50 -- First let the user configure the important user-interface aspects
51 -- of their system (language, keyboard/screenmap if on console,
52 -- internet connection for logging to remote machine over net, etc.)
53 --
54 -- These are termed "pre-install tasks" even though that is a slight
55 -- misnomer (and an unfortunate acronym):
56 --
57 App.descend("pit")
58
59 Menu.auto{
60     name = "Select Task",
61     short_desc = "Choose one of the following tasks to perform.",
62     continue_constraint = function(result)
63         if App.state.do_reboot then
64                 return Menu.DONE
65         else
66                 return result
67         end
68     end
69 }
70
71 --
72 -- If there is a target system mounted, unmount it before leaving.
73 --
74 if App.state.target ~= nil and App.state.target:is_mounted() then
75         if not App.state.target:unmount() then
76                 App.ui:inform(
77                     _("Warning: subpartitions were not correctly unmounted.")
78                 )
79         end
80 end
81
82 App.stop()
83
84 if App.state.do_reboot then
85         -- exit with reboot code
86         os.exit(5)
87 else
88         os.exit(0)
89 end