update variables _new_ => _src_, _common_ => _dst_,
[webi-installers/.git] / _example / install.bash
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() {