Compare commits
No commits in common. "5202a8715e10aac87e95b34f0b61c98476507a8d" and "2f9d4529d326a1e23afa743e382a5e2cf1800116" have entirely different histories.
5202a8715e
...
2f9d4529d3
2 changed files with 1 additions and 81 deletions
|
@ -324,9 +324,6 @@ in
|
||||||
hostname = "vpn-whq.services.fcio.net";
|
hostname = "vpn-whq.services.fcio.net";
|
||||||
extraOptions.LogLevel = "Verbose";
|
extraOptions.LogLevel = "Verbose";
|
||||||
};
|
};
|
||||||
"fcio-rzob-jump" = {
|
|
||||||
hostname = "vpn-rzob.services.fcio.net";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -453,8 +450,7 @@ in
|
||||||
binpath() {
|
binpath() {
|
||||||
realpath $(${pkgs.which}/bin/which $1)
|
realpath $(${pkgs.which}/bin/which $1)
|
||||||
}
|
}
|
||||||
''
|
'';
|
||||||
+ builtins.readFile ./scripts/reporsync.sh;
|
|
||||||
|
|
||||||
|
|
||||||
oh-my-zsh = {
|
oh-my-zsh = {
|
||||||
|
|
|
@ -1,76 +0,0 @@
|
||||||
# rsync -rlptzv --progress --delete --exclude=.git --exclude=.vscode --exclude=result --exclude=channels/ /Users/os/src/fc.qemu os@hydra01:
|
|
||||||
# rsync -rlptzv --progress --rsh="ssh -J fcio-whq-jump" --delete --exclude=.git --exclude=.vscode --exclude=result --exclude=channels/ /Users/os/src/fc-nixos/ os@patty:fc-nixos/
|
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_JUMPHOST="fcio-whq-jump"
|
|
||||||
|
|
||||||
_parse_rsync_args() {
|
|
||||||
# reset pre-defined variables that are read and manipulated throughout this function
|
|
||||||
unset JUMPHOST
|
|
||||||
# arrays are bash or zsh specific
|
|
||||||
RSYNC_OPTS=("-rlptzv" "--progress" "--delete" "--exclude=.git" "--exclude=.vscode" "--exclude=result" "--exclude=channels/")
|
|
||||||
|
|
||||||
while getopts ':Jj:' OPT; do
|
|
||||||
case $OPT in
|
|
||||||
j)
|
|
||||||
if [ -n "$JUMPHOST" ]; then
|
|
||||||
echo "-j and -J are conflicting arguments" >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
JUMPHOST="$OPTARG"
|
|
||||||
;;
|
|
||||||
J)
|
|
||||||
if [ -n "$JUMPHOST" ]; then
|
|
||||||
echo "-j and -J are conflicting arguments" >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
JUMPHOST="$DEFAULT_JUMPHOST"
|
|
||||||
;;
|
|
||||||
?)
|
|
||||||
echo "rsyncrepo [-J] [-j <jumphost>] <directory> <hostname>"
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# trim CLI parameters
|
|
||||||
shift "(($OPTIND -1))"
|
|
||||||
|
|
||||||
RR_FROM="$1"
|
|
||||||
RR_TO="$2"
|
|
||||||
}
|
|
||||||
|
|
||||||
_do_rsync() {
|
|
||||||
# parameter check
|
|
||||||
if [ -z "$1" ] || [ -z "$2" ]; then
|
|
||||||
echo "Missing arguments, required: <directory> <hostname>" >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$JUMPHOST" ]; then
|
|
||||||
RSYNC_OPTS+=("--rsh=/Users/os/.nix-profile/bin/ssh -J ${JUMPHOST}")
|
|
||||||
fi
|
|
||||||
|
|
||||||
for OPTI in "${RSYNC_OPTS[@]}"; do
|
|
||||||
echo "$OPTI"
|
|
||||||
done
|
|
||||||
|
|
||||||
# we always sync /path/to/dir/ to hostname:dir
|
|
||||||
RR_DEST="${2}:$(basename "${1}")"
|
|
||||||
|
|
||||||
echo "Syncing ${1} to ${DEST}…"
|
|
||||||
|
|
||||||
# ensure trailing slash for src to avoid recreating directory
|
|
||||||
${pkgs.rsync} "${RSYNC_OPTS[@]}" "${1}/" "$RR_DEST"
|
|
||||||
}
|
|
||||||
|
|
||||||
rsyncrepo() {
|
|
||||||
_parse_rsync_args "$@"
|
|
||||||
# inherits parsed arguments through variables
|
|
||||||
_do_rsync "$RR_FROM" "$RR_TO"
|
|
||||||
}
|
|
||||||
|
|
||||||
rsynchydra() {
|
|
||||||
_parse_rsync_args "$@"
|
|
||||||
_do_rsync "$RR_FROM" "hydra01"
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue