2 # homepage: https://github.com/caddyserver/caddy
3 # tagline: Fast, multi-platform web server with automatic HTTPS
5 # Caddy is an extensible server platform that uses TLS by default.
15 pkg_dst="$HOME/.local"
17 # the "source" here isn't used, nor very meaningful,
18 # but we'll use the download location as a junk value
19 pkg_src="$HOME/Downloads/$WEBI_PKG_FILE"
21 pkg_get_current_version() {
22 # 'caddy version' has output in this format:
23 # v2.1.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=
24 # This trims it down to just the version number:
26 echo "$(caddy version 2>/dev/null | head -n 1 | cut -d' ' -f1 | sed 's:^v::')"
29 pkg_format_cmd_version() {
30 # 'caddy v2.1.0' is the canonical version format for caddy
32 echo "$pkg_cmd_name v$my_version"
36 # caddy is just a single file, no directory linking to do
41 # if selected version is installed, quit
43 # will save to ~/Downloads/$WEBI_PKG_FILE by default
45 # supported formats (.xz, .tar.*, .zip) will be extracted to $WEBI_TMP
50 pushd "$WEBI_TMP" 2>&1 >/dev/null
52 # ensure the bin dir exists
53 mkdir -p "$pkg_dst_bin"
55 # rename the entire extracted folder to the new location
56 # (this will be "$HOME/.local/bin/caddy", as set above)
58 # ex (full directory): ./node-v13-linux-amd64/bin/node.exe
59 #mv ./"$pkg_cmd_name"* "$pkg_src"
61 # ex (single file): ./caddy-v2.0.0-linux-amd64.exe
62 mv ./"$pkg_cmd_name"* "$pkg_dst_cmd"
63 chmod a+x "$pkg_dst_cmd"
65 # ex (single file, nested in directory): ./rg/rg-v13-linux-amd64
66 #mv ./"$pkg_cmd_name"*/"$pkg_cmd_name"* "$pkg_commend_cmd"
67 #chmod a+x "$pkg_dst_cmd"
73 # just in case we add something in the future
76 # web_path_add is defined in webi/template.bash at https://github.com/webinstall/packages
77 # Adds "$HOME/.local/bin" to PATH
78 webi_path_add "$pkg_dst_bin"
81 pkg_post_install_message() {
82 echo "Installed 'caddy' v$WEBI_VERSION as $pkg_dst_cmd"