Skip to content

Commit

Permalink
Optionally allow the EULA confirmation to be suppressed.
Browse files Browse the repository at this point in the history
  • Loading branch information
jwhite66 committed Jun 4, 2010
1 parent e18ab8a commit f532468
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
5 changes: 5 additions & 0 deletions docs.txt
Expand Up @@ -433,6 +433,11 @@ Here are the elements, and the attributes they can possess.
the license text. Currently this must be a text file in UTF-8 encoding.


accept_not_needed (false, mustBeBool)

If true, then the user does not have to explicitly accept the EULA.


Setup.Readme:

This element is a child of Setup.Package. It can be used to display a
Expand Down
1 change: 1 addition & 0 deletions scripts/mojosetup_init.lua
Expand Up @@ -378,6 +378,7 @@ function Setup.Eula(tab)
{
{ "description", nil, mustExist, mustBeString, cantBeEmpty },
{ "source", nil, mustExist, mustBeString, cantBeEmpty },
{ "accept_not_needed", nil, mustBeBool },
})
end

Expand Down
22 changes: 14 additions & 8 deletions scripts/mojosetup_mainline.lua
Expand Up @@ -1325,13 +1325,16 @@ local function do_install(install)
for k,eula in pairs(install.eulas) do
local desc = eula.description
local fname = "data/" .. eula.source
local accept_needed = not eula.accept_not_needed

-- (desc) and (fname) become upvalues in this function.
stages[#stages+1] = function (thisstage, maxstage)
local retval = MojoSetup.gui.readme(desc,fname,thisstage,maxstage)
if retval == 1 then
if not MojoSetup.promptyn(desc, _("Accept this license?"), false) then
MojoSetup.fatal(_("You must accept the license before you may install"))
if accept_needed then
if not MojoSetup.promptyn(desc, _("Accept this license?"), false) then
MojoSetup.fatal(_("You must accept the license before you may install"))
end
end
end
return retval
Expand Down Expand Up @@ -1461,14 +1464,17 @@ local function do_install(install)
for k,eula in pairs(option_eulas) do
local desc = eula.description
local fname = "data/" .. eula.source
local accept_needed = not eula.accept_not_needed
local retval = MojoSetup.gui.readme(desc,fname,thisstage,maxstage)
if retval == 1 then
if not MojoSetup.promptyn(desc, _("Accept this license?"), false) then
-- can't go back? We have to die here instead.
if thisstage == 1 then
MojoSetup.fatal(_("You must accept the license before you may install"))
else
retval = -1 -- just step back a stage.
if accept_needed then
if not MojoSetup.promptyn(desc, _("Accept this license?"), false) then
-- can't go back? We have to die here instead.
if thisstage == 1 then
MojoSetup.fatal(_("You must accept the license before you may install"))
else
retval = -1 -- just step back a stage.
end
end
end
end
Expand Down

0 comments on commit f532468

Please sign in to comment.