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

Cette révision appartient à :
richdex14 2017-09-04 13:35:16 -06:00
Parent 2f9f3c0c82
révision 6252737cc1
1 fichiers modifiés avec 6 ajouts et 2 suppressions

Voir le fichier

@ -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