Last active
July 5, 2024 02:20
-
-
Save andrew-stclair/49d96c6dfc4109ed1e1f479c1bb2b308 to your computer and use it in GitHub Desktop.
Export the Linux Manual to /opt/man in pdf format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| echo "Installing required software" | |
| apt-get update | |
| apt-get install groff man manpages manpages-dev -y | |
| echo "Creating output directory if it does not exist" | |
| SEARCH_DIR="/usr/share/man/" | |
| OUT_DIR="/opt/man" | |
| mkdir -p $OUT_DIR | |
| echo "Exporting man pages" | |
| for i in `find ${SEARCH_DIR} -name '*.gz'`; do | |
| NEW_DIR=`dirname $i | sed "s|${SEARCH_DIR}||g"` | |
| NAME=`basename $i | sed 's|.gz$|.pdf|g'` | |
| mkdir -p ${OUT_DIR}/${NEW_DIR} | |
| echo "${i} -> ${OUT_DIR}/${NEW_DIR}/${NAME}" | |
| zcat $i | groff -mandoc -Tpdf > ${OUT_DIR}/${NEW_DIR}/${NAME} | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment