Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Replace installation script with bash version that performs a more robust installation process #358

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

robfrawley
Copy link

@robfrawley robfrawley commented Nov 21, 2020

The attached installation script is a clean-up version of what I've been using for the past few years when installing fonts from a number of sources, including this repository (powerline/fonts) as well as others (like ryanoasis/nerd-fonts); I'm not sure if you'd want something this long to and bash-dependent to replace the simple sh script, but I'll enumerate the additional features here and let the community and yourself decide its merit.

  • Allows for a custom installation root by assigning the desired path to the INSTALL_FONT_ROOT_PATH environment variable. An example of installation using a custom target path would be INSTALL_FONT_ROOT_PATH=/custom/font/path ./install.bash.
  • The new script defaults to the more common ~/.fonts directory for installation on *nix.
  • Allows for passing more than one filter and expands what can be filtered. Prior, only a single filter could be passed to the script (like install.sh Ubuntu). This filter was was case-sensitive and only filtered based on the font file name. This new script allows for any number of filters (like install.bash ubuntu firamono [etc]) and is no longer case-sensitive. While this script also performs the filter search via the file name (for example passing furamono will continue to match the font file FuraMono-Bold Powerline.otf) it additionally performs the filter search via the directory the font is in (for example passing firamono will not match the file name but it will match the same file because of its path of FiraMono/FuraMono-Bold Powerline.otf).
  • Invokes sudo only if the non-sudo command fails and only where required for the script to work, so if one wants to install the fonts to the system path of /usr/share/fonts they can simply call INSTALL_FONT_ROOT_PATH=/usr/share/fonts ./install.bash without having to run the whole script with sudo and the script will automatically utilize sudo to copy the files.
  • Uses a more robust installation file path that aligns better with how many common *nix distros organize their fonts. For example, the current install script just throw all the font files into the determined font directory, whereas this script will use the font path <root>/<type>/<family>/<file>.<ext>. An example of a resolved target path is ~/.fonts/opentype/FiraMono/FuraMono-Bold-Powerline.otf. Below is a short description of the path placeholders used prior:
    • Font root: the requested or automatically determined installation root (such as ~/.fonts).
    • Font type: the font file type (extension) name (such as opentype, truetype, and pcf).
    • Font family: the font family name as determined by the folder structure (such as Ubuntu, or FiraMono, etc).
    • Font file: the font file name (such as FuraMono-Bold-Powerline, etc).
    • Font ext: the font file extension (such as otf, etc).

There may be a few other changes, but the above list covers the major, important distinctions this script has from the existing one.

Note: this is still a work in progress (for example, fc-cache isn't yet called and it has not been compatibility-tested with Darwin); do not merge as-is (I will update to remedy these issues if interest exists for this script's inclusion in the project).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant