3 # TODO: migrate from shmatter to frontmarker
8 ## The defaults can be assumed if these are not set
10 ## The command name may be different from the package name
11 ## (i.e. golang => go, rustlang => cargo, ripgrep => rg)
12 ## Note: $HOME may contain special characters and should alway be quoted
16 ## Some of these directories may be the same, in some cases
17 #pkg_dst="$HOME/.local/opt/xmpl"
18 #pkg_dst_bin="$HOME/.local/opt/xmpl/bin"
19 #pkg_dst_cmd="$HOME/.local/opt/xmpl/bin/xmpl"
21 #pkg_src="$HOME/.local/opt/xmpl-v$WEBI_VERSION"
22 #pkg_src_bin="$HOME/.local/opt/xmpl-v$WEBI_VERSION/bin"
23 #pkg_src_cmd="$HOME/.local/opt/xmpl-v$WEBI_VERSION/bin/xmpl"
25 # Different packages represent the version in different ways
26 # ex: node v12.8.0 (leading 'v')
27 # ex: go1.14 (no space, nor trailing '.0's)
28 # ex: flutter 1.17.2 (plain)
29 pkg_format_cmd_version() {
31 echo "$pkg_cmd_name v$my_version"
34 # The version info should be reduced to a sortable version, without any leading characters
35 # (i.e. v12.8.0 => 12.8.0, go1.14 => 1.14, 1.12.13+hotfix => 1.12.13+hotfix)
36 pkg_get_current_version() {
37 echo "$(xmpl --version 2>/dev/null | head -n 1 | cut -d' ' -f2)"
40 # For (re-)linking to the desired installed version
41 # (for example: 'go' is special and needs both $HOME/go and $HOME/.local/opt/go)
42 # (others like 'rg', 'hugo', and 'caddy' are single files that just get replaced)
45 ln -s "$pkg_src" "$pkg_dst"
49 # web_* are defined in webi/template.bash at https://github.com/webinstall/packages
51 # if selected version is installed, re-link it and quit
54 # will save to ~/Downloads/$WEBI_PKG_FILE by default
57 # supported formats (.xz, .tar.*, .zip) will be extracted to $WEBI_TMP
61 # For installing from the extracted package tmp directory
63 pushd "$WEBI_TMP" 2>&1 >/dev/null
65 # remove the versioned folder, just in case it's there with junk
68 # rename the entire extracted folder to the new location
69 # (this will be "$HOME/.local/opt/xmpl-v$WEBI_VERSION" by default)
70 mv ./"$pkg_cmd_name"* "$pkg_src"
75 # For updating PATHs and installing companion tools
79 # web_path_add is defined in webi/template.bash at https://github.com/webinstall/packages
80 webi_path_add "$pkg_dst_bin"
83 pkg_post_install_message() {
84 echo "Installed 'example' as 'xmpl'"