#!/bin/sh -e export LC_ALL=C if [ -z "$SYSROOT" ]; then SYSROOT=$HOME/sortix/sysroot fi SECTIONS="1 2 3 4 5 6 7 8 9" ls "$SYSROOT/tix/tixinfo" > ports.list (echo system && ls "$SYSROOT/tix/tixinfo") | while read port; do touch "$port.list" for section in $SECTIONS; do grep -E "^/share/man/man$section/.*\.$section$" "$SYSROOT/tix/manifest/$port" | sort >> "$port.list" done done (echo system && ls "$SYSROOT/tix/tixinfo") | while read port; do for section in $SECTIONS; do mkdir -p "man$section" grep -E "^/share/man/man$section/.*\.$section$" "$SYSROOT/tix/manifest/$port" | sort | while read manpage; do cp -f "$SYSROOT/$manpage" "man$section" manpage=$(basename -- "$manpage") chmod 644 "man$section/$manpage" done done done