r313 - in trunk: . scripts
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sun May 27 12:41:12 EDT 2007
Author: icculus
Date: 2007-05-27 12:41:12 -0400 (Sun, 27 May 2007)
New Revision: 313
Modified:
trunk/docs.txt
trunk/scripts/mojosetup_mainline.lua
Log:
Added MojoSetup.manifest.
Modified: trunk/docs.txt
===================================================================
--- trunk/docs.txt 2007-05-27 15:56:12 UTC (rev 312)
+++ trunk/docs.txt 2007-05-27 16:41:12 UTC (rev 313)
@@ -838,6 +838,7 @@
version in the Lua standard runtime, since this version does better debug
logging.
+
MojoSetup.date()
Return a string of the current date. This is roughly the same as os.date()
@@ -946,5 +947,50 @@
compile-time options.
+ MojoSetup.destination
+
+ This is a string (not a function!) of the path on the physical filesystem
+ where the package is being installed. This is not available until the
+ user has selected a destination, but could be useful in your postinstall
+ script.
+
+
+ MojoSetup.manifest
+
+ This is an array of tables (not a function!) that is built during the
+ course of the installation. As changes are made to the destination
+ filesystem, they are noted in MojoSetup.manifest, so this will be
+ complete and most useful during a postinstall hook in your config file.
+
+ As with most other globals listed here, MojoSetup depends on this data,
+ so you should treat it as read-only. Modifying this table from your config
+ script will result in undefined (but probably bad) behaviour.
+
+ The format of the tables in the array vary depending on type. They all
+ have a "type" field, which is a string. Based on the type, different
+ fields are available:
+
+ if (item.type = "file") then
+ print("file created at " .. item.path)
+ print("with permissions" ... item.mode) -- This is a string!
+
+ -- Checksums may or may not exist in this table, depending on how
+ -- MojoSetup was compiled. You can iterate to find out what's there:
+ print("checksums:")
+ for k,v in pairs(item.checksums) do
+ print(" " .. k .. ": " .. v) -- "crc32: 92FAB211E", etc.
+ end
+ end
+
+ if (item.type = "dir") then
+ print("directory created at " .. item.path)
+ print("with permissions" ... item.mode) -- This is a string!
+ end
+
+ if (item.type = "symlink") then
+ print("symbolic link created at " .. item.path)
+ print("pointing to " .. item.linkdest)
+ end
+
// end of docs.txt ...
Modified: trunk/scripts/mojosetup_mainline.lua
===================================================================
--- trunk/scripts/mojosetup_mainline.lua 2007-05-27 15:56:12 UTC (rev 312)
+++ trunk/scripts/mojosetup_mainline.lua 2007-05-27 16:41:12 UTC (rev 313)
@@ -233,9 +233,9 @@
end
-local function install_file(path, archive, file, option, perms)
+local function install_file(dest, archive, file, option, perms)
-- Upvalued so we don't look these up each time...
- local fname = string.gsub(path, "^.*/", "", 1) -- chop the dirs off...
+ local fname = string.gsub(dest, "^.*/", "", 1) -- chop the dirs off...
local ptype = _("Installing") -- !!! FIXME: localization.
local component = option.description
local keepgoing = true
@@ -251,41 +251,66 @@
return keepgoing
end
- MojoSetup.installed_files[#MojoSetup.installed_files+1] = path
- local written, sums = MojoSetup.writefile(archive, path, perms, callback)
+ MojoSetup.installed_files[#MojoSetup.installed_files+1] = dest
+ local written, sums = MojoSetup.writefile(archive, dest, perms, callback)
if not written then
-- !!! FIXME: formatting!
if not keepgoing then
MojoSetup.logerror("User cancelled install during file write.")
MojoSetup.fatal(_("User cancelled installation."))
else
- MojoSetup.logerror("Failed to create file '" .. path .. "'")
+ MojoSetup.logerror("Failed to create file '" .. dest .. "'")
MojoSetup.fatal(_("File creation failed!"))
end
end
- MojoSetup.loginfo("Created file '" .. path .. "'")
+
+ MojoSetup.manifest[#MojoSetup.manifest+1] =
+ {
+ type = "file",
+ path = dest,
+ checksums = sums,
+ mode = perms,
+ }
+
+ MojoSetup.loginfo("Created file '" .. dest .. "'")
end
-local function install_symlink(path, lndest)
- MojoSetup.installed_files[#MojoSetup.installed_files+1] = path
- if not MojoSetup.platform.symlink(path, lndest) then
+local function install_symlink(dest, lndest)
+ MojoSetup.installed_files[#MojoSetup.installed_files+1] = dest
+ if not MojoSetup.platform.symlink(dest, lndest) then
-- !!! FIXME: formatting!
- MojoSetup.logerror("Failed to create symlink '" .. path .. "'")
+ MojoSetup.logerror("Failed to create symlink '" .. dest .. "'")
MojoSetup.fatal(_("symlink creation failed!"))
end
- MojoSetup.loginfo("Created symlink '" .. path .. "' -> '" .. lndest .. "'")
+
+ MojoSetup.manifest[#MojoSetup.manifest+1] =
+ {
+ type = "symlink",
+ path = dest,
+ linkdest = lndest,
+ }
+
+ MojoSetup.loginfo("Created symlink '" .. dest .. "' -> '" .. lndest .. "'")
end
-local function install_directory(path, perms)
- MojoSetup.installed_files[#MojoSetup.installed_files+1] = path
- if not MojoSetup.platform.mkdir(path, perms) then
+local function install_directory(dest, perms)
+ MojoSetup.installed_files[#MojoSetup.installed_files+1] = dest
+ if not MojoSetup.platform.mkdir(dest, perms) then
-- !!! FIXME: formatting
- MojoSetup.logerror("Failed to create dir '" .. path .. "'")
+ MojoSetup.logerror("Failed to create dir '" .. dest .. "'")
MojoSetup.fatal(_("mkdir failed"))
end
- MojoSetup.loginfo("Created directory '" .. path .. "'")
+
+ MojoSetup.manifest[#MojoSetup.manifest+1] =
+ {
+ type = "dir",
+ path = dest,
+ mode = perms,
+ }
+
+ MojoSetup.loginfo("Created directory '" .. dest .. "'")
end
@@ -894,6 +919,7 @@
-- Make the stages available elsewhere.
MojoSetup.stages = stages
+ MojoSetup.manifest = {}
MojoSetup.installed_files = {}
MojoSetup.rollbacks = {}
MojoSetup.downloads = {}
@@ -940,6 +966,7 @@
-- Done with these things. Make them eligible for garbage collection.
stages = nil
+ MojoSetup.manifest = nil
MojoSetup.destination = nil
MojoSetup.scratchdir = nil
MojoSetup.rollbackdir = nil
More information about the mojosetup-commits
mailing list