diff options
-rwxr-xr-x | PolygLua.lua | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/PolygLua.lua b/PolygLua.lua index 8d63d8a..34f7f39 100755 --- a/PolygLua.lua +++ b/PolygLua.lua | |||
@@ -312,4 +312,29 @@ _G.__ = function(c) | |||
312 | end | 312 | end |
313 | 313 | ||
314 | 314 | ||
315 | |||
316 | if arg[0] == './PolygLua.lua' then | ||
317 | local w = __[[whoami]]:noErr():Do().lines[1] | ||
318 | local d = __[[pwd]]:noErr():Do().lines[1] | ||
319 | local luas = __'ls -d1 /usr/share/lua/*':noErr():Do() | ||
320 | for i,l in ipairs(luas.lines) do | ||
321 | local lua = '/usr/local/share/lua/' .. l:sub(16) .. '/PolygLua.lua' | ||
322 | if _.exists(lua) then | ||
323 | print(lua .. ' installed') | ||
324 | else | ||
325 | if 'root' == w then | ||
326 | __('mkdir -p /usr/local/share/lua/' .. l:sub(16) .. ' ; ln -s ' .. d .. '/PolygLua.lua ' .. lua):Do() | ||
327 | else | ||
328 | print(lua .. ' NOT installed') | ||
329 | end | ||
330 | end | ||
331 | end | ||
332 | |||
333 | if 'root' ~= w then | ||
334 | E'Need to be root user to install.' | ||
335 | end | ||
336 | end | ||
337 | |||
338 | |||
339 | |||
315 | return _ | 340 | return _ |