From b3e3ad2eef3fbe1e78f02173ae8fb0d970c1728e Mon Sep 17 00:00:00 2001 From: dvs1 Date: Sun, 3 Nov 2024 22:43:06 +1000 Subject: PolygLua.lua installs itself. --- PolygLua.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'PolygLua.lua') 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) end + +if arg[0] == './PolygLua.lua' then + local w = __[[whoami]]:noErr():Do().lines[1] + local d = __[[pwd]]:noErr():Do().lines[1] + local luas = __'ls -d1 /usr/share/lua/*':noErr():Do() + for i,l in ipairs(luas.lines) do + local lua = '/usr/local/share/lua/' .. l:sub(16) .. '/PolygLua.lua' + if _.exists(lua) then + print(lua .. ' installed') + else + if 'root' == w then + __('mkdir -p /usr/local/share/lua/' .. l:sub(16) .. ' ; ln -s ' .. d .. '/PolygLua.lua ' .. lua):Do() + else + print(lua .. ' NOT installed') + end + end + end + + if 'root' ~= w then + E'Need to be root user to install.' + end +end + + + return _ -- cgit v1.1