Created
June 9, 2020 10:17
-
-
Save andyxning/5cc1c368f2610aa131bb6b9fc47f094b to your computer and use it in GitHub Desktop.
Add linux man page docset to Dash
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 | |
# Under instructions in: https://blog.kapeli.com/linux-man-pages-in-dash | |
set -x | |
set -e | |
man_path_dest_dir="/usr/local/share/man" | |
man_pages_version="5.06" | |
linux_man_pages_download_link="https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/man-pages-${man_pages_version}.tar.xz" | |
wget -nv ${linux_man_pages_download_link} -O /tmp/man-pages-${man_pages_version}.tar.xz | |
if [ $? -ne 0 ]; then | |
echo "Download man pages ${man_pages_version} error" | |
exit 1 | |
fi | |
tar xvf /tmp/man-pages-${man_pages_version}.tar.xz -C /tmp | |
if [ $? -ne 0 ]; then | |
echo "Extract man pages ${man_pages_version} error" | |
exit 1 | |
fi | |
cd /tmp/man-pages-${man_pages_version} | |
for i in {1..7}; do | |
cd man$i | |
if [ ! -d ${man_path_dest_dir}/man$i ]; then | |
mkdir ${man_path_dest_dir}/man$i | |
fi | |
for item in * | |
do | |
mv $item ${man_path_dest_dir}/man$i/linux_$item | |
done | |
cd ../ | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment