Install a moduli(5) manual page.
[dragonfly.git] / contrib / bsdinstaller-1.1.6 / src / backend / lua / upgrade / 500_perform_upgrade.lua
1 -- $Id: 500_perform_upgrade.lua,v 1.1 2005/03/27 23:19:29 cpressey Exp $
2
3 --
4 -- Perform an upgrade by copying files from the root of the installation
5 -- medium to the target system.
6 --
7 return {
8     name = "perform_upgrade",
9     title = "Perform Upgrade",
10     action = function(fsm)
11         local cmds
12
13         assert(App.state.target)
14         cmds = CmdChain.new()
15         cmds:set_replacements{
16             base = App.state.target:get_base()
17         }
18
19         --
20         -- First, we must record which files on the installed system have
21         -- the 'noschg' flag set.
22         --
23         App.register_tmpfile("schg.txt")
24         cmds:add("${root}${FIND} ${root}${base} -flags -schg, >${tmp}schg.txt")
25
26         --
27         -- Next, we take away the schg flag from these files, so that we
28         -- can overwrite them.
29         --
30         cmds:add("${root}${XARGS} -t ${root}${CHFLAGS} noschg <${tmp}schg.txt")
31
32         --
33         -- Add commands to copy sources (files and directories) now.
34         --
35         App.state.target:cmds_install_srcs(cmds, App.load_conf("sources"))
36
37         --
38         -- Before we are done, we must use chflags to restore the flags
39         -- of files which we 'noschg'ed so that we could upgrade them.
40         --
41         cmds:add("${root}${XARGS} -t ${root}${CHFLAGS} schg <${tmp}schg.txt")
42         
43         --
44         -- Finally: do it.
45         --
46         if cmds:execute() then
47                 App.ui:inform(
48                     _("Target system was successfully upgraded!")
49                 )
50         else
51                 App.ui:inform(
52                     _("Target system was not successfully upgraded.")
53                 )
54         end
55
56         return fsm:next()
57     end
58 }