diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2023-12-13 12:01:48 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-13 12:01:48 +0000 |
commit | 688991ba84af0bf9518e5f0a3c2c471474a358e0 (patch) | |
tree | 51f80f7ddfb4a5312566d68a579ef6a141f9e5f3 /maintainers/scripts | |
parent | f5eed8de6a723c61ed1c40a967632bcf78f935b2 (diff) | |
parent | 022a4231437548b719eb9e5b8bae1a7f6117fa93 (diff) |
Merge staging-next into staging
Diffstat (limited to 'maintainers/scripts')
-rwxr-xr-x | maintainers/scripts/doc/list-systemd-manpages.zsh | 33 |
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 0000000000000..6737a4d3fef19 --- /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 |