crystal-lang / distribution-scripts

40 stars 23 forks source link

Installer: Change dependencies validation #160

Closed electrocucaracha closed 1 year ago

electrocucaracha commented 2 years ago

The way this conditional has been implemented seems to be not working on Ubuntu Xenial Releases:

$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="16.04.7 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.7 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
$ command -v gpg
/usr/bin/gpg
$ command -v wget
/usr/bin/wget
$ if [[ -z $(command -v wget &> /dev/null) ]] || [[ -z $(command -v gpg &> /dev/null) ]]; then echo install; else echo pass; fi
install
$ if ! command -v wget &> /dev/null || ! command -v gpg &> /dev/null; then echo install; else echo pass; fi
pass
straight-shoota commented 2 years ago

This looks really strange, actually. The expression should work on xenial as it does on any other Ubuntu version.

However, checking the exit status of command seems like a better idea than testing its output. I wouldn't mind changing this. But we should probably change it everywhere in the script, not just for apt.

electrocucaracha commented 2 years ago

This looks really strange, actually. The expression should work on xenial as it does on any other Ubuntu version.

However, checking the exit status of command seems like a better idea than testing its output. I wouldn't mind changing this. But we should probably change it everywhere in the script, not just for apt.

Yeah, it's weird. I guess this bugfix can be related with the different bash versions (Xenial ~4.3). I can do all the similar changes on this script to keep some level of consistency