Closed willemdh closed 6 years ago
Did you consider the command command?
command -v foo >/dev/null 2>&1 || { echo "I require foo but it's not installed. Aborting." >&2; exit 1; }
I'll give it a try. It seems like a better solution which is on independent. Tx
Hmm it doesn't work for moreutils, nor openssh-clients and sysstat. I'll leave the package check for now for them (for yum). It will only run when saving the json.
So moreutils is needed for sponge, sysstat is need for mpstat. openssh-client I'm not sure anymore.. I'll leave that one out for now. Tx for the dpkg query integrated it, please confirm if it works
Ok, I converted it to a command -v only version which is acturally quicker. Left the IsInstalled function as it could be useful.
Some code should be added for apt and zypper, but this works fro yum:
Please test if it does'nt result in any issues on apt system.