summaryrefslogtreecommitdiff
path: root/nixos/parts/scripts/deploy-dir
blob: bb7dfdf59df0224de1508c098b5c5400349a94fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env bash

if [ "$#" -ne 3 ]; then
    echo "usage: $0 <local_dir> <ssh_dest> <remote_dir>"
    exit 1
fi
printf -v remote_dir %q $3

cd $1
tar cf - . | ssh $2 "set -xe
TEMP_DIR=\$(mktemp -d)
cd \$TEMP_DIR
tar xvf -
rm -rf $remote_dir
mv \$TEMP_DIR $remote_dir
"