summaryrefslogtreecommitdiff
path: root/http/bin
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2026-06-25 09:49:14 +0100
committerJoe Carstairs <me@joeac.net>2026-06-25 09:49:14 +0100
commitf09bbf8d4aa5b18b0298b66aa132325232c6ba54 (patch)
tree980d33827eb5d752135df1d666c2bc9fc4bf4288 /http/bin
parent83e0f1cda52e8cc66125a484048a8702b80db399 (diff)
replaces prune_blog script with http/Makefile rules
Diffstat (limited to 'http/bin')
-rwxr-xr-xhttp/bin/prune_blog45
1 files changed, 0 insertions, 45 deletions
diff --git a/http/bin/prune_blog b/http/bin/prune_blog
deleted file mode 100755
index 849b293..0000000
--- a/http/bin/prune_blog
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/sh -e
-
-BLOG="$1"
-BLOG_POST_PATTERN="${2:-*}"
-
-SRC="$(realpath src)"
-BLOGS="$(realpath blogs)"
-LAYOUTS="$(realpath share/layouts)"
-BLOG_DIR_IN_SRC="${SRC}/${BLOG}"
-BLOG_EXT=gmi
-
-for post in $(find "$BLOG_DIR_IN_SRC" -type f -and -name "$BLOG_POST_PATTERN")
-do
- last_segment="${post##*\.}"
- if [ "$last_segment" = "args" ]
- then
- continue
- fi
-
- post_rel_path="$(echo "$post" | cut -c${#BLOG_DIR_IN_SRC}- | cut -c3-)"
- post_basename_len=$(( ${#post_rel_path} - ( ${#last_segment} + 1 ) ))
- post_basename="$(echo "${post_rel_path}" | cut -c1-${post_basename_len})"
- post_src="${BLOGS}/${BLOG}/${post_basename}.${BLOG_EXT}"
- if [ -f "$post_src" ]
- then
- continue
- fi
-
- penultimate_segment_len=$(( ${#post} - ( ${#last_segment} + 1 ) ))
- penultimate_segment="$(echo "${post}" | cut -c1-${penultimate_segment_len})"
- penultimate_segment="${penultimate_segment##*\.}"
- post_basename_len=$(( ${#post_rel_path} - ( ${#last_segment} + ${#penultimate_segment} + 2 ) ))
- post_basename="$(echo "${post_rel_path}" | cut -c1-${post_basename_len})"
- if [ -f "${LAYOUTS}/${penultimate_segment}.layout.${last_segment}" ]
- then
- post_src="${BLOGS}/${BLOG}/${post_basename}.${BLOG_EXT}"
- if [ -f "$post_src" ]
- then
- continue
- fi
- fi
-
- echo "No source file found to match post ${post} in blog ${BLOG}: removing ${post}"
- rm -f "$post" "${post}.args"
-done