Skip to content

Instantly share code, notes, and snippets.

@activescott
Created February 24, 2024 04:21
Show Gist options
  • Save activescott/3295ebb838eb044b0b59688b0d7e9118 to your computer and use it in GitHub Desktop.
Save activescott/3295ebb838eb044b0b59688b0d7e9118 to your computer and use it in GitHub Desktop.
rocket-pool/smartnode-install scripts
#!/usr/bin/env bash
THISDIR=$(cd $(dirname "$0"); pwd) #this script's directory
do_sync() {
source=$1
dest=$2
if [[ ! -e "$source" ]]; then
echo "source does not exist: $source"
return
fi
if [[ ! -e "$dest" ]]; then
echo "dest does not exist: $dest"
return
fi
echo ""
echo "===== diff of '$source' <-> '$dest' ====="
diff -ry --color --suppress-common-lines "$source" "$dest"
different=$?
if [[ $different == 0 ]]; then
echo "No difference"
return
fi
echo ""
read -p "Do you want to deploy the $source -> $dest ? (y/n) " answer
if [[ $answer == "y" ]]; then
rsync -vv -a "$source" "$dest"
fi
}
# A trailing slash on the source changes this behavior to avoid creating an additional directory level at the destination. You
# can think of a trailing / on a source as meaning "copy the contents of this directory" as opposed to "copy the directory by
# name", but in both cases the attributes of the containing directory are transferred to the containing directory on the destination.
do_sync $THISDIR/install/alerting/ ~/.rocketpool/alerting
do_sync $THISDIR/install/templates/ ~/.rocketpool/templates
do_sync $THISDIR/install/prometheus.tmpl ~/.rocketpool/prometheus.tmpl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment