Skip to content

Commit

Permalink
add requirement check to install script
Browse files Browse the repository at this point in the history
  • Loading branch information
bcicen committed Jun 13, 2018
1 parent 2e526e9 commit a3b8585
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ KERNEL=$(uname -s)
function output() { echo -e "\033[32mctop-install\033[0m $@"; }

function command_exists() {
command -v "$@" > /dev/null 2>&1
command -v "$@" > /dev/null 2>&1
}

# extract github download url matching pattern
Expand All @@ -32,6 +32,14 @@ case $KERNEL in
;;
esac

for req in curl wget; do
command_exists $req || {
output "missing required $req binary"
req_failed=1
}
done
[ "$req_failed" == 1 ] && exit 1

sh_c='sh -c'
if [ "$CURRENT_USER" != 'root' ]; then
if command_exists sudo; then
Expand Down

0 comments on commit a3b8585

Please sign in to comment.