From fcfbbdc0de8e06c0b68156243afad8f88e75720b Mon Sep 17 00:00:00 2001 From: dvs1 Date: Mon, 4 Nov 2024 15:24:59 +1000 Subject: Refactor PolygLua.lua uninstall / purge. --- PolygLua.lua | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/PolygLua.lua b/PolygLua.lua index 7fad2d3..38e300c 100755 --- a/PolygLua.lua +++ b/PolygLua.lua @@ -319,6 +319,19 @@ _.dir = __[[pwd]]:noErr():Do().lines[1] if (arg[0] == './PolygLua.lua') or (arg[0] == 'PolygLua.lua') then + local goAway(txt) + 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 + if 'root' == _.who then + print(txt .. ' ' .. lua) + __('rm ' .. lua):Do() + end + end + end + end + local options = { install = @@ -356,18 +369,7 @@ if (arg[0] == './PolygLua.lua') or (arg[0] == 'PolygLua.lua') then E'Need to be root user to uninstall.' else print('UNINSTALLING PolygLua.lua!!!') - - 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 - if 'root' == _.who then - print('Uninstalling ' .. lua) - __('rm ' .. lua):Do() - end - end - end - + goAway('Uninstalling') end end }, @@ -379,18 +381,7 @@ if (arg[0] == './PolygLua.lua') or (arg[0] == 'PolygLua.lua') then E'Need to be root user to purge.' else print('PURGING PolygLua.lua!!!') - - 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 - if 'root' == _.who then - print('Purging ' .. lua) - __('rm ' .. lua):Do() - end - end - end - + goAway('Purging') end end }, -- cgit v1.1