diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2013-11-12 18:47:53 -0200 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2013-11-12 18:47:53 -0200 |
commit | e05effd09a8e2df4e7cff301392fba0933c5eed7 (patch) | |
tree | 6b61fc3bc65e58af94d8ccf62bf3e7e275a22f2e | |
parent | d3a64208df1fa5ae870df437d95c950a159093b9 (diff) | |
download | luarocks-e05effd09a8e2df4e7cff301392fba0933c5eed7.tar.gz luarocks-e05effd09a8e2df4e7cff301392fba0933c5eed7.tar.bz2 luarocks-e05effd09a8e2df4e7cff301392fba0933c5eed7.zip |
Allow the wrapper scripts to keep working even if LuaRocks is uninstalled
(or if one is building them to run in another box without LuaRocks,
for example, in cross-compiling scenarios).
Diffstat (limited to '')
-rw-r--r-- | src/luarocks/fs/unix.lua | 4 | ||||
-rw-r--r-- | src/luarocks/fs/win32.lua | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/luarocks/fs/unix.lua b/src/luarocks/fs/unix.lua index 9dc3b6a6..d231222b 100644 --- a/src/luarocks/fs/unix.lua +++ b/src/luarocks/fs/unix.lua | |||
@@ -61,8 +61,8 @@ function wrap_script(file, dest, name, version) | |||
61 | wrapper:write("#!/bin/sh\n\n") | 61 | wrapper:write("#!/bin/sh\n\n") |
62 | local lua = dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter) | 62 | local lua = dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter) |
63 | local ppaths = "package.path="..util.LQ(lpath..";").."..package.path; package.cpath="..util.LQ(lcpath..";").."..package.cpath" | 63 | local ppaths = "package.path="..util.LQ(lpath..";").."..package.path; package.cpath="..util.LQ(lcpath..";").."..package.cpath" |
64 | local addctx = "luarocks.loader.add_context("..util.LQ(name)..","..util.LQ(version)..")" | 64 | local addctx = "local k,l,_=pcall(require,"..util.LQ("luarocks.loader")..") _=k and l.add_context("..util.LQ(name)..","..util.LQ(version)..")" |
65 | wrapper:write('exec '..fs.Q(lua)..' -e '..fs.Q(ppaths)..' -lluarocks.loader -e '..fs.Q(addctx)..' '..fs.Q(file)..' "$@"\n') | 65 | wrapper:write('exec '..fs.Q(lua)..' -e '..fs.Q(ppaths)..' -e '..fs.Q(addctx)..' '..fs.Q(file)..' "$@"\n') |
66 | wrapper:close() | 66 | wrapper:close() |
67 | if fs.chmod(wrapname, "0755") then | 67 | if fs.chmod(wrapname, "0755") then |
68 | return true | 68 | return true |
diff --git a/src/luarocks/fs/win32.lua b/src/luarocks/fs/win32.lua index 78a9f730..0280b3f0 100644 --- a/src/luarocks/fs/win32.lua +++ b/src/luarocks/fs/win32.lua | |||
@@ -113,8 +113,8 @@ function wrap_script(file, dest, name, version) | |||
113 | wrapper:write("@echo off\n") | 113 | wrapper:write("@echo off\n") |
114 | local lua = dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter) | 114 | local lua = dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter) |
115 | local ppaths = "package.path="..util.LQ(lpath..";").."..package.path; package.cpath="..util.LQ(lcpath..";").."..package.cpath" | 115 | local ppaths = "package.path="..util.LQ(lpath..";").."..package.path; package.cpath="..util.LQ(lcpath..";").."..package.cpath" |
116 | local addctx = "luarocks.loader.add_context("..util.LQ(name)..","..util.LQ(version)..")" | 116 | local addctx = "local k,l,_=pcall(require,"..util.LQ("luarocks.loader")..") _=k and l.add_context("..util.LQ(name)..","..util.LQ(version)..")" |
117 | wrapper:write(fs.Qb(lua)..' -e '..fs.Qb(ppaths)..' -lluarocks.loader -e '..fs.Qb(addctx)..' '..fs.Qb(file)..' %*\n') | 117 | wrapper:write(fs.Qb(lua)..' -e '..fs.Qb(ppaths)..' -e '..fs.Qb(addctx)..' '..fs.Qb(file)..' %*\n') |
118 | wrapper:close() | 118 | wrapper:close() |
119 | return true | 119 | return true |
120 | end | 120 | end |