From 1e77a7b9e58e62654ca800f05b31c7467116c4bc Mon Sep 17 00:00:00 2001 From: dvs1 Date: Mon, 4 Nov 2024 12:32:17 +1000 Subject: Add uninstall and purge subcommands for PolygLua and aataaj. --- aataaj.lua | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) (limited to 'aataaj.lua') diff --git a/aataaj.lua b/aataaj.lua index 611059d..2a1f7e3 100755 --- a/aataaj.lua +++ b/aataaj.lua @@ -125,15 +125,13 @@ local options = { help = 'Command to install aataaj.lua', func = function(self, options, a, args, i) - local w = __[[whoami]]:noErr():Do().lines[1] - local d = __[[pwd]]:noErr():Do().lines[1] - if 'root' ~= w then + if 'root' ~= _.who then E'Need to be root user to install.' else print('INSTALLING!!!') __[[#!/bin/bash - echo "Installing PolygLua" - ./PolygLua.lua -vvvv + echo "Installing aataaj" + ./PolygLua.lua -vvvv install ln -s `pwd`/aataaj.lua /usr/local/bin/aataaj.lua ln -s /usr/local/bin/aataaj.lua /etc/init.d/aataaj.lua update-rc.d aataaj.lua defaults @@ -142,6 +140,45 @@ local options = os.exit(0) end }, + uninstall = + { + help = 'Command to uninstall aataaj.lua', + func = function(self, options, a, args, i) + if 'root' ~= _.who then + E'Need to be root user to uninstall.' + else + print('UNINSTALLING!!!') + __[[#!/bin/bash + echo "Uninstalling aataaj" + update-rc.d aataaj.lua remove + rm /etc/init.d/aataaj.lua + rm /usr/local/bin/aataaj.lua + ./PolygLua.lua -vvvv uninstall + ]]:log():show():Do() + end + os.exit(0) + end + }, + uninstall = + { + help = 'Command to purge aataaj.lua', + func = function(self, options, a, args, i) + if 'root' ~= _.who then + E'Need to be root user to purge.' + else + print('UNINSTALLING!!!') + __[[#!/bin/bash + echo "Uninstalling aataaj" + update-rc.d aataaj.lua remove + rm /etc/init.d/aataaj.lua + rm /usr/local/bin/aataaj.lua + ./PolygLua.lua -vvvv uninstall + rm -fr /var/lib/aataaj + ]]:log():show():Do() + end + os.exit(0) + end + }, } _.parse(arg, options, 'aataaj') -- cgit v1.1