about summary refs log tree commit diff
path: root/maintainers
diff options
context:
space:
mode:
authorValentin Gagarin <valentin@fricklerhandwerk.de>2023-12-13 08:54:09 +0100
committerGitHub <noreply@github.com>2023-12-13 08:54:09 +0100
commit6d3f2550fd22e5a81019ea577f98dbea9398ad2f (patch)
treea1e741e57dc341210b64aeb0775baad6ad9e86d8 /maintainers
parent55f58f76ecfa7fc833bf70d2f239ac11ed8d75eb (diff)
parent6b6b12c27cb9e21d6530b8139591c7696b2dca2f (diff)
downloadnixlib-6d3f2550fd22e5a81019ea577f98dbea9398ad2f.tar
nixlib-6d3f2550fd22e5a81019ea577f98dbea9398ad2f.tar.gz
nixlib-6d3f2550fd22e5a81019ea577f98dbea9398ad2f.tar.bz2
nixlib-6d3f2550fd22e5a81019ea577f98dbea9398ad2f.tar.lz
nixlib-6d3f2550fd22e5a81019ea577f98dbea9398ad2f.tar.xz
nixlib-6d3f2550fd22e5a81019ea577f98dbea9398ad2f.tar.zst
nixlib-6d3f2550fd22e5a81019ea577f98dbea9398ad2f.zip
Merge pull request #273384 from nbraud/doc/system-state
nixos/doc: Add chapter “necessary system state”
Diffstat (limited to 'maintainers')
-rwxr-xr-xmaintainers/scripts/doc/list-systemd-manpages.zsh33
1 files changed, 33 insertions, 0 deletions
diff --git a/maintainers/scripts/doc/list-systemd-manpages.zsh b/maintainers/scripts/doc/list-systemd-manpages.zsh
new file mode 100755
index 000000000000..6737a4d3fef1
--- /dev/null
+++ b/maintainers/scripts/doc/list-systemd-manpages.zsh
@@ -0,0 +1,33 @@
+#!/usr/bin/env nix-shell
+#!nix-shell -i zsh -p zsh
+set -euo pipefail
+
+# cd into nixpkgs' root, get the store path of `systemd.man`
+cd "$(dirname "$0")/../../.."
+SYSTEMD_MAN_DIR="$(nix-build -A systemd.man)/share/man"
+
+# For each manual section
+for section in {1..8}; do
+  sec_dir="${SYSTEMD_MAN_DIR}/man${section}"
+
+  # skip section 3 (library calls)
+  ! [[ $section -eq 3 ]] || continue
+
+  # for each manpage in that section (potentially none)
+  for manpage in ${sec_dir}/*(N); do
+    # strip the directory prefix and (compressed) manpage suffix
+    page="$(basename "$manpage" ".${section}.gz")"
+
+    # if this is the manpage of a service unit
+    if [[ "$page" =~ ".*\.service" ]]; then
+     # ... and a manpage exists without the `.service` suffix
+     potential_alias="${sec_dir}/${page%\.service}.${section}.gz"
+     ! [[ -e "${potential_alias}" &&
+              # ... which points to the same file, then skip
+              "$(gunzip -c "${potential_alias}")" == ".so ${page}.${section}" ]] || continue
+    fi
+
+    # else produce a JSON fragment, with the link to the upstream manpage (as HTML)
+    echo "  \"${page}(${section})\": \"https://www.freedesktop.org/software/systemd/man/${page}.html\","
+  done
+done