From 95b93c60d9a3a10615d7dc502664154642dbd03d Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Fri, 12 Feb 2021 16:33:15 +0000 Subject: [PATCH] test: Invert negative bash assertions In bash `-n` is `non zero length` which is the opposite of `-z` meaning `zero length`. `-n` is semantically identical to `! -z` but `-n`. Signed-off-by: Joe Groocock --- misc/make-deps.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/misc/make-deps.sh b/misc/make-deps.sh index 9d8ff40d..a9263d2f 100755 --- a/misc/make-deps.sh +++ b/misc/make-deps.sh @@ -40,11 +40,11 @@ if [ -z "$YUM" -a -z "$APT" -a -z "$BREW" -a -z "$PACMAN" ]; then fi # I think having both installed confused golang somehow... -if [ ! -z "$YUM" ] && [ ! -z "$APT" ]; then +if [ -n "$YUM" -a -n "$APT" ]; then echo "You have both $APT and $YUM installed. Please check your deps manually." fi -if [ ! -z "$YUM" ]; then +if [ -n "$YUM" ]; then $sudo_command $YUM install -y libvirt-devel $sudo_command $YUM install -y augeas-devel $sudo_command $YUM install -y ruby-devel rubygems @@ -53,7 +53,7 @@ if [ ! -z "$YUM" ]; then $sudo_command $YUM install -y gcc make rpm-build libffi-devel bsdtar mkosi || true $sudo_command $YUM install -y graphviz || true # for debugging fi -if [ ! -z "$APT" ]; then +if [ -n "$APT" ]; then $sudo_command $APT install -y libvirt-dev || true $sudo_command $APT install -y libaugeas-dev || true $sudo_command $APT install -y ruby ruby-dev || true @@ -69,24 +69,24 @@ if [ ! -z "$APT" ]; then $sudo_command $APT install -y graphviz # for debugging fi -if [ ! -z "$BREW" ]; then +if [ -n "$BREW" ]; then # coreutils contains gtimeout, gstat, etc $BREW install pkg-config libvirt augeas coreutils || true fi -if [ ! -z "$PACMAN" ]; then +if [ -n "$PACMAN" ]; then $sudo_command $PACMAN -S --noconfirm --asdeps --needed libvirt augeas rubygems libpcap fi if ! in_ci; then - if [ ! -z "$YUM" ]; then + if [ -n "$YUM" ]; then if [ -z "$GO" ]; then $sudo_command $YUM install -y golang golang-googlecode-tools-stringer || $sudo_command $YUM install -y golang-bin # centos-7 epel fi # some go dependencies are stored in mercurial $sudo_command $YUM install -y hg fi - if [ ! -z "$APT" ]; then + if [ -n "$APT" ]; then $sudo_command $APT update if [ -z "$GO" ]; then $sudo_command $APT install -y golang @@ -96,13 +96,13 @@ if ! in_ci; then fi $sudo_command $APT install -y build-essential packagekit mercurial fi - if [ ! -z "$PACMAN" ]; then + if [ -n "$PACMAN" ]; then $sudo_command $PACMAN -S --noconfirm --asdeps --needed go gcc pkg-config fi fi # attempt to workaround old ubuntu -if [ ! -z "$APT" ] && [ "$goversion" -lt "$mingoversion" ]; then +if [ -n "$APT" -a "$goversion" -lt "$mingoversion" ]; then echo "install golang from a ppa." $sudo_command $APT remove -y golang $sudo_command $APT install -y software-properties-common # for add-apt-repository