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_common_opt="$HOME/.local"
17 # just a junk file so that the version check always fails for non-current versions
18 pkg_new_opt="$HOME/.local/opt/caddy-doesntexist111"
20 pkg_get_current_version() {
21 # 'caddy version' has output in this format:
22 # v2.1.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=
23 # This trims it down to just the version number:
25 echo "$(caddy version 2>/dev/null | head -n 1 | cut -d' ' -f1 | sed 's:^v::')"
28 pkg_format_cmd_version() {
29 # 'caddy v2.1.0' is the canonical version format for caddy
31 echo "$pkg_cmd_name v$my_version"
34 pkg_link_new_version() {
35 # caddy is just a single file, no directory linking to do
40 # if selected version is installed, quit
42 # will save to ~/Downloads/$WEBI_PKG_FILE by default
44 # supported formats (.xz, .tar.*, .zip) will be extracted to $WEBI_TMP
49 pushd "$WEBI_TMP" 2>&1 >/dev/null
51 # ensure the bin dir exists
52 mkdir -p "$pkg_common_bin"
54 # rename the entire extracted folder to the new location
55 # (this will be "$HOME/.local/bin/caddy", as set above)
57 # ex (full directory): ./node-v13-linux-amd64/bin/node.exe
58 #mv ./"$pkg_cmd_name"* "$pkg_new_opt"
60 # ex (single file): ./caddy-v2.0.0-linux-amd64.exe
61 mv ./"$pkg_cmd_name"* "$pkg_common_cmd"
62 chmod a+x "$pkg_common_cmd"
64 # ex (single file, nested in directory): ./rg/rg-v13-linux-amd64
65 #mv ./"$pkg_cmd_name"*/"$pkg_cmd_name"* "$pkg_commend_cmd"
66 #chmod a+x "$pkg_common_cmd"
72 # just in case we add something in the future
75 # web_path_add is defined in webi/template.bash at https://github.com/webinstall/packages
76 # Adds "$HOME/.local/bin" to PATH
77 webi_path_add "$pkg_common_bin"
80 pkg_post_install_message() {
81 echo "Installed 'caddy' v$WEBI_VERSION as $pkg_common_cmd"