feat: a3 (fr this time)

This commit is contained in:
Strix 2024-06-06 02:17:54 +02:00
parent 4be03b9764
commit b3ec7ee32f
3 changed files with 24 additions and 9 deletions

18
bin/sc
View file

@ -23,23 +23,23 @@ for host in $SC_HOSTS; do
case $command in
install)
if [ "$host" = "local" ]; then
escalate_command cp -r $SC_SRC/. /opt/sconnect
escalate_command install -m a+rx -o root /opt/sconnect/bin/sc /usr/bin
escalate_command install -m a+rx -o root /opt/sconnect/bin/sc-client /usr/bin
escalate_command a3 ./meta.a3 install
else
LOGI "attempting to install on $host..."
rsync -au $SC_SRC/. $host:/opt/sconnect
ssh $host SC_SKIP_WELCOME_HEADER=1 SC_INCLUDE_LIBS="privileges" /opt/sconnect/bin/sc-client eval escalate_command install -m a+rx -o root /opt/sconnect/bin/sc /usr/bin
ssh $host SC_SKIP_WELCOME_HEADER=1 SC_INCLUDE_LIBS="privileges" /opt/sconnect/bin/sc-client eval escalate_command install -m a+rx -o root /opt/sconnect/bin/sc-client /usr/bin
if ! ssh $host "command -v a3"; then
LOGI "no a3, installing..."
ssh -t $host "git clone https://git.saluco.nl/strix/aaa /tmp/a3 && cd /tmp/a3 && sudo A3_LIB=./lib bin/a3 ./meta.a3 install; rm -rf /tmp/a3"
fi
ssh $host "git clone https://git.saluco.nl/strix/sconnect /tmp/sconnect && cd /tmp/sconnect && sudo a3 /tmp/sconnect/main.a3 install; rm -rf /tmp/sconnect"
LOGI "installed"
fi
;;
*)
if [ "$host" = "local" ]; then
$SC_SRC/bin/sc-client $command $@
sc-client $command $@
else
ssh -t $host SC_SKIP_WELCOME_HEADER=1 /opt/sconnect/bin/sc-client check 2>/dev/null || fatal_log not installed
ssh -t $host /opt/sconnect/bin/sc-client $command $@
ssh -t $host SC_SKIP_WELCOME_HEADER=1 sc-client check 2>/dev/null || fatal_log not installed
ssh -t $host sc-client $command $@
fi
;;
esac

View file

@ -0,0 +1,6 @@
_
___ __ _| |_ _ ___ ___
/ __|/ _` | | | | |/ __/ _ \
\__ \ (_| | | |_| | (_| (_) |
|___/\__,_|_|\__,_|\___\___/

9
meta.a3 Normal file
View file

@ -0,0 +1,9 @@
#!/bin/a3
#a3.name: sc
#a3.url: https://git.saluco.nl/strix/sconnect
#a3.author: Strix
declare_executable ./bin/sc
declare_executable ./bin/sc-client
declare_library ./lib