7 # pkg_src isn't used in this script,
8 # just setting a junk value for completeness (and possibly debug output)
9 pkg_src="$HOME/Downloads/$WEBI_PKG_FILE"
11 pkg_get_current_version() {
12 # 'hugo version' has output in this format:
13 # Hugo Static Site Generator v0.72.0-8A7EF3CF darwin/amd64 BuildDate: 2020-05-31T12:07:44Z
14 # This trims it down to just the version number:
16 echo "$(hugo version 2>/dev/null | head -n 1 | cut -d' ' -f5 | cut -d '-' -f1 | sed 's:^v::')"
19 pkg_format_cmd_version() {
20 # 'node v12.8.0' is the canonical version format for node
22 echo "$pkg_cmd_name v$my_version"
26 # hugo is just a single file, no directory linking to do
31 # if selected version is installed, quit
33 # will save to ~/Downloads/$WEBI_PKG_FILE by default
35 # supported formats (.xz, .tar.*, .zip) will be extracted to $WEBI_TMP
40 pushd "$WEBI_TMP" 2>&1 >/dev/null
42 # rename the entire extracted folder to the new location
43 # (this will be "$HOME/.local/opt/node-v$WEBI_VERSION" by default)
44 mkdir -p "$pkg_dst_bin"
45 mv ./"$pkg_cmd_name"* "$pkg_dst_cmd"
46 chmod a+x "$pkg_dst_cmd"
52 # just in case we add something in the future
55 # web_path_add is defined in _webi/template.sh at https://github.com/webinstall/packages
56 # Adds "$HOME/.local/opt/node" to PATH
57 webi_path_add "$pkg_dst_bin"