update variables _new_ => _src_, _common_ => _dst_,
authorAJ ONeal <coolaj86@gmail.com>
Sun, 14 Jun 2020 19:24:05 +0000 (13:24 -0600)
committerAJ ONeal <coolaj86@gmail.com>
Sun, 14 Jun 2020 19:24:05 +0000 (13:24 -0600)
README.md
_example/install.bash
_example/install_safe_copy.bash
caddy/install.bash
flutter/install.bash
gitea/install.bash
golang/install.bash
hugo/install.bash
node/install.bash
webi/template.bash

index 9a01abc80b429ba20c9af7cf765b367923154ecd..c082b0f62141597a3fb027898bffb7b21de4bd91 100644 (file)
--- a/README.md
+++ b/README.md
@@ -93,14 +93,14 @@ module.exports = function (request) {
 pkg_cmd_name="foobar"
 
 # These are used for symlinks, PATH, and test commands
-pkg_common_opt="$HOME/.local/opt/foobar"
-pkg_common_bin="$HOME/.local/opt/foobar/bin"
-pkg_common_cmd="$HOME/.local/opt/foobar/bin/foobar"
+pkg_dst="$HOME/.local/opt/foobar"
+pkg_dst_bin="$HOME/.local/opt/foobar/bin"
+pkg_dst_cmd="$HOME/.local/opt/foobar/bin/foobar"
 
 # These are the _real_ locations for the above
-pkg_new_opt="$HOME/.local/opt/foobar-v$WEBI_VERSION"
-pkg_new_bin="$HOME/.local/opt/foobar-v$WEBI_VERSION/bin"
-pkg_new_cmd="$HOME/.local/opt/foobar-v$WEBI_VERSION/bin/foobar"
+pkg_src="$HOME/.local/opt/foobar-v$WEBI_VERSION"
+pkg_src_bin="$HOME/.local/opt/foobar-v$WEBI_VERSION/bin"
+pkg_src_cmd="$HOME/.local/opt/foobar-v$WEBI_VERSION/bin/foobar"
 ```
 
 (required) A version check function that strips all non-version junk
@@ -115,25 +115,25 @@ pkg_get_current_version() {
 For the rest of the functions you can like copy/paste from the examples:
 
 ```bash
-pkg_format_cmd_version() {}     # Optional, pretty prints version
+pkg_format_cmd_version() {}       # Optional, pretty prints version
 
-pkg_link_new_version() {}       # Required, may be empty for $HOME/.local/bin commands
+pkg_link_src_dst() {}             # Required, may be empty for $HOME/.local/bin commands
 
-pkg_pre_install() {             # Required, runs any webi_* commands
-    webi_check                      # for $HOME/.local/opt tools
-    webi_download                   # for things that have a releases.js
-    webi_extract                    # for .xz, .tar.*, and .zip files
+pkg_pre_install() {               # Required, runs any webi_* commands
+    webi_check                        # for $HOME/.local/opt tools
+    webi_download                     # for things that have a releases.js
+    webi_extract                      # for .xz, .tar.*, and .zip files
 }
 
-pkg_install() {}                # Required, usually just needs to rename extracted folder to
-                                # "$HOME/.local/opt/$pkg_cmd_name-v$WEBI_VERSION"
+pkg_install() {}                  # Required, usually just needs to rename extracted folder to
+                                  # "$HOME/.local/opt/$pkg_cmd_name-v$WEBI_VERSION"
 
-pkg_post_install() {            # Required
-    pkg_link_new_version            # should probably call pkg_link_new_version()
-    webi_path_add "$pkg_common_bin" # should probably update PATH
+pkg_post_install() {              # Required
+    pkg_link_src_dst                  # should probably call pkg_link_src_dst()
+    webi_path_add "$pkg_dst_bin"      # should probably update PATH
 }
 
-pkg_post_install_message() {}   # Optional, pretty print a success message
+pkg_post_install_message() {}     # Optional, pretty print a success message
 ```
 
 ## Script API
index 95132251e0bf04815ced9d61f8e7223b493fb0ac..619534d73dd99531c4cd1ba8723fc550792749ce 100644 (file)
@@ -14,13 +14,13 @@ set -u
 pkg_cmd_name="xmpl"
 
 ## Some of these directories may be the same, in some cases
-#pkg_common_opt="$HOME/.local/opt/xmpl"
-#pkg_common_bin="$HOME/.local/opt/xmpl/bin"
-#pkg_common_cmd="$HOME/.local/opt/xmpl/bin/xmpl"
+#pkg_dst="$HOME/.local/opt/xmpl"
+#pkg_dst_bin="$HOME/.local/opt/xmpl/bin"
+#pkg_dst_cmd="$HOME/.local/opt/xmpl/bin/xmpl"
 
-#pkg_new_opt="$HOME/.local/opt/xmpl-v$WEBI_VERSION"
-#pkg_new_bin="$HOME/.local/opt/xmpl-v$WEBI_VERSION/bin"
-#pkg_new_cmd="$HOME/.local/opt/xmpl-v$WEBI_VERSION/bin/xmpl"
+#pkg_src="$HOME/.local/opt/xmpl-v$WEBI_VERSION"
+#pkg_src_bin="$HOME/.local/opt/xmpl-v$WEBI_VERSION/bin"
+#pkg_src_cmd="$HOME/.local/opt/xmpl-v$WEBI_VERSION/bin/xmpl"
 
 # Different packages represent the version in different ways
 # ex: node v12.8.0 (leading 'v')
@@ -40,9 +40,9 @@ pkg_get_current_version() {
 # For (re-)linking to the desired installed version
 # (for example: 'go' is special and needs both $HOME/go and $HOME/.local/opt/go)
 # (others like 'rg', 'hugo', and 'caddy' are single files that just get replaced)
-pkg_link_new_version() {
-    rm -rf "$pkg_common_opt"
-    ln -s "$pkg_new_opt" "$pkg_common_opt"
+pkg_link_src_dst() {
+    rm -rf "$pkg_dst"
+    ln -s "$pkg_src" "$pkg_dst"
 }
 
 pkg_pre_install() {
@@ -63,21 +63,21 @@ pkg_install() {
     pushd "$WEBI_TMP" 2>&1 >/dev/null
 
         # remove the versioned folder, just in case it's there with junk
-        rm -rf "$pkg_new_opt"
+        rm -rf "$pkg_src"
 
         # rename the entire extracted folder to the new location
         # (this will be "$HOME/.local/opt/xmpl-v$WEBI_VERSION" by default)
-        mv ./"$pkg_cmd_name"* "$pkg_new_opt"
+        mv ./"$pkg_cmd_name"* "$pkg_src"
 
     popd 2>&1 >/dev/null
 }
 
 # For updating PATHs and installing companion tools
 pkg_post_install() {
-    pkg_link_new_version
+    pkg_link_src_dst
 
     # web_path_add is defined in webi/template.bash at https://github.com/webinstall/packages
-    webi_path_add "$pkg_common_bin"
+    webi_path_add "$pkg_dst_bin"
 }
 
 pkg_post_install_message() {
index 1296ed0b25385cb00efd955cab065253223f260d..c52b018f028fa72f97b618524316476d59c0e150 100644 (file)
@@ -3,10 +3,10 @@ pkg_install() {
     pushd "$WEBI_TMP" 2>&1 >/dev/null
 
         if [ -n "$(command -v rsync 2>/dev/null | grep rsync)" ]; then
-            rsync -Krl ./xmpl*/ "$pkg_new_opt/" 2>/dev/null
+            rsync -Krl ./xmpl*/ "$pkg_src/" 2>/dev/null
         else
-            cp -Hr ./xmpl*/* "$pkg_new_opt/" 2>/dev/null
-            cp -Hr ./xmpl*/.* "$pkg_new_opt/" 2>/dev/null
+            cp -Hr ./xmpl*/* "$pkg_src/" 2>/dev/null
+            cp -Hr ./xmpl*/.* "$pkg_src/" 2>/dev/null
         fi
         rm -rf ./xmpl*
 
index 73fd2d041bb0831b6115b48cd835c49b7776b5e1..5f6a98f6b50a9a26c4d37da7110ae4e639e465d6 100644 (file)
@@ -12,10 +12,11 @@ set -e
 set -u
 
 pkg_cmd_name="caddy"
-pkg_common_opt="$HOME/.local"
+pkg_dst="$HOME/.local"
 
-# just a junk file so that the version check always fails for non-current versions
-pkg_new_opt="$HOME/.local/opt/caddy-doesntexist111"
+# the "source" here isn't used, nor very meaningful,
+# but we'll use the download location as a junk value
+pkg_src="$HOME/Downloads/$WEBI_PKG_FILE"
 
 pkg_get_current_version() {
     # 'caddy version' has output in this format:
@@ -31,7 +32,7 @@ pkg_format_cmd_version() {
     echo "$pkg_cmd_name v$my_version"
 }
 
-pkg_link_new_version() {
+pkg_link_src_dst() {
     # caddy is just a single file, no directory linking to do
     true
 }
@@ -49,34 +50,34 @@ pkg_install() {
     pushd "$WEBI_TMP" 2>&1 >/dev/null
 
         # ensure the bin dir exists
-        mkdir -p "$pkg_common_bin"
+        mkdir -p "$pkg_dst_bin"
 
         # rename the entire extracted folder to the new location
         # (this will be "$HOME/.local/bin/caddy", as set above)
 
         # ex (full directory): ./node-v13-linux-amd64/bin/node.exe
-        #mv ./"$pkg_cmd_name"* "$pkg_new_opt"
+        #mv ./"$pkg_cmd_name"* "$pkg_src"
 
         # ex (single file): ./caddy-v2.0.0-linux-amd64.exe
-        mv ./"$pkg_cmd_name"* "$pkg_common_cmd"
-        chmod a+x "$pkg_common_cmd"
+        mv ./"$pkg_cmd_name"* "$pkg_dst_cmd"
+        chmod a+x "$pkg_dst_cmd"
 
         # ex (single file, nested in directory): ./rg/rg-v13-linux-amd64
         #mv ./"$pkg_cmd_name"*/"$pkg_cmd_name"* "$pkg_commend_cmd"
-        #chmod a+x "$pkg_common_cmd"
+        #chmod a+x "$pkg_dst_cmd"
 
     popd 2>&1 >/dev/null
 }
 
 pkg_post_install() {
     # just in case we add something in the future
-    pkg_link_new_version
+    pkg_link_src_dst
 
     # web_path_add is defined in webi/template.bash at https://github.com/webinstall/packages
     # Adds "$HOME/.local/bin" to PATH
-    webi_path_add "$pkg_common_bin"
+    webi_path_add "$pkg_dst_bin"
 }
 
 pkg_post_install_message() {
-    echo "Installed 'caddy' v$WEBI_VERSION as $pkg_common_cmd"
+    echo "Installed 'caddy' v$WEBI_VERSION as $pkg_dst_cmd"
 }
index 5962242c308c5798cf9776a662285e7aaa962bcb..0ad1f2906665d21976f144b420c4597581f568ac 100644 (file)
@@ -16,8 +16,8 @@ set -u
 
 # NOTE: pkg_* variables can be defined here
 #       pkg_cmd_name
-#       pkg_new_opt, pkg_new_bin, pkg_new_cmd
-#       pkg_common_opt, pkg_common_bin, pkg_common_cmd
+#       pkg_src, pkg_src_bin, pkg_src_cmd
+#       pkg_dst, pkg_dst_bin, pkg_dst_cmd
 #
 # Their defaults are defined in webi/template.bash at https://github.com/webinstall/packages
 
@@ -34,11 +34,11 @@ pkg_get_current_version() {
     echo "$(flutter --version 2>/dev/null | head -n 1 | cut -d' ' -f2)"
 }
 
-pkg_link_new_version() {
-    # 'pkg_common_opt' will default to $HOME/.local/opt/flutter
-    # 'pkg_new_opt' will be the installed version, such as to $HOME/.local/opt/flutter-v1.17.3
-    rm -rf "$pkg_common_opt"
-    ln -s "$pkg_new_opt" "$pkg_common_opt"
+pkg_link_src_dst() {
+    # 'pkg_dst' will default to $HOME/.local/opt/flutter
+    # 'pkg_src' will be the installed version, such as to $HOME/.local/opt/flutter-v1.17.3
+    rm -rf "$pkg_dst"
+    ln -s "$pkg_src" "$pkg_dst"
 }
 
 pkg_pre_install() {
@@ -61,19 +61,19 @@ pkg_install() {
     pushd "$WEBI_TMP" 2>&1 >/dev/null
 
         # remove the versioned folder, just in case it's there with junk
-        rm -rf "$pkg_new_opt"
+        rm -rf "$pkg_src"
 
         # rename the entire extracted folder to the new location
         # (this will be "$HOME/.local/opt/flutter-v$WEBI_VERSION" by default)
-        mv ./flutter* "$pkg_new_opt"
+        mv ./flutter* "$pkg_src"
 
     popd 2>&1 >/dev/null
 }
 
 pkg_post_install() {
-    pkg_link_new_version
+    pkg_link_src_dst
 
     # web_path_add is defined in webi/template.bash at https://github.com/webinstall/packages
     # Adds "$HOME/.local/opt/flutter" to PATH
-    webi_path_add "$pkg_common_bin"
+    webi_path_add "$pkg_dst_bin"
 }
index d54a3e5a828bd4d202ca4a220ee59b87ae27bff0..43af834296d2df3a6c45f4caa9c1727987a06301 100644 (file)
@@ -12,10 +12,11 @@ set -e
 set -u
 
 pkg_cmd_name="gitea"
-pkg_common_opt="$HOME/.local"
+pkg_dst="$HOME/.local"
 
-# just a junk file so that the version check always fails for non-current versions
-pkg_new_opt="$HOME/.local/opt/gitea-doesntexist111"
+# pkg_src isn't used in this script,
+# just setting a junk value for completeness (and possibly debug output)
+pkg_src="$HOME/Downloads/$WEBI_PKG_FILE"
 
 pkg_get_current_version() {
     # 'gitea version' has output in this format:
@@ -31,7 +32,7 @@ pkg_format_cmd_version() {
     echo "$pkg_cmd_name v$my_version"
 }
 
-pkg_link_new_version() {
+pkg_link_src_dst() {
     # gitea is just a single file, no directory linking to do
     true
 }
@@ -50,22 +51,22 @@ pkg_install() {
 
         # rename the entire extracted folder to the new location
         # (this will be "$HOME/.local/bin/gitea" by default)
-        mkdir -p "$pkg_common_bin"
-        mv ./"$pkg_cmd_name"* "$pkg_common_cmd"
-        chmod a+x "$pkg_common_cmd"
+        mkdir -p "$pkg_dst_bin"
+        mv ./"$pkg_cmd_name"* "$pkg_dst_cmd"
+        chmod a+x "$pkg_dst_cmd"
 
     popd 2>&1 >/dev/null
 }
 
 pkg_post_install() {
     # just in case we add something in the future
-    pkg_link_new_version
+    pkg_link_src_dst
 
     # web_path_add is defined in webi/template.bash at https://github.com/webinstall/packages
     # Adds "$HOME/.local/bin" to PATH
-    webi_path_add "$pkg_common_bin"
+    webi_path_add "$pkg_dst_bin"
 }
 
 pkg_post_install_message() {
-    echo "Installed 'gitea' as $pkg_common_cmd"
+    echo "Installed 'gitea' v$WEBI_VERSION as $pkg_dst_cmd"
 }
index fead4b6b5cc7d938aabe96ac5726bb984f5a7e01..16a601fd6351dd5f611d6fa4eee054029e93d247 100644 (file)
@@ -43,8 +43,8 @@ pkg_cmd_name="go"
 
 # NOTE: pkg_* variables can be defined here
 #       pkg_cmd_name
-#       pkg_new_opt, pkg_new_bin, pkg_new_cmd
-#       pkg_common_opt, pkg_common_bin, pkg_common_cmd
+#       pkg_src, pkg_src_bin, pkg_src_cmd
+#       pkg_dst, pkg_dst_bin, pkg_dst_cmd
 #
 # Their defaults are defined in webi/template.bash at https://github.com/webinstall/packages
 
@@ -62,11 +62,11 @@ pkg_format_cmd_version() {
     echo "${pkg_cmd_name}${my_version}"
 }
 
-pkg_link_new_version() {
-    # 'pkg_common_opt' will default to $HOME/.local/opt/go
-    # 'pkg_new_opt' will be the installed version, such as to $HOME/.local/opt/go-v1.14.2
-    rm -rf "$pkg_common_opt"
-    ln -s "$pkg_new_opt" "$pkg_common_opt"
+pkg_link_src_dst() {
+    # 'pkg_dst' will default to $HOME/.local/opt/go
+    # 'pkg_src' will be the installed version, such as to $HOME/.local/opt/go-v1.14.2
+    rm -rf "$pkg_dst"
+    ln -s "$pkg_src" "$pkg_dst"
 
     # Go has a special $GOBIN
 
@@ -97,30 +97,30 @@ pkg_install() {
     pushd "$WEBI_TMP" 2>&1 >/dev/null
 
         # remove the versioned folder, just in case it's there with junk
-        rm -rf "$pkg_new_opt"
+        rm -rf "$pkg_src"
 
         # rename the entire extracted folder to the new location
         # (this will be "$HOME/.local/opt/go-v$WEBI_VERSION" by default)
-        mv ./"$pkg_cmd_name"* "$pkg_new_opt"
+        mv ./"$pkg_cmd_name"* "$pkg_src"
 
     popd 2>&1 >/dev/null
 }
 
 pkg_post_install() {
-    pkg_link_new_version
+    pkg_link_src_dst
 
     # web_path_add is defined in webi/template.bash at https://github.com/webinstall/packages
     # Updates PATH with
     #       "$HOME/.local/opt/go"
-    webi_path_add "$pkg_common_bin"
+    webi_path_add "$pkg_dst_bin"
     webi_path_add "$GOBIN/bin"
 
     # Install x go
     echo "Installing go extended tools (goimports, gorename, etc)"
-    "$pkg_common_cmd" get golang.org/x/tools/cmd/goimports > /dev/null 2>/dev/null
-    "$pkg_common_cmd" get golang.org/x/tools/cmd/gorename > /dev/null 2>/dev/null
-    "$pkg_common_cmd" get golang.org/x/tools/cmd/gotype > /dev/null 2>/dev/null
-    "$pkg_common_cmd" get golang.org/x/tools/cmd/stringer > /dev/null 2>/dev/null
+    "$pkg_dst_cmd" get golang.org/x/tools/cmd/goimports > /dev/null 2>/dev/null
+    "$pkg_dst_cmd" get golang.org/x/tools/cmd/gorename > /dev/null 2>/dev/null
+    "$pkg_dst_cmd" get golang.org/x/tools/cmd/gotype > /dev/null 2>/dev/null
+    "$pkg_dst_cmd" get golang.org/x/tools/cmd/stringer > /dev/null 2>/dev/null
 }
 
 pkg_post_install_message() {
index 6e3c108939934b2b6d1012614eedfaca93ca659f..1fe55efaddc9e15c9908270a829f0935facc8210 100644 (file)
@@ -16,10 +16,11 @@ set -e
 set -u
 
 pkg_cmd_name="hugo"
-pkg_common_opt="$HOME/.local"
+pkg_dst="$HOME/.local"
 
-# just a junk file so that the version check always fails for non-current versions
-pkg_new_opt="$HOME/.local/opt/hugo-doesntexist111"
+# pkg_src isn't used in this script,
+# just setting a junk value for completeness (and possibly debug output)
+pkg_src="$HOME/Downloads/$WEBI_PKG_FILE"
 
 pkg_get_current_version() {
     # 'hugo version' has output in this format:
@@ -35,7 +36,7 @@ pkg_format_cmd_version() {
     echo "$pkg_cmd_name v$my_version"
 }
 
-pkg_link_new_version() {
+pkg_link_src_dst() {
     # hugo is just a single file, no directory linking to do
     true
 }
@@ -54,18 +55,18 @@ pkg_install() {
 
         # rename the entire extracted folder to the new location
         # (this will be "$HOME/.local/opt/node-v$WEBI_VERSION" by default)
-        mkdir -p "$pkg_common_bin"
-        mv ./"$pkg_cmd_name"* "$pkg_common_cmd"
-        chmod a+x "$pkg_common_cmd"
+        mkdir -p "$pkg_dst_bin"
+        mv ./"$pkg_cmd_name"* "$pkg_dst_cmd"
+        chmod a+x "$pkg_dst_cmd"
 
     popd 2>&1 >/dev/null
 }
 
 pkg_post_install() {
     # just in case we add something in the future
-    pkg_link_new_version
+    pkg_link_src_dst
 
     # web_path_add is defined in webi/template.bash at https://github.com/webinstall/packages
     # Adds "$HOME/.local/opt/node" to PATH
-    webi_path_add "$pkg_common_bin"
+    webi_path_add "$pkg_dst_bin"
 }
index 38b842f926851418cee824a76c1bfe11ae0fc75e..e65662b742c210d07f919ff767737644cb827be2 100644 (file)
@@ -93,11 +93,11 @@ pkg_format_cmd_version() {
     echo "$pkg_cmd_name v$my_version"
 }
 
-pkg_link_new_version() {
-    # 'pkg_common_opt' will default to $HOME/.local/opt/node
-    # 'pkg_new_opt' will be the installed version, such as to $HOME/.local/opt/node-v12.8.0
-    rm -rf "$pkg_common_opt"
-    ln -s "$pkg_new_opt" "$pkg_common_opt"
+pkg_link_src_dst() {
+    # 'pkg_dst' will default to $HOME/.local/opt/node
+    # 'pkg_src' will be the installed version, such as to $HOME/.local/opt/node-v12.8.0
+    rm -rf "$pkg_dst"
+    ln -s "$pkg_src" "$pkg_dst"
 }
 
 pkg_pre_install() {
@@ -117,31 +117,31 @@ pkg_install() {
     pushd "$WEBI_TMP" 2>&1 >/dev/null
 
         # remove the versioned folder, just in case it's there with junk
-        rm -rf "$pkg_new_opt"
+        rm -rf "$pkg_src"
 
         # rename the entire extracted folder to the new location
         # (this will be "$HOME/.local/opt/node-v$WEBI_VERSION" by default)
 
         # ex (full directory): ./node-v13-linux-amd64/bin/node.exe
-        mv ./"$pkg_cmd_name"* "$pkg_new_opt"
+        mv ./"$pkg_cmd_name"* "$pkg_src"
 
         # ex (single file): ./caddy-v13-linux-amd64.exe
-        #mv ./"$pkg_cmd_name"* "$pkg_common_cmd"
-        #chmod a+x "$pkg_common_cmd"
+        #mv ./"$pkg_cmd_name"* "$pkg_dst_cmd"
+        #chmod a+x "$pkg_dst_cmd"
 
         # ex (single file, nested in directory): ./rg/rg-v13-linux-amd64
         #mv ./"$pkg_cmd_name"*/"$pkg_cmd_name"* "$pkg_commend_cmd"
-        #chmod a+x "$pkg_common_cmd"
+        #chmod a+x "$pkg_dst_cmd"
 
     popd 2>&1 >/dev/null
 }
 
 pkg_post_install() {
-    pkg_link_new_version
+    pkg_link_src_dst
 
     # web_path_add is defined in webi/template.bash at https://github.com/webinstall/packages
     # Adds "$HOME/.local/opt/node/bin" to PATH
-    webi_path_add "$pkg_common_bin"
+    webi_path_add "$pkg_dst_bin"
 }
 
 pkg_post_install_message() {
index b1f3639bd602da0b6e902f44b790cbc9e1b4c45b..ec74355c122909b5006347990ae308d638362195 100644 (file)
@@ -52,23 +52,23 @@ webi_check() {
         pkg_current_version="$(pkg_get_current_version)"
         # remove trailing '.0's for golang's sake
         my_current_version="$(echo $pkg_current_version | sed 's:\.0::g')"
-        my_new_version="$(echo $WEBI_VERSION | sed 's:\.0::g')"
+        my_src_version="$(echo $WEBI_VERSION | sed 's:\.0::g')"
         if [ -n "$(command -v pkg_format_cmd_version)" ]; then
             my_canonical_name="$(pkg_format_cmd_version "$WEBI_VERSION")"
         else
             #my_canonical_name="$WEBI_NAME $WEBI_VERSION"
             my_canonical_name="$pkg_cmd_name v$WEBI_VERSION"
         fi
-        if [ "$my_new_version" == "$my_current_version" ]; then
+        if [ "$my_src_version" == "$my_current_version" ]; then
             echo "$my_canonical_name already installed at $my_current_cmd"
             exit 0
         else
-            if [ "$my_current_cmd" != "$pkg_common_cmd" ]; then
+            if [ "$my_current_cmd" != "$pkg_dst_cmd" ]; then
                 echo "WARN: possible conflict between $my_canonical_name and $pkg_current_version at $my_current_cmd"
             fi
-            if [ -x "$pkg_new_cmd" ]; then
-                pkg_link_new_version
-                echo "switched to $my_canonical_name at $pkg_new_opt"
+            if [ -x "$pkg_src_cmd" ]; then
+                pkg_link_src_dst
+                echo "switched to $my_canonical_name at $pkg_src"
                 exit 0
             fi
           fi
@@ -168,17 +168,17 @@ webi_path_add() {
 if [ -n "$(command -v pkg_install)" ]; then
     pkg_cmd_name="${pkg_cmd_name:-$WEBI_NAME}"
 
-    pkg_common_opt="${pkg_common_opt:-$HOME/.local/opt/$pkg_cmd_name}"
-    pkg_common_bin="${pkg_common_bin:-$pkg_common_opt/bin}"
-    pkg_common_cmd="${pkg_common_cmd:-$pkg_common_bin/$pkg_cmd_name}"
+    pkg_dst="${pkg_dst:-$HOME/.local/opt/$pkg_cmd_name}"
+    pkg_dst_bin="${pkg_dst_bin:-$pkg_common/bin}"
+    pkg_dst_cmd="${pkg_dst_cmd:-$pkg_dst_bin/$pkg_cmd_name}"
 
-    pkg_new_opt="${pkg_new_opt:-$HOME/.local/opt/$pkg_cmd_name-v$WEBI_VERSION}"
-    pkg_new_bin="${pkg_new_bin:-$pkg_new_opt/bin}"
-    pkg_new_cmd="${pkg_new_cmd:-$pkg_new_bin/$pkg_cmd_name}"
+    pkg_src="${pkg_src:-$HOME/.local/opt/$pkg_cmd_name-v$WEBI_VERSION}"
+    pkg_src_bin="${pkg_src_bin:-$pkg_src/bin}"
+    pkg_src_cmd="${pkg_src_cmd:-$pkg_src_bin/$pkg_cmd_name}"
 
     [ -n "$(command -v pkg_pre_install)" ] && pkg_pre_install
 
-    echo "Installing '$pkg_cmd_name' v$WEBI_VERSION as $pkg_new_cmd"
+    echo "Installing '$pkg_cmd_name' v$WEBI_VERSION as $pkg_src_cmd"
     pkg_install
 
     [ -n "$(command -v pkg_post_install)" ] && pkg_post_install
@@ -186,7 +186,7 @@ if [ -n "$(command -v pkg_install)" ]; then
     if [ -n "$(command -v pkg_post_install_message)" ]; then
         pkg_post_install_message
     else
-        echo "Installed '$pkg_cmd_name' v$WEBI_VERSION as $pkg_new_cmd"
+        echo "Installed '$pkg_cmd_name' v$WEBI_VERSION as $pkg_src_cmd"
     fi
     echo ""
 fi