init: upgrade capabilities

This commit is contained in:
kevinnls
2021-03-18 12:39:15 +05:30
parent 6592c067a0
commit 3fead3aecc

View File

@@ -227,6 +227,21 @@ if [[ "$1" == "--uninstall" ]]; then
fi fi
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 if [[ $# -eq 0 ]]; then
print_usage print_usage
fi fi