Update setup-deps-ubuntu.bash to use portable `sudo_cmd` syntax

This commit is contained in:
richdex14 2017-09-04 13:35:16 -06:00
parent 2f9f3c0c82
commit 6252737cc1
1 changed files with 6 additions and 2 deletions

View File

@ -2,6 +2,10 @@
# curl -fsSL https://ldsconnect.org/setup-linux.bash | bash -c
# Not every platform has or needs sudo, gotta save them O(1)s...
sudo_cmd=""
((EUID)) && [[ -z "$ANDROID_ROOT" ]] && sudo_cmd="sudo"
NO_FAIL2BAN=${1}
echo ""
@ -18,7 +22,7 @@ echo " * jshint"
echo ""
echo "updating apt-get..."
sudo bash -c "apt-get update -qq -y < /dev/null" > /dev/null
$sudo_cmd bash -c "apt-get update -qq -y < /dev/null" > /dev/null
# fail2ban
#if [ -z "$(which fail2ban-server | grep fail2ban)" ]; then
@ -32,5 +36,5 @@ sudo bash -c "apt-get update -qq -y < /dev/null" > /dev/null
if [ -z "$(type -p pkg-config)" ] || [ -z "$(type -p git)" ] || [ -z "$(type -p wget)" ] || [ -z "$(type -p curl)" ] || [ -z "$(type -p gcc)" ] || [ -z "$(type -p rsync)" ] || [ -z "$(type -p python)" ]
then
echo "installing git, wget, curl, build-essential, rsync, pkg-config, python..."
sudo bash -c "apt-get install -qq -y git wget curl build-essential rsync pkg-config python < /dev/null" > /dev/null 2>/dev/null
$sudo_cmd bash -c "apt-get install -qq -y git wget curl build-essential rsync pkg-config python < /dev/null" > /dev/null 2>/dev/null
fi