From a135f4584485a12c6b4e17b96f51bfb782dd176c Mon Sep 17 00:00:00 2001 From: Bradley Cicenas Date: Fri, 8 Dec 2017 01:37:54 +0000 Subject: [PATCH] add simple output fn to installer script --- install.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 8cdd27f..884e1a6 100755 --- a/install.sh +++ b/install.sh @@ -3,6 +3,8 @@ KERNEL=$(uname -s) +function output() { echo -e "\033[32mctop-install\033[0m $@"; } + # extract github download url matching pattern function extract_url() { match=$1; shift @@ -29,10 +31,10 @@ esac TMP=$(mktemp -d "${TMPDIR:-/tmp}/ctop.XXXXX") cd ${TMP} -echo "fetching latest release info" +output "fetching latest release info" resp=$(curl -s https://api.github.com/repos/bcicen/ctop/releases/latest) -echo "fetching release checksums" +output "fetching release checksums" checksum_url=$(extract_url sha256sums.txt "$resp") wget -q $checksum_url -O sha256sums.txt @@ -41,18 +43,18 @@ cur_ctop=$(which ctop 2> /dev/null) if [[ -n "$cur_ctop" ]]; then cur_sum=$(sha256sum $cur_ctop | sed 's/ .*//') (grep -q $cur_sum sha256sums.txt) && { - echo "already up-to-date" + output "already up-to-date" exit 0 } fi -echo "fetching latest ctop" +output "fetching latest ctop" url=$(extract_url $MATCH_BUILD "$resp") wget -q --show-progress $url (sha256sum -c --quiet --ignore-missing sha256sums.txt) || exit 1 -echo "installing to /usr/local/bin" +output "installing to /usr/local/bin" chmod +x ctop-* sudo mv ctop-* /usr/local/bin/ctop -echo "done" +output "done!"