aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xPolygLua.lua104
-rwxr-xr-xaataaj.lua47
2 files changed, 127 insertions, 24 deletions
diff --git a/PolygLua.lua b/PolygLua.lua
index bd7bd4d..86dc8be 100755
--- a/PolygLua.lua
+++ b/PolygLua.lua
@@ -313,27 +313,93 @@ end
313 313
314 314
315 315
316if arg[0] == './PolygLua.lua' then 316_.who = __[[whoami]]:noErr():Do().lines[1]
317 local w = __[[whoami]]:noErr():Do().lines[1] 317_.dir = __[[pwd]]:noErr():Do().lines[1]
318 local d = __[[pwd]]:noErr():Do().lines[1] 318
319 local luas = __'ls -d1 /usr/share/lua/*':noErr():Do() 319
320 for i,l in ipairs(luas.lines) do 320
321 local lua = '/usr/local/share/lua/' .. l:sub(16) .. '/PolygLua.lua' 321if (arg[0] == './PolygLua.lua') or (arg[0] == 'PolygLua.lua') then
322 if _.exists(lua) then 322 local options =
323 print(lua .. ' installed') 323 {
324 else 324 install =
325 if 'root' == w then 325 {
326 print('Installing ' .. lua) 326 help = 'Command to install PolygLua.lua',
327 __('mkdir -p /usr/local/share/lua/' .. l:sub(16) .. ' ; ln -s ' .. d .. '/PolygLua.lua ' .. lua):Do() 327 func = function(self, options, a, args, i)
328 else 328 if 'root' ~= _.who then
329 print(lua .. ' NOT installed') 329 E'Need to be root user to install.'
330 else
331 print('INSTALLING PolygLua.lua!!!')
332
333 local luas = __'ls -d1 /usr/share/lua/*':noErr():Do()
334 for i,l in ipairs(luas.lines) do
335 local lua = '/usr/local/share/lua/' .. l:sub(16) .. '/PolygLua.lua'
336 if _.exists(lua) then
337 print(lua .. ' installed')
338 else
339 if 'root' == _.who then
340 print('Installing ' .. lua)
341 __('mkdir -p /usr/local/share/lua/' .. l:sub(16) .. ' ; ln -s ' .. _.dir .. '/PolygLua.lua ' .. lua):Do()
342 else
343 print(lua .. ' NOT installed')
344 end
345 end
346 end
347
348 end
349-- os.exit(0)
330 end 350 end
331 end 351 },
332 end 352 uninstall =
353 {
354 help = 'Command to uninstall PolygLua.lua',
355 func = function(self, options, a, args, i)
356 if 'root' ~= _.who then
357 E'Need to be root user to uninstall.'
358 else
359 print('UNINSTALLING PolygLua.lua!!!')
360
361 local luas = __'ls -d1 /usr/share/lua/*':noErr():Do()
362 for i,l in ipairs(luas.lines) do
363 local lua = '/usr/local/share/lua/' .. l:sub(16) .. '/PolygLua.lua'
364 if _.exists(lua) then
365 if 'root' == _.who then
366 print('Uninstalling ' .. lua)
367 __('rm ' .. lua):Do()
368 end
369 end
370 end
333 371
334 if 'root' ~= w then 372 end
335 E'Need to be root user to install.' 373-- os.exit(0)
336 end 374 end
375 },
376 purge =
377 {
378 help = 'Command to purge PolygLua.lua',
379 func = function(self, options, a, args, i)
380 if 'root' ~= _.who then
381 E'Need to be root user to purge.'
382 else
383 print('PURGING PolygLua.lua!!!')
384
385 local luas = __'ls -d1 /usr/share/lua/*':noErr():Do()
386 for i,l in ipairs(luas.lines) do
387 local lua = '/usr/local/share/lua/' .. l:sub(16) .. '/PolygLua.lua'
388 if _.exists(lua) then
389 if 'root' == _.who then
390 print('Purging ' .. lua)
391 __('rm ' .. lua):Do()
392 end
393 end
394 end
395
396 end
397-- os.exit(0)
398 end
399 },
400 }
401
402 _.parse(arg, options)
337end 403end
338 404
339 405
diff --git a/aataaj.lua b/aataaj.lua
index 611059d..2a1f7e3 100755
--- a/aataaj.lua
+++ b/aataaj.lua
@@ -125,15 +125,13 @@ local options =
125 { 125 {
126 help = 'Command to install aataaj.lua', 126 help = 'Command to install aataaj.lua',
127 func = function(self, options, a, args, i) 127 func = function(self, options, a, args, i)
128 local w = __[[whoami]]:noErr():Do().lines[1] 128 if 'root' ~= _.who then
129 local d = __[[pwd]]:noErr():Do().lines[1]
130 if 'root' ~= w then
131 E'Need to be root user to install.' 129 E'Need to be root user to install.'
132 else 130 else
133 print('INSTALLING!!!') 131 print('INSTALLING!!!')
134 __[[#!/bin/bash 132 __[[#!/bin/bash
135 echo "Installing PolygLua" 133 echo "Installing aataaj"
136 ./PolygLua.lua -vvvv 134 ./PolygLua.lua -vvvv install
137 ln -s `pwd`/aataaj.lua /usr/local/bin/aataaj.lua 135 ln -s `pwd`/aataaj.lua /usr/local/bin/aataaj.lua
138 ln -s /usr/local/bin/aataaj.lua /etc/init.d/aataaj.lua 136 ln -s /usr/local/bin/aataaj.lua /etc/init.d/aataaj.lua
139 update-rc.d aataaj.lua defaults 137 update-rc.d aataaj.lua defaults
@@ -142,6 +140,45 @@ local options =
142 os.exit(0) 140 os.exit(0)
143 end 141 end
144 }, 142 },
143 uninstall =
144 {
145 help = 'Command to uninstall aataaj.lua',
146 func = function(self, options, a, args, i)
147 if 'root' ~= _.who then
148 E'Need to be root user to uninstall.'
149 else
150 print('UNINSTALLING!!!')
151 __[[#!/bin/bash
152 echo "Uninstalling aataaj"
153 update-rc.d aataaj.lua remove
154 rm /etc/init.d/aataaj.lua
155 rm /usr/local/bin/aataaj.lua
156 ./PolygLua.lua -vvvv uninstall
157 ]]:log():show():Do()
158 end
159 os.exit(0)
160 end
161 },
162 uninstall =
163 {
164 help = 'Command to purge aataaj.lua',
165 func = function(self, options, a, args, i)
166 if 'root' ~= _.who then
167 E'Need to be root user to purge.'
168 else
169 print('UNINSTALLING!!!')
170 __[[#!/bin/bash
171 echo "Uninstalling aataaj"
172 update-rc.d aataaj.lua remove
173 rm /etc/init.d/aataaj.lua
174 rm /usr/local/bin/aataaj.lua
175 ./PolygLua.lua -vvvv uninstall
176 rm -fr /var/lib/aataaj
177 ]]:log():show():Do()
178 end
179 os.exit(0)
180 end
181 },
145} 182}
146 183
147_.parse(arg, options, 'aataaj') 184_.parse(arg, options, 'aataaj')