summaryrefslogtreecommitdiff
path: root/nixos/profiles/workstation/scripts/deploy-dir
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2024-12-27 08:45:34 +0100
committerMartin Fischer <martin@push-f.com>2024-12-27 18:44:37 +0100
commit1b65ba7a838e422c9bf16ddcaf796a996fa51b6b (patch)
treed8ec8d965f955a7f9a5c2b5c98e8a430fb0e8b6f /nixos/profiles/workstation/scripts/deploy-dir
parentedda7ef46bf2ae7fde9511005b4e7d40648c7e24 (diff)
refactor: introduce profiles
Diffstat (limited to 'nixos/profiles/workstation/scripts/deploy-dir')
-rwxr-xr-xnixos/profiles/workstation/scripts/deploy-dir16
1 files changed, 16 insertions, 0 deletions
diff --git a/nixos/profiles/workstation/scripts/deploy-dir b/nixos/profiles/workstation/scripts/deploy-dir
new file mode 100755
index 0000000..bb7dfdf
--- /dev/null
+++ b/nixos/profiles/workstation/scripts/deploy-dir
@@ -0,0 +1,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
+"