aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2018-05-24 16:43:54 -0300
committerHisham Muhammad <hisham@gobolinux.org>2018-05-31 11:16:09 -0300
commit9c48355ef7f5ed44cb1a6530c36f74732025520d (patch)
tree2f71b871146a5bc79ba88f465d86154744390f60
parent9cc9cfebf29498899952690b7483cf1573866368 (diff)
downloadluarocks-9c48355ef7f5ed44cb1a6530c36f74732025520d.tar.gz
luarocks-9c48355ef7f5ed44cb1a6530c36f74732025520d.tar.bz2
luarocks-9c48355ef7f5ed44cb1a6530c36f74732025520d.zip
init: only create wrappers if they don't already exist
-rw-r--r--src/luarocks/cmd/init.lua18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/luarocks/cmd/init.lua b/src/luarocks/cmd/init.lua
index e037fb55..5c0116ce 100644
--- a/src/luarocks/cmd/init.lua
+++ b/src/luarocks/cmd/init.lua
@@ -77,14 +77,20 @@ function init.command(flags, name, version)
77 fs.make_dir("lua_modules/lib/luarocks/rocks-" .. cfg.lua_version) 77 fs.make_dir("lua_modules/lib/luarocks/rocks-" .. cfg.lua_version)
78 local tree = dir.path(pwd, "lua_modules") 78 local tree = dir.path(pwd, "lua_modules")
79 79
80 util.printout("Preparing ./luarocks ...") 80 local ext = cfg.wrapper_suffix
81 81
82 fs.wrap_script(arg[0], "luarocks", nil, nil, "--project-tree", tree) 82 local luarocks_wrapper = "./luarocks" .. ext
83 83 if not fs.exists(luarocks_wrapper) then
84 util.printout("Preparing ./lua ...") 84 util.printout("Preparing " .. luarocks_wrapper .. " ...")
85 fs.wrap_script(arg[0], "luarocks", nil, nil, "--project-tree", tree)
86 end
85 87
86 path.use_tree(tree) 88 local lua_wrapper = "./lua" .. ext
87 fs.wrap_script(nil, "lua") 89 if not fs.exists(lua_wrapper) then
90 util.printout("Preparing " .. lua_wrapper .. " ...")
91 path.use_tree(tree)
92 fs.wrap_script(nil, "lua")
93 end
88 94
89 return true 95 return true
90end 96end