From 426e8c9c2e46adee4e5c913c67ba346a91698b79 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 15 Aug 2021 06:28:39 +0000 Subject: [PATCH] refactor!: namespace downloads to ~/Downloads/webi on Mac and Linux --- README.md | 2 +- _webi/template.sh | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index cb38b91..376623e 100644 --- a/README.md +++ b/README.md @@ -244,7 +244,7 @@ WEBI_SINGLE="" ```bash webi_check # Checks to see if the selected version is already installed (and re-links if so) -webi_download # Downloads the selected release to $HOME/Downloads/.tar.gz +webi_download # Downloads the selected release to $HOME/Downloads/webi/.tar.gz webi_extract # Extracts the download to /tmp/-/ webi_path_add /new/path # Adds /new/path to PATH for bash, zsh, and fish webi_pre_install # Runs webi_check, webi_download, and webi_extract diff --git a/_webi/template.sh b/_webi/template.sh index 01a9e3a..4a15ec5 100644 --- a/_webi/template.sh +++ b/_webi/template.sh @@ -45,7 +45,7 @@ function __bootstrap_webi() { WEBI_TMP=${WEBI_TMP:-"$(mktemp -d -t webinstall-"${WEBI_PKG:-}".XXXXXXXX)"} export _webi_tmp="${_webi_tmp:-"$HOME/.local/opt/webi-tmp.d"}" - mkdir -p "$HOME/Downloads" + mkdir -p "$HOME/Downloads/webi" mkdir -p "$HOME/.local/bin" mkdir -p "$HOME/.local/opt" @@ -150,7 +150,7 @@ function __bootstrap_webi() { if [ -n "${2:-}" ]; then my_dl="$2" else - my_dl="$HOME/Downloads/$WEBI_PKG_FILE" + my_dl="$HOME/Downloads/webi/$WEBI_PKG_FILE" fi WEBI_PKG_DOWNLOAD="${my_dl}" @@ -200,20 +200,20 @@ function __bootstrap_webi() { webi_extract() { pushd "$WEBI_TMP" > /dev/null 2>&1 if [ "tar" == "$WEBI_EXT" ]; then - echo "Extracting $HOME/Downloads/$WEBI_PKG_FILE" - tar xf "$HOME/Downloads/$WEBI_PKG_FILE" + echo "Extracting $HOME/Downloads/webi/$WEBI_PKG_FILE" + tar xf "$HOME/Downloads/webi/$WEBI_PKG_FILE" elif [ "zip" == "$WEBI_EXT" ]; then - echo "Extracting $HOME/Downloads/$WEBI_PKG_FILE" - unzip "$HOME/Downloads/$WEBI_PKG_FILE" > __unzip__.log + echo "Extracting $HOME/Downloads/webi/$WEBI_PKG_FILE" + unzip "$HOME/Downloads/webi/$WEBI_PKG_FILE" > __unzip__.log elif [ "exe" == "$WEBI_EXT" ]; then - echo "Moving $HOME/Downloads/$WEBI_PKG_FILE" - mv "$HOME/Downloads/$WEBI_PKG_FILE" . + echo "Moving $HOME/Downloads/webi/$WEBI_PKG_FILE" + mv "$HOME/Downloads/webi/$WEBI_PKG_FILE" . elif [ "xz" == "$WEBI_EXT" ]; then - echo "Inflating $HOME/Downloads/$WEBI_PKG_FILE" - unxz -c "$HOME/Downloads/$WEBI_PKG_FILE" > "$(basename "$WEBI_PKG_FILE")" + echo "Inflating $HOME/Downloads/webi/$WEBI_PKG_FILE" + unxz -c "$HOME/Downloads/webi/$WEBI_PKG_FILE" > "$(basename "$WEBI_PKG_FILE")" else # do nothing - echo "Failed to extract $HOME/Downloads/$WEBI_PKG_FILE" + echo "Failed to extract $HOME/Downloads/webi/$WEBI_PKG_FILE" exit 1 fi popd > /dev/null 2>&1 -- 2.25.1