merge
This commit is contained in:
28
alpine/dpush
Normal file
28
alpine/dpush
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "Usage: $0 <local_file> <remote_absolute_path>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOCAL_FILE="$1"
|
||||
REMOTE_PATH="$2"
|
||||
|
||||
hosts_file="/mnt/encrypted_volume/${HOSTS_FILE:-hosts.txt}"
|
||||
|
||||
if [ ! -f "$LOCAL_FILE" ]; then
|
||||
echo "Error: Local file '$LOCAL_FILE' not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "$hosts_file" ]; then
|
||||
echo "Error: Hosts file '$hosts_file' not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Push the file content using tee with doas
|
||||
echo "Pushing $LOCAL_FILE to $REMOTE_PATH on all hosts in $hosts_file"
|
||||
pssh -h "$hosts_file" -l "$USER" -i "doas tee \"$REMOTE_PATH\" > /dev/null" < "$LOCAL_FILE"
|
||||
|
||||
Reference in New Issue
Block a user