[gnome-build-meta/abderrahim/run-local-repo] utils/run-local-repo.sh: use caddy or webfsd in preference to python http.server




commit 40e276428c2f73aa5d2f0b4f690245073972d960
Author: Abderrahim Kitouni <akitouni gnome org>
Date:   Sun Aug 9 14:10:01 2020 +0100

    utils/run-local-repo.sh: use caddy or webfsd in preference to python http.server

 utils/run-local-repo.sh | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
---
diff --git a/utils/run-local-repo.sh b/utils/run-local-repo.sh
index 7ac3bf85..321419e6 100755
--- a/utils/run-local-repo.sh
+++ b/utils/run-local-repo.sh
@@ -1,3 +1,20 @@
 #!/bin/bash
 
-exec python3 -m http.server 8000 --directory ostree-repo
+PORT=8000
+DIRECTORY=ostree-repo
+
+if type -p caddy > /dev/null; then
+    if caddy -version > /dev/null; then
+        echo "Found caddy v1"
+        exec caddy -port $PORT -root $DIRECTORY
+    else
+        echo "Found caddy v2"
+        exec caddy file-server --listen :$PORT --root $DIRECTORY
+    fi
+elif type -p webfsd > /dev/null; then
+    echo "Found webfsd"
+    exec webfsd -F -l - -p $PORT -r $DIRECTORY
+else
+    echo "Running using python web server, please install caddy or webfs instead."
+    exec python3 -m http.server $PORT --directory $DIRECTORY
+fi


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]