4e2bfb67e864f730c444459139b17ff0a6831a78
[webi-installers/.git] / comrak / install.sh
1 #!/bin/bash
2
3 function __init_comrak() {
4     set -e
5     set -u
6
7     ##################
8     # Install comrak #
9     ##################
10
11     WEBI_SINGLE=true
12
13     pkg_get_current_version() {
14         # 'comrak --version' has output in this format:
15         #       comrak 0.8.1
16         # This trims it down to just the version number:
17         #       0.8.1
18         echo $(comrak --version 2> /dev/null | head -n 1 | cut -d' ' -f 2)
19     }
20
21     pkg_install() {
22         # ~/.local/bin
23         mkdir -p "$pkg_src_bin"
24
25         # mv ./comrak* ~/.local/opt/comrak-v0.8.1/bin/comrak
26         mv ./comrak* "$pkg_src_cmd"
27
28         # chmod a+x ~/.local/opt/comrak-v0.8.1/bin/comrak
29         chmod a+x "$pkg_src_cmd"
30     }
31
32     pkg_post_install() {
33         # create the xdg directories (i.e. ~/.config/comrak)
34         "$pkg_src_cmd" --version > /dev/null
35     }
36 }
37
38 __init_comrak