aboutsummaryrefslogtreecommitdiffstats
path: root/templates/diddle/root_clone.sh
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-10-06 15:36:41 +0300
committerJan Tuomi <jan@jantuomi.fi>2025-10-06 15:36:41 +0300
commit25f62c996b560df12c2a8f1c7506aba28c02b154 (patch)
tree43b9f991aab015a3d6affcb47d55ef270ec5d20f /templates/diddle/root_clone.sh
parent29eb2e6cc469d9534c2586e98b782f1879bd8c76 (diff)
Run diddle
Diffstat (limited to 'templates/diddle/root_clone.sh')
-rw-r--r--templates/diddle/root_clone.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/templates/diddle/root_clone.sh b/templates/diddle/root_clone.sh
new file mode 100644
index 0000000..a3dbdac
--- /dev/null
+++ b/templates/diddle/root_clone.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# Exits with 100 if the directory was changed
+
+if [ ! -f /root/diddle ]; then
+ git clone https://github.com/jantuomi/diddle.git /root/diddle && exit 100
+fi
+
+cd /root/diddle
+before=$(git rev-parse HEAD)
+git fetch && git pull --ff-only --quiet
+after=$(git rev-parse HEAD)
+
+if [ "$before" != "$after" ]; then exit 100; fi