Page MenuHomeDevCentral

D1132.diff
No OneTemporary

D1132.diff

diff --git a/roles/shellserver/userland-software/files/html-directories.sh b/roles/shellserver/userland-software/files/html-directories.sh
new file mode 100755
--- /dev/null
+++ b/roles/shellserver/userland-software/files/html-directories.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# Generates HTML directories listing, similar to nginx autoindex output
+#
+# Usage: html-directories [directory]
+
+DIR=$1
+[ -z "$DIR" ] && DIR="."
+TITLE="Index of $DIR"
+
+echo "<html>"
+echo "<head><title>$TITLE</title></head>"
+echo '<body bgcolor="white">'
+echo "<h1>$TITLE</h1><hr>"
+echo '<pre><a href="../">../</a>'
+find $DIR -type d -depth 1 -exec echo "<a href=\"{}\">$(basename "{}")/</a>" \;
+echo "</pre><hr></body>"
+echo "</html>"
diff --git a/roles/shellserver/userland-software/web.sls b/roles/shellserver/userland-software/web.sls
--- a/roles/shellserver/userland-software/web.sls
+++ b/roles/shellserver/userland-software/web.sls
@@ -6,7 +6,7 @@
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
-{% from "map.jinja" import packages with context %}
+{% from "map.jinja" import dirs, packages with context %}
# -------------------------------------------------------------
# nginx
@@ -34,3 +34,8 @@
pkg.installed:
- pkgs:
- igal2
+
+{{ dirs.bin }}/html-directories:
+ file.managed:
+ - source: salt://roles/shellserver/userland-software/files/html-directories.sh
+ - mode: 755

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 06:52 (13 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2259638
Default Alt Text
D1132.diff (1 KB)

Event Timeline