refactor: finish moving ssh-* scripts to own installers
[webi-installers/.git] / deno / install.sh
1 #!/bin/bash
2
3 # The custom functions for Deno are here.
4 # For the generic functions - version checks, download, extract, etc:
5 # See https://github.com/webinstall/packages/branches/master/_webi/template.sh
6
7 set -e
8 set -u
9
10 pkg_cmd_name="deno"
11
12 # IMPORTANT: this let's other functions know to expect this to be a single file
13 WEBI_SINGLE=true
14
15 function pkg_get_current_version() {
16     # 'deno --version' has output in this format:
17     #       deno 1.1.0
18     #       v8 8.4.300
19     #       typescript 3.9.2
20     # This trims it down to just the version number:
21     #       1.1.1
22     echo "$(deno --version 2> /dev/null | head -n 1 | cut -d' ' -f2)"
23 }
24
25 function pkg_install() {
26     # $HOME/.local/xbin
27     mkdir -p "$pkg_src_bin"
28
29     # mv ./deno* "$HOME/.local/xbin/deno-v1.1.0"
30     mv ./"$pkg_cmd_name"* "$pkg_src_cmd"
31
32     # chmod a+x "$HOME/.local/xbin/deno-v1.1.0"
33     chmod a+x "$pkg_src_cmd"
34 }
35
36 function pkg_link() {
37     # rm -f "$HOME/.local/bin/deno"
38     rm -f "$pkg_dst_cmd"
39
40     # ln -s "$HOME/.local/xbin/deno-v1.1.0" "$HOME/.local/bin/deno"
41     ln -s "$pkg_src_cmd" "$pkg_dst_cmd"
42 }