bugfix(misc): fix kind, gprox, myip, pandoc
[webi-installers/.git] / pandoc / install.sh
1 #!/bin/bash
2
3 function __init_pandoc() {
4     set -e
5     set -u
6
7     ###################
8     # Install pandoc #
9     ###################
10
11     # Every package should define these 6 variables
12     pkg_cmd_name="pandoc"
13
14     pkg_dst_cmd="$HOME/.local/bin/pandoc"
15     pkg_dst="$pkg_dst_cmd"
16
17     pkg_src_cmd="$HOME/.local/opt/pandoc-v$WEBI_VERSION/bin/pandoc"
18     pkg_src_dir="$HOME/.local/opt/pandoc-v$WEBI_VERSION"
19     pkg_src="$pkg_src_cmd"
20
21     # pkg_install must be defined by every package
22     pkg_install() {
23         # ~/.local/opt/pandoc-v2.10.1/bin
24         mkdir -p "$(dirname $pkg_src_cmd)"
25
26         # mv ./pandoc-*/pandoc ~/.local/opt/pandoc-v2.10.1/bin/pandoc
27         mv ./pandoc-*/bin/pandoc "$pkg_src_cmd"
28     }
29
30     # pkg_get_current_version is recommended, but (soon) not required
31     pkg_get_current_version() {
32         # 'pandoc --version' has output in this format:
33         # pandoc 2.10.1
34         # Compiled with pandoc-types 1.21, texmath 0.12.0.3, skylighting 0.8.5
35         # Default user data directory: /home/sergi/.local/share/pandoc or /home/sergi/.pandoc
36         # Copyright (C) 2006-2020 John MacFarlane
37         # Web:  https://pandoc.org
38         # This is free software; see the source for copying conditions.
39         # There is no warranty, not even for merchantability or fitness
40         # for a particular purpose.
41         # This trims it down to just the version number:
42         #       2.10.1
43         echo $(pandoc --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2)
44     }
45 }
46
47 __init_pandoc