2018-02-20 03:30:38 +08:00
|
|
|
#!/usr/bin/env bash
|
2018-02-19 16:22:14 +08:00
|
|
|
|
2018-02-19 17:59:51 +08:00
|
|
|
VERSION=1.0.0
|
2018-02-19 16:22:14 +08:00
|
|
|
|
2018-02-20 03:30:38 +08:00
|
|
|
arch=$(uname -sm)
|
|
|
|
|
|
|
|
case "$arch" in
|
2018-02-20 07:56:35 +08:00
|
|
|
Linux\ *64) arch=linux_amd64 ;;
|
2018-02-20 03:30:38 +08:00
|
|
|
esac
|
|
|
|
|
2018-02-20 07:56:35 +08:00
|
|
|
curl -L https://github.com/cjbassi/gotop/releases/download/$VERSION/gotop-$arch.tgz > /tmp/gotop.tgz
|
|
|
|
tar xf /tmp/gotop.tgz -C /usr/bin
|
|
|
|
rm /tmp/gotop.tgz
|
2018-02-19 16:55:31 +08:00
|
|
|
|
2018-02-19 17:59:51 +08:00
|
|
|
update() {
|
|
|
|
cur_version=$(gotop -v 2>/dev/null)
|
|
|
|
if [[ $? != 0 ]]; then
|
|
|
|
download
|
|
|
|
fi
|
|
|
|
if (( "${cur_version//.}" < "${VERSION//.}" )); then
|
|
|
|
download
|
|
|
|
fi
|
|
|
|
}
|