mirror of https://github.com/bcicen/ctop.git
add requirement check to install script
This commit is contained in:
parent
2e526e9b86
commit
a3b8585697
10
install.sh
10
install.sh
|
@ -6,7 +6,7 @@ KERNEL=$(uname -s)
|
||||||
function output() { echo -e "\033[32mctop-install\033[0m $@"; }
|
function output() { echo -e "\033[32mctop-install\033[0m $@"; }
|
||||||
|
|
||||||
function command_exists() {
|
function command_exists() {
|
||||||
command -v "$@" > /dev/null 2>&1
|
command -v "$@" > /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
# extract github download url matching pattern
|
# extract github download url matching pattern
|
||||||
|
@ -32,6 +32,14 @@ case $KERNEL in
|
||||||
;;
|
;;
|
||||||
esac
|
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'
|
sh_c='sh -c'
|
||||||
if [ "$CURRENT_USER" != 'root' ]; then
|
if [ "$CURRENT_USER" != 'root' ]; then
|
||||||
if command_exists sudo; then
|
if command_exists sudo; then
|
||||||
|
|
Loading…
Reference in New Issue