From 0cd4c221d086cdbe645cdbe9ffd55791e404d1fc Mon Sep 17 00:00:00 2001 From: Caleb Bassi Date: Mon, 19 Feb 2018 11:30:38 -0800 Subject: [PATCH] Moved uninstall to new file --- README.md | 8 ++++++-- install.sh | 41 +++++++++-------------------------------- uninstall.sh | 3 +++ 3 files changed, 18 insertions(+), 34 deletions(-) create mode 100755 uninstall.sh diff --git a/README.md b/README.md index e029436..be156bd 100644 --- a/README.md +++ b/README.md @@ -13,12 +13,16 @@ Go code compiles to a single executable so you just need to somehow get that int Either manually download the latest release for your OS from the releases tab and move it into `/usr/bin`, or run this command to do it for you: ``` -curl https://raw.githubusercontent.com/cjbassi/gotop/master/install.sh | sudo sh +curl https://raw.githubusercontent.com/cjbassi/gotop/master/install.sh | sudo bash ``` If you install this way, starting gotop with the `-u` flag or pressing `u` in gotop will check to see if there is a newer version available and automatically update if so. -Windows is currently untested/unsupported but PR's for fixing that are welcome. +To uninstall, run: + +``` +curl https://raw.githubusercontent.com/cjbassi/gotop/master/uninstall.sh | sudo bash +``` ### Arch Linux diff --git a/install.sh b/install.sh index 3d8f2fa..cfc488a 100755 --- a/install.sh +++ b/install.sh @@ -1,15 +1,15 @@ -#!/bin/bash +#!/usr/bin/env bash VERSION=1.0.0 -download() { - arch=$(uname -sm) - case "$arch" in - Linux\ *64) exe=gotop-linux_amd64 ;; - esac - curl -L https://github.com/cjbassi/gotop/releases/download/$VERSION/$exe > /usr/bin/gotop - chmod +x /usr/bin/gotop -} +arch=$(uname -sm) + +case "$arch" in + Linux\ *64) exe=linux_amd64 ;; +esac + +curl -L https://github.com/cjbassi/gotop/releases/download/$VERSION/gotop-$exe > /usr/bin/gotop +chmod +x /usr/bin/gotop update() { cur_version=$(gotop -v 2>/dev/null) @@ -20,26 +20,3 @@ update() { download fi } - -uninstall() { - rm /usr/bin/gotop 2>/dev/null -} - -for opt in "$@"; do - case $opt in - --uninstall) - uninstall - exit 0 - ;; - --update) - update - exit 0 - ;; - *) - echo "unknown option: $opt" - exit 1 - ;; - esac -done - -download diff --git a/uninstall.sh b/uninstall.sh new file mode 100755 index 0000000..dbc89be --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +rm /usr/bin/gotop 2>/dev/null