chore(style): add shebang, set bash strict mode, create function
[webi-installers/.git] / fd / install.sh
1 #!/bin/bash
2 set -e
3 set -u
4
5 function __init_fd() {
6
7     ###############
8     # Install fd #
9     ###############
10
11     WEBI_SINGLE=true
12
13     pkg_get_current_version() {
14         # 'fd --version' has output in this format:
15         #       fd 8.1.1
16         # This trims it down to just the version number:
17         #       8.1.1
18         echo $(fd --version 2> /dev/null | head -n 1 | cut -d' ' -f 2)
19     }
20
21     pkg_install() {
22         # $HOME/.local/
23         mkdir -p "$pkg_src_bin"
24
25         # mv ./fd-*/fd "$HOME/.local/opt/fd-v8.1.1/bin/fd"
26         mv ./fd-*/fd "$pkg_src_cmd"
27
28         # chmod a+x "$HOME/.local/opt/fd-v8.1.1/bin/fd"
29         chmod a+x "$pkg_src_cmd"
30     }
31 }
32
33 __init_fd