nerd-fonts icon indicating copy to clipboard operation
nerd-fonts copied to clipboard

install script method deprecation complaint

Open laur89 opened this issue 5 months ago • 10 comments

Requirements

  • [x] I have searched the issues for my issue and found nothing related or helpful
  • [x] I have searched the FAQ for help
  • [ ] I have checked the Wiki for help

Experienced Behavior

I'm registering my complaint regarding install script deprecation warning introduced in https://github.com/ryanoasis/nerd-fonts/commit/e8fa89bfcbc37ff0016ff1861386e655e0a9c1e9:

Deprecated tool: Will not work to get newer fonts as they are not inside the repo anymore.

Have always installed fonts using the option #7 as it's done automatically by a shellscript.

What's the current go-to option for automated install, given option 7 is deprecated?

Expected Behavior

Install script to work without any warnings.

laur89 avatar Jul 30 '25 10:07 laur89

Thanks for the feedback.

How do you use the script... Install "all fonts" or some specific font(s)? Can you give an example how it is usually called in your case?

Finii avatar Jul 30 '25 11:07 Finii

Can you give an example how it is usually called in your case?

Have always installed in OP is linking to the shell logic in question. But essentially:

    fonts=(
        Hack
        SourceCodePro
        AnonymousPro
        Terminus
        ...
    )

    $ git shallow clone repo  (which is still ~8G lol)
    $ cd to repo dir

    for i in "${fonts[@]}"; do
        ./install.sh "$i"
    done

laur89 avatar Jul 30 '25 11:07 laur89

git shallow clone repo (which is still ~8G lol)

Well, of course ;-} That is why the install.sh is so bad.

While we have all the 'building blocks' to make a small script that just fetches the fonts you want, I did never come round to actually DO it - also because I thought noone is using it. But that does not seem very hard, so I will maybe modernize the install.sh, and also make it 'stand alone' (i.e. non-clone-repo, just download the script).

Finii avatar Jul 30 '25 12:07 Finii

maybe modernize the install.sh, and also make it 'stand alone' (i.e. non-clone-repo, just download the script)

That'd be appreciated. No idea how most peeps are installing the fonts, but simple automated way always gets my vote. Bonus points if the logic still remains non-magical and roughly readable. Naturally we have to choose to trust the sources we're installing software from, but too much magic does make me uncomfortable.

laur89 avatar Jul 30 '25 12:07 laur89

Well, the basic building block is fetch-archives.sh, that we already have here: https://github.com/ryanoasis/nerd-fonts/blob/master/bin/scripts/fetch-archives.sh

It fetches the font(s) from the release page :-D, latest or which version you specify...

I imagine we can check if the user has xz and use the small archives in that case or use zip otherwise. The xz archives are so much smaller.

#!/usr/bin/env bash
# Nerd Fonts Version: 3.4.0
# Script Version: 2.0.1
#
# Fetches the current release files.
# It fetches the latest release, not release candidate.
# Or fetches the specified release's files.
#
# The second parameter specifies the beginning of the artifact
# name that shall be fetched. If unspecified all artifacts will
# be fetched.
#
# Example runs
#   fetch-archives
#   fetch-archives v2.2.2
#   fetch-archives v2.2.2 Heavy
#   fetch-archives latest HeavyDat
#   fetch-archives v3.1.0 'Ara.*zip'   (just fetch the zip archive)

Finii avatar Jul 30 '25 12:07 Finii

Hmm, but of course that will have more / different dependencies than the current install.sh, namely "(zip or xz) and jq and curl" 😒

Finii avatar Jul 30 '25 12:07 Finii

I see no issue with introducing dependencies, especially if we're talking such common ones anyway. If not avail, just log out what needs to be installed by the user and leave it at that. Compression/parsing/curl/wget tools are not anything too esoteric to worry about. My guess is 90% will have 'em installed anyway, and rest should have little problem getting them installed.

laur89 avatar Jul 30 '25 13:07 laur89

Off topic, but when invoking existing install.sh, should we use the values from Original Font Name and Repository or Font Name column from here?

laur89 avatar Jul 30 '25 13:07 laur89

Off topic, but when invoking existing install.sh, should we use the values from Original Font Name and Repository or Font Name column from here?

It seems, despite the comment, that it is neither. You need to give the directory name instead 😬

Image

The directory name is usually the Original Font Name with whitespace removed, but that is just a convention and I guess not really always the case.

Image Image

Finii avatar Jul 31 '25 05:07 Finii

Another idea for the brushed-up script comes in by @laur89

Understandable if it's too much cruft to add, but would love something like --with-mono (or perhaps --include-mono?) to include both default and mono installation with a single command.

  • https://github.com/ryanoasis/nerd-fonts/discussions/1903

The whole set of options is kind of semi-reasonable right now ;)

Finii avatar Jul 31 '25 16:07 Finii