Commit graph

38 commits

Author SHA1 Message Date
Fini Jastrow c34dbc5ef9 install.sh: Fix doc and bugs
Fixes: #2075

reported-by: laur <laur.aliste@gmail.com>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2026-09-04 19:33:46 +02:00
Fini Jastrow 2f740ec0c2 Replace install.sh with new fc_install
Also drop install.ps1 because it needs a full clone and still can not
install the new fonts. There are better Powershell alternatives.

Fixes: #1902

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2026-09-04 01:25:33 +02:00
Fini Jastrow 0444b7fa89 install.sh: Replace bashisms
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2026-02-07 18:22:15 +01:00
Fini Jastrow e8fa89bfcb install.sh: Add deprecation warning
[why]
I guess people do not know this probably, or gloss over it when reading the readme.md.

We would need to throw together something new that maybe utilizes
bin/scripts/fetch-archives.sh

But then, cloning the repo is no good idea in any situation. And how would
people get the new script without cloning. Not sure it's worth it.

Lets see if people complain with this warning.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2025-05-09 17:58:32 +02:00
Fini Jastrow fe10f51a8e install.sh: Fix broken copy commands on MacOS
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2025-05-09 17:46:46 +02:00
Fini Jastrow 044a7c31ed install.sh: Add info on actually used bash version
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2025-05-09 17:46:46 +02:00
Fini Jastrow 2c710f0d75 install.sh: Work around find-on-MacOS
Note that `find` on MacOS does not know `-printf`

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2025-05-09 17:02:36 +02:00
Fini Jastrow d0793d0293 install.sh: Drop most bashisms
[why]
We want to have this scripts working with the standard MacOS bash, which
is an ancient version 3.

[how]
Change the shebang to `sh` and use checkbashisms and shellcheck.
Afterwards change to `bash` again. See note in the code about
exceptions:

    # This script must run with bash 3
    # In fact it is checked against `checkbashisms` and no bashisms are
    # used, except (because the workarounds are too involved):
    #
    # - <( ) process substitution
    # - read -d option
    # - $'\0' to supply a nullbyte to read -d
    # - <<< here-string

See also https://askubuntu.com/questions/1059265/whats-the-problem-with-bashisms

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2025-05-09 16:14:38 +02:00
Fini Jastrow 0cbf18224c install.sh: Reintruduce extension parameter
[why]
At the moment we have every font only in one format (ttf or otf), so the
preference option does not do much (does not do anything).

Anyhow, it was there before and maybe at some point we take the multiple
formats up again, and then we are prepared.

[how]
Instead of the previous solution to search for all formats and then try
to remove the duplicates we search first for the desired format and if
we find not one font we search for the other format. This is slightly
different but the outcome is the same.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2025-05-09 11:43:24 +02:00
Fini Jastrow 13cb21c4a5 install.sh: Make bash 3 compatible
[why]
Vanilla MacOS has just some very old bash 3 installed by default. People
might want to use the install.sh, but not install a newer bash (via
Homebrew for example).

[how]
The `nerdfonts_dirs` array is replaced by a normal bash variable (string)
where the directories are '/' separated. Because there are never
subdirectories in the list but only direct children of 'patched-fonts/'
it is possible to use slash as unique and out-of-band separator.

The `fonts` array is replaced by a function that delivers the list of
files in null-byte separated form. That means we can not manipulate the
list and thus the duplicate checking is dropped. As we do not have any
font in both formats (anymore) it will never happen anyhow.
Dropping the duplicates check also removes the extension preference
option functionality. We keep the now defunct option, though.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2025-05-09 11:43:24 +02:00
Fini Jastrow 3f915946d8 install.sh: Refactor
Pull some common code out of a nested double case into a function.
That makes the code much more readable (for me).

Also simplify find expression.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2025-05-09 11:43:24 +02:00
Fini Jastrow 4b952a9d85 install.sh: Fix usage
Some things changed but the usage information has not been updated.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2025-05-09 09:18:22 +02:00
Fini Jastrow cad5f30532 install.sh: Remove unused code
[why]
This is a forgotten leftover from commit
  6edfff3d3  install.sh: Avoid arbitrary cmd exe

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2025-05-08 10:55:52 +02:00
Fini Jastrow ca0b8c60fe install.sh: Small improvements
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2025-05-08 10:50:17 +02:00
Fini Jastrow 6edfff3d31 install.sh: Avoid arbitrary cmd exe
[why]
There is some risk that an arbitrary command can be smuggled in and
possibly executed with root rights in some situations.
See PR #1861.

[how]
Use xargs instead of eval to store the predefined filter arguments (that
come as one string) into individual arguments of the find command.

Reported-by: Nick Brady <nbgeniu1@gmail.com>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2025-05-08 10:50:07 +02:00
Fini Jastrow 80942b9b82 font-patcher: Remove option --use-single-width-glyphs
[why]
There are three possible options to specify the Nerd Font Mono generation:
    -s
    --mono
    --use-single-width-glyphs

All the three are handled the same.

In order to add a new long option that also handles glyph width in a "single"
cell manner the fear is that two too similar options will confuse users.

[how]
Just hide the longest form.
Also remove from the readme files.

Need to adapt the install.sh script.

(The option still works but is not 'advertised'.)

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2025-01-08 21:45:41 +01:00
Fini Jastrow e398a3847c install.sh: Honor XDG_DATA_HOME
[why]
When a user sets the XDG_DATA_HOME environment variable the default of
$HOME/.local/share should not be used.

https://wiki.archlinux.org/title/XDG_Base_Directory

[how]
Enable XDG_DATA_HOME to override the default user data directory on Unix
and MacOS platforms.

There is some controversy if XDG_DATA_HOME should be honored on MacOS,
see for example platformdirs (link below). But me also working on Linux
and MacOS (and Windows) in parallel, I can not quite follow the
downsides and believe we should allow XDG_DATA_HOME also for MacOS.

Related: https://github.com/platformdirs/platformdirs/issues/4
Fixes: #1324

Suggested-by: Anthony Foglia <@afoglia>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-09-27 06:04:14 +02:00
Fini Jastrow 335a38d78f install.sh: Fix various ShellCheck issues
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-06-02 16:58:04 +02:00
Fini Jastrow da651cf5a8 install.sh: Fix not working at all
[why]
The install script does not install anything after the 3.0.0 release.

[how]
Throw away all the (unused) patches stuff.
Throw away the compat stuff.
Introduce clean find patterns for all three Nerd Font variants.

Use them depending on the user's desire - also adding an option to
install the new proportional variants.

Additionally throw an error when we did not find any file (instead of
just failing in obscure ways).

[note]
Also output version number on runs.
Also remove some unused options in getopts.

Fixes: #1183

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-05-01 10:39:11 +02:00
Fini Jastrow bd736c714d install.sh: Hint to dropped feature
I can not fix the script right now, this is postponed.
But still it should tell users that something is amiss.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-04-28 18:55:37 +02:00
Fini Jastrow 0a7d64b31c install.sh: Fix installing more than 2 fonts
[why]
The implode function can not work correctly because the bash pattern
expansion inserts blanks in unexpected places.

[how]
Use a dump loop instead of being smart.

Fixes: #280

Reported-by: Geoffrey Biggs <gbiggs>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-01-28 20:07:11 +01:00
Fini Jastrow 10f43c7b95 Fix various otf/ttf globs
[why]
I'm not sure why it has been in the code like this, and I removed these
strange globs already before in some places [1].

find -name "*.[o,t]tf"

actually allows
  *.otf
  *.ttf
  *.,tf

[how]
Remove spurious comma in all `find` calls.
Systematically.

[note]
Just some commits mentioned here:
  2ace3de8
  e7722458
  821ac681
  7bc729e2

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-01-26 09:36:27 +01:00
Fini Jastrow a07648b1ee install.sh: Add uninstall command
[why]
Maybe people would like to uninstall the fonts installed with the
script.

In fact the uninstall could already be acieved by giving the --clean
option and installing no new font. Well, apart from the fact that the
scripts prevents runs with no installed font. And then the user must
specify the same installpath that has been used for the install, which
is a bit tedious.

[how]
Add new command '--remove' (with no short option).
Make -L / --list option a dry-run option for --remove.
Uninstall both possible installpaths.

Fixes: #407

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-14 12:33:07 +02:00
Fini Jastrow 533e1a2df4 install.sh: Remove patch-selecting options
[why]
We have only 'Complete' in the repo anymore, so it does not make sense
to provide commands to select un-complete patched fonts.

[how]
Leave stub/comment in so that - if there ever is a need to resurrect the
feature - one can find this commit and the deleted code.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-14 12:33:07 +02:00
Fini Jastrow 92fbcdb143 Rename 'Font Linux' to 'Font Logos'
[why]
The glyphs set's name changed, we should reflect that.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-09-13 08:05:14 +02:00
Ryan L McIntyre 7a4b5f872f Fixes build errors (ShellCheck) 2019-08-11 07:30:38 -07:00
Ryan L McIntyre 5d5c1b449e Fixes double negative expressions
ShellCheck rule SC2236
2019-08-11 00:14:43 -07:00
No GUI 1b36e2aa8a
Fix the negative error number
This fixes the shellcheck error. Running on my laptop, `exit -1` results in an actual return code of 255, so make that explicit.
2019-07-25 01:08:21 +00:00
Andrew Newman e8e191a1be Update bash shebangs 2018-07-09 18:18:12 +03:00
Phuurl d71100d58e Treats fc-cache return code of 1 as success prevent install.sh returning 1 2018-01-13 11:47:57 +00:00
Ryan L McIntyre 338b0c6bdc ShellCheck fixes WIP (related to #120) 2018-01-12 22:20:52 -05:00
Antoine Rahier 2b73bffaee Make the install script callable from everywhere
Installation would fail if you did not first cd in into the nerd-fonts
directory before running install.sh as $nerdfonts_root_dir referenced
${PWD} which is the path your shell is into when calling the script,
not the basepath of the script, parent of "patched-fonts".
2017-08-31 23:33:45 +02:00
Brennan Fee 435ac19b1d Tick version number up in install script.
Fully tested now.  Ticking version # up.
2017-07-29 22:14:41 -05:00
Brennan Fee ab687375f3 Added support to intall fonts to global system path.
Allows execution 'sudo ./install.sh -S <fonts>' which will use the
global system install path rather than the users local path.
2017-07-29 22:08:20 -05:00
Xandor Schiefer 2cf5f12d17 Better installation script
It now has more options than copying all patched files or one font’s
patched font files.

In short, you can choose which patchset, which compatibility, which
method (copy or symlink), and which fonts you want to install.
2016-09-02 10:00:18 +02:00
David McKay 4ac26ee202 Allow a single font-family to be installed, instead of everything by default. 2016-05-14 11:54:45 -04:00
Shai Efrati 6799e03bed Fix font_dir on linux to be ~/.local/share/fonts as the previous was deprecated. 2016-01-06 09:27:27 +02:00
Srijan R Shetty ae82f4234a Install script for Ubuntu 2015-02-24 21:16:42 +05:30