add install and scp-to-all-nodes

This commit is contained in:
kayos@tcp.direct 2022-10-18 23:42:25 -07:00
parent 6f8dada9e0
commit 3de332c1c3
Signed by: kayos
GPG Key ID: 4B841471B4BEE979
4 changed files with 64 additions and 1 deletions

@ -1,6 +1,17 @@
#!/usr/bin/env bash
set -e
source lib.sh
_dir="$( dirname -- "$0" )/.."
_lib="$_dir/lib.sh"
_var="$_dir/var.sh"
source "$_lib"
source "$_var"
if ! $_goahead; then
echo -n "failed to load libs and vars"
exit
fi
echo "preparing to run $* on all nodes"

32
bin/scp-to-all-nodes.sh Executable file

@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -e
source lib.sh
_targetFile="$1"
if ! [[ -f "$_targetFile" ]]; then
echo -n "file not found: $1"
exit 1
fi
echo "preparing to copy $1 to all nodes"
_targetDir=":"
if [[ -z "$2" ]]; then
_targetDir+="~"
else
_targetDir+="$2"
fi
echo -n "target directory: '"
echo -n "$_targetDir" | tr -d ':'
echo "'"
get-targets | while read -r line; do
if ! ignore "$line"; then
echo "copying to $line"
scp "$_targetFile" "$line$_targetDir"
fi
done

14
install.sh Executable file

@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -e
source var.sh
echo "H4sIAAAAAAACA8VXQW6DMBC88wUueUGFVASq+hTekD9UqEcONHWRD/lH730KL6nB1PaudxebpG1EJEPWszPeYe0UZffUPtfVeVbDPL3O6sVe5nFjH293tb+b1Vh21Xn5nqjpwdyye2zdEGLswhAsHBjGC5Fs0Ml80llG1CzmBsXgAHbHtWQsbjLGP9aIF1OdC4+hiEjL4+vT/TS9L8m2AE0w6clJ5mH9wxRT8r+JqJ4AgIsWyKvn+Pep1uyhAofFa6GTKkVXDamCzNiggfJahmS5UiE+dt7f1fs2L662dpX1UP08XZbLk0Z1b6Ilj+PZKTG/y1p51Nd8w9QwjV+XfYPirA8BFMAJV0FQl6ynz9feomInJYdB7CqOdyvkAbsINntbLtZmUtxO6AB3RPgy6V3fyAyJluPCRAyUlUCwvEd4qwnYa6RU37yKB2rE1tYMq3X4MZqLe9dilnhesDWE1QzeljEHBokXDkj1sQRKOqJsQx1MBjuATslEdb8M3QFV0B8CRnDNKfnXXy5TGswdfMf5VxG7r+RbhfoNdxrA4VrwY8Ps8Tonv9ehyX8FwLZMj5RYB2cR4pSXSJU8o+UqZfp6fk2NJ4pvKJ0ylF4OAAA=" | base64 -d | gzip -d
mkdir -p "$_pxdir"
mkdir -p "$_pxbin"
cp ./bin/* "$_pxbin/"
cp ./*.sh "$_pxdir"
date +%s >> "$_pxdir/.installed"
echo "export PATH=\"$_pxbin:$PATH\"" >> "$HOME/.bashrc"
echo "install successful, please run 'source $HOME/.bashrc'"

6
var.sh Normal file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
_pxdir="$HOME/.local/proxmox-scripts"
_pxbin="$_pxdir/bin"
_lib="$_pxdir/lib.sh"
_var="$_pxdir/var.sh"