generated from me/template-mit
33 lines
569 B
Bash
Executable File
33 lines
569 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# TBD:
|
|
# - ensure all SERVER_* variables actually exist in environment
|
|
# - test the script :)
|
|
# - add parameter to set loop=true
|
|
|
|
## Variables ##
|
|
|
|
DIR="$(dirname -- "${BASH_SOURCE[0]}")"
|
|
loop=false
|
|
|
|
## Validations ##
|
|
|
|
if [[ "$DIR" != *"MASTER" ]]; then
|
|
echo "This directory is not labeled as a MASTER. Skipping upload."
|
|
exit 0
|
|
fi
|
|
|
|
## Main ##
|
|
|
|
new_dir="`basename $DIR`"
|
|
new_dir="${new_dir//MASTER/clone}"
|
|
|
|
do
|
|
clone -e "ssh -p $SERVER_PORT" ./ $SERVER_USER@$SERVER_NAME:$SERVER_SFTP/$new_dir
|
|
while $loop
|
|
|
|
## Complete ##
|
|
|
|
echo "Done!"
|
|
exit 0
|