diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2023-12-14 00:12:40 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-14 00:12:40 +0000 |
commit | f061cfd767f2c56045dec60c0eecbfee4ae757c3 (patch) | |
tree | 702a795f5e2e23ea8a7bbd37e5804946bc304c1b /maintainers/scripts | |
parent | 2b224e812b1ed6ac2f36827ba2d282f8edbe90af (diff) | |
parent | cfb8505a8fefe7a57f392f85ce9d9dbe9066a6ef (diff) | |
download | nixlib-f061cfd767f2c56045dec60c0eecbfee4ae757c3.tar nixlib-f061cfd767f2c56045dec60c0eecbfee4ae757c3.tar.gz nixlib-f061cfd767f2c56045dec60c0eecbfee4ae757c3.tar.bz2 nixlib-f061cfd767f2c56045dec60c0eecbfee4ae757c3.tar.lz nixlib-f061cfd767f2c56045dec60c0eecbfee4ae757c3.tar.xz nixlib-f061cfd767f2c56045dec60c0eecbfee4ae757c3.tar.zst nixlib-f061cfd767f2c56045dec60c0eecbfee4ae757c3.zip |
Merge master into haskell-updates
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 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 |