aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md10
-rw-r--r--src/lpm.lua20
2 files changed, 25 insertions, 5 deletions
diff --git a/README.md b/README.md
index aaa3fb8..91c61f0 100644
--- a/README.md
+++ b/README.md
@@ -154,6 +154,16 @@ CMAKE_DEFAULT_FLAGS="-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER\ -DCMAKE_FIND_ROO
To run the test suite, you can use `lpm` to execute the test by doing `./lpm test t/run.lua`. use `FAST=1 ./lpm test t/run.lua` to avoid the costs of tearing down and building up suites each time.
+## Extra Features
+
+### Bottles
+
+### Extra Fields
+
+* `addons.files.extra.chmod_executable`
+
+An array of files to be marked as executable (after extraction, if applicable).
+
## Bugs
If you find a bug, please create an issue with the following information:
diff --git a/src/lpm.lua b/src/lpm.lua
index 2ec9f67..1042da4 100644
--- a/src/lpm.lua
+++ b/src/lpm.lua
@@ -845,10 +845,10 @@ function Addon:install(bottle, installing)
if self.path then
local path = install_path .. (self.organization == 'complex' and self.path and common.stat(self.local_path).type ~= "dir" and (PATHSEP .. "init.lua") or "")
if SYMLINK then
- if VERBOSE then log_action("Symlinking " .. self.local_path .. " to " .. path) end
+ if VERBOSE then log_action("Symlinking " .. self.local_path .. " to " .. path .. ".") end
system.symlink(self.local_path, temporary_path)
else
- if VERBOSE then log_action("Copying " .. self.local_path .. " to " .. path) end
+ if VERBOSE then log_action("Copying " .. self.local_path .. " to " .. path .. ".") end
common.copy(self.local_path, temporary_path)
end
end
@@ -873,10 +873,10 @@ function Addon:install(bottle, installing)
if not system.stat(temporary_path) then
common.mkdirp(common.dirname(temporary_path))
if SYMLINK and self.repository:is_local() and system.stat(local_path) then
- log_action("Symlinking " .. local_path .. " to " .. target_path)
+ log_action("Symlinking " .. local_path .. " to " .. target_path .. ".")
system.symlink(local_path, temporary_path)
elseif SYMLINK and self.repository:is_local() and system.stat(stripped_local_path) then
- log_action("Symlinking " .. stripped_local_path .. " to " .. target_path)
+ log_action("Symlinking " .. stripped_local_path .. " to " .. target_path .. ".")
system.symlink(stripped_local_path, temporary_path)
else
common.get(file.url, { target = temporary_path, checksum = file.checksum, callback = write_progress_bar })
@@ -884,13 +884,23 @@ function Addon:install(bottle, installing)
local is_archive = basename:find("%.zip$") or basename:find("%.tar%.gz$") or basename:find("%.tgz$")
local target = temporary_path
if is_archive or basename:find("%.gz$") then
- log_action("Extracting file " .. basename .. " in " .. install_path)
+ if VERBOSE then log_action("Extracting file " .. basename .. " in " .. install_path .. "...") end
target = temporary_install_path .. (not is_archive and (PATHSEP .. basename:gsub(".gz$", "")) or "")
system.extract(temporary_path, target)
os.remove(temporary_path)
end
if not is_archive and file.arch and file.arch ~= "*" then system.chmod(target, 448) end -- chmod any ARCH tagged file to rwx-------
end
+ if file.extra and file.extra.chmod_executable then
+ for _, executable in ipairs(file.extra.chmod_executable) do
+ local path = common.dirname(temporary_path) .. PATHSEP .. executable:gsub("/", PATHSEP):gsub("^" .. PATHSEP, "")
+ if path:find(PATHSEP .. "%.%.") then error("invalid chmod_executable value " .. executable) end
+ local stat = system.stat(path)
+ if not stat then error("can't find executable to chmod_executable " .. path) end
+ if VERBOSE then log_action("Chmodding file " .. executable .. " to be executable.") end
+ system.chmod(path, stat.mode | 73)
+ end
+ end
end
end
end