From 0c4e8c635d9a25712d65af9b6dcf6fbad4a72b05 Mon Sep 17 00:00:00 2001 From: dvs1 Date: Mon, 21 Oct 2024 18:55:20 +1000 Subject: Restructure the APT.exe stuff. --- test_.lua | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100755 test_.lua (limited to 'test_.lua') diff --git a/test_.lua b/test_.lua new file mode 100755 index 0000000..4d0e723 --- /dev/null +++ b/test_.lua @@ -0,0 +1,122 @@ +#!/usr/bin/env luajit + + +local _ = require '_' +local D = _.D +local I = _.I +local T = _.T +local W = _.W +local E = _.E +local C = _.C +local __ = _._ + + +D('Starting from the top.') + +local Help = [[ +This is part of the blah blah blah... +]] + + + +local args = {...} +if 0 ~= #args then +-- for i,a in pairs(args) do +-- print('Argument ' .. i .. ' = ' .. a) +-- end + + if 'start' == args[1] then + elseif 'stop' == args[1] then +--[=[ + _.killEmAll{'qsynth'} + __[[ +a2j_control --stop +sleep 2 +a2j_control --exit +sleep 2 +]]:Do() + _.killEmAll{'alsa_in', 'alsa_out', 'zita-a2j', 'zita-j2a', 'aseqjoy', 'jack-plumbing'} + __[[ +sleep 2 +jack_control stop +sleep 2 +jack_control exit +sleep 2 +]]:Do() + _.killEmAll{'jmcore', 'qjackctl'} + -- Catia is python, and no easy way to kill it. + -- Also it keeps jackdbus alive, no matter how hard you kill it. + __"pkill -TERM -u $USER -f catia":Do() + __"sleep 2":Do() + _.killEmAll{'jackdbus', 'a2jmidid'} +]=] + return(0) + elseif 'JACK' == args[1] then + elseif 'restart' == args[1] then args[1] = 'start' + elseif 'force-reload' == args[1] then args[1] = 'start' + elseif 'status' == args[1] then + return(0) + elseif 'help' == args[1] then + print(Help) + return(0) + elseif '--help' == args[1] then + print(Help) + return(0) + else + print("Usage: /etc/init.d/aataaj.lua {start|stop|restart|force-reload|status}") + return(1) + end +else + print("Usage: /etc/init.d/aataaj.lua {help|start|stop|restart|force-reload|status|JACK}") + return(1) +end + + + + +-- CHANGE these to suit. +local asoundrcPath = '/var/lib/aataaj' +local asoundrc = 'asoundrc' +local GUI = 'qjackctl' +if _.exists'catia' then GUI = 'catia' end +local alias = { + {name='Screen', dev='HDMI9'}, + } + +local speaker = 'espeak' +if _.exists'espeak-ng' then speaker = 'espeak-ng' end + + +for i,l in ipairs(__'df -h':log():Do().lines) do + print(l) +end +print('') + +__'df -h':log():also'free -h':show():Do() +print('') + +for i,l in ipairs(__'df -h\nfree -h':log():Do().lines) do + print(l) +end +print('') + +__[[ + df -h + free -h +]]:log():show():Do() +print('') + +for i,l in ipairs(__{'df -h', 'free -h'}:log():Do().lines) do + print(l) +end +print('') + +print('' .. GUI) +print('') + +print(__'true':log():show():Do().status) +print(__'false':log():show():Do().status) +print(__'exit 42':log():show():Do().status) +print(__'return 42':log():show():Do().status) +print(__'command NoSuchCommand':log():show():Do().status) + -- cgit v1.1