Wednesday, May 1, 2024
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 2629  / 2 Years ago, mon, august 22, 2022, 2:44:14

I am writing an installation automation BASH script. I'd like to install the nvme-cli package only if an NVMe SSD is actually present.
I couldn't find a simple way to query the hardware (say, using lshw) to get a kind-of-yes-or-no answer.
Any of you can give a way to extract the specific answer from within a BASH script?
I'd like to use the case conditioning to either install it or not.


More From » command-line

 Answers
0

In some cases, free space is an issue, besides, i am a firm believer in not installing redundant packaged as a rule, so, eventually I went with:


 NVMECOUNT=`lsblk | grep nvme | wc -l`
if [ $NVMECOUNT -gt 1 ]
then
apt -y install nvme-cli
fi

Thanks!


[#1516] Tuesday, August 23, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ickump

Total Points: 234
Total Questions: 124
Total Answers: 111

Location: Jordan
Member since Fri, Apr 8, 2022
2 Years ago
;