On Mon, Apr 27, 2020, T. Kurt Bond wrote: > Today I finally took the time to figure out how to install groff fonts using > the shell script https://www.schaffter.ca/mom/bin/install-font.sh . > > It was way easier than following the manual steps. > > In doing so I made some changes to script that made it easier for me to > use. I'm sending this e-mail so folks can look at the changes and see > if they would be useful in general. > > I changed the documentation of the -l and -s options to refer to the > prefixes /usr/local/share/groff and /usr/share/groff respectively > because those are the directories they actually use.
Good. > I added a -P option that lets you specify the prefix to use. I often > install software into places like /sw/versions/groff/git (so I can > have multiple versions of software installed), which means > that the I'd specify "-P /sw/versions/groff/git/share/groff". Needs better documentation. -P dir Path to the top-level groff directory if groff has been installed in a non-default location. > I added a -n option that stops the source font file from > being installed anywhere. This is useful if you don't have > /usr/local/share/fonts/truetype or /usr/local/share/fonts/opentype > or /usr/local/share/fonts/type1, which, if you didn't specify -C > and depending on the type of font file, is where the source file > is copied to. Okay. Does the same thing as answering "n" to the prompt that asks whether to copy, but might be useful for batch processing. > I changed the script so it checks if has write access to the > prefix directory specified, rather than checking if it is running > as root, because if you've installed groff into a location you > have access to as a normal user it will be writable. And if you > are running it as root it will also be writable. Good. > I also moved the check after the parsing of the command line > options, so it uses the user specified prefix directory, whether > that was set with -l or -s. Good. > Also, wouldn't this script be useful to include in the groff > distribution? I'm inclined to think so, however it contains non-portable bashisms and so might not be appropriate. The script was a quick and dirty solution to font installation. Something similar but more robust and not reliant on a particular shell interpreter would be better. -- Peter Schaffter http://www.schaffter.ca