diff --git a/bin/sc b/bin/sc index c0062a3..71bbe8d 100755 --- a/bin/sc +++ b/bin/sc @@ -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 diff --git a/lib/assets/saluco-header.txt b/lib/assets/saluco-header.txt new file mode 100644 index 0000000..6bd2b62 --- /dev/null +++ b/lib/assets/saluco-header.txt @@ -0,0 +1,6 @@ + _ + ___ __ _| |_ _ ___ ___ + / __|/ _` | | | | |/ __/ _ \ + \__ \ (_| | | |_| | (_| (_) | + |___/\__,_|_|\__,_|\___\___/ + diff --git a/meta.a3 b/meta.a3 new file mode 100644 index 0000000..d72dc17 --- /dev/null +++ b/meta.a3 @@ -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 \ No newline at end of file