From 3fead3aecc56ab4529bbdfd914daff9cba201e0c Mon Sep 17 00:00:00 2001 From: kevinnls <57634663+kevinnls@users.noreply.github.com> Date: Thu, 18 Mar 2021 12:39:15 +0530 Subject: [PATCH] init: upgrade capabilities --- bak-old.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bak-old.sh b/bak-old.sh index 0baaa4e..3fef4b6 100755 --- a/bak-old.sh +++ b/bak-old.sh @@ -227,6 +227,21 @@ if [[ "$1" == "--uninstall" ]]; then fi fi +if [[ "$1" == "--up" ]]; then + if is_command curl; then + downloader='curl -fsSL' + elif is_command wget; then + downloader='wget -qO-' + else + echo -e "${txt_red}${txt_bold}ERR: wget or curl required for upgrading bak-old.sh${txt_0}" + fi + latest_version="$(${downloader} 'https://api.github.com/repos/kevinnls/bak-old/releases/latest' | awk -F \" '/tag_name/ {print $(NF-1)}')" + download_url="https://github.com/kevinnls/bak-old/releases/download/${latest_version}/install.sh" + + ${downloader} ${download_url} | bash + exit 0 +fi + if [[ $# -eq 0 ]]; then print_usage fi