summaryrefslogtreecommitdiff
path: root/nixos/parts/scripts/deploy-dir
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2024-12-13 07:35:32 +0100
committerMartin Fischer <martin@push-f.com>2024-12-16 05:12:07 +0100
commitd478dbd916c240e5ff609dcca17eedbd04c7fe83 (patch)
treece5c8b5916672bebaa34b446529528592c346f12 /nixos/parts/scripts/deploy-dir
parentcd1471871c1719f666d2971754d2ec7af25a2859 (diff)
tente: add nginx
Diffstat (limited to 'nixos/parts/scripts/deploy-dir')
-rwxr-xr-xnixos/parts/scripts/deploy-dir16
1 files changed, 16 insertions, 0 deletions
diff --git a/nixos/parts/scripts/deploy-dir b/nixos/parts/scripts/deploy-dir
new file mode 100755
index 0000000..bb7dfdf
--- /dev/null
+++ b/nixos/parts/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
+"