3 # This file only defines custom functions which may be unique to installing Caddy.
4 # For the generic functions (version comparison, downloading, symlinking) which
5 # are used by almost all installers, see `template.bash`:
6 # - https://github.com/webinstall/packages/branches/master/webi/template.bash
14 pkg_get_current_version() {
15 # 'caddy version' has output in this format:
16 # v2.1.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=
17 # This trims it down to just the version number:
19 echo "$(caddy version 2>/dev/null | head -n 1 | cut -d' ' -f1 | sed 's:^v::')"
24 mkdir -p "$pkg_src_bin"
26 # mv ./caddy* "$HOME/.local/xbin/caddy-v2.0.0"
27 mv ./"$pkg_cmd_name"* "$pkg_src_cmd"
29 # chmod a+x "$HOME/.local/xbin/caddy-v2.0.0"
30 chmod a+x "$pkg_src_cmd"
34 # rm -f "$HOME/.local/bin/caddy"
37 # ln -s "$HOME/.local/xbin/caddy-v2.0.0" "$HOME/.local/bin/caddy"
38 ln -s "$pkg_src_cmd" "$pkg_dst_cmd"