Created
October 14, 2020 20:32
-
-
Save h8rt3rmin8r/25042a1f96e7d6bc15ad2404787e82f8 to your computer and use it in GitHub Desktop.
List all installed packages related to Nvidia and CUDA (outputs are formatted as JSON)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# | |
# [ nvidia-packages-list ] | |
# | |
# List all installed packages related to Nvidia and CUDA | |
# Created on 20201014 by h8rt3rmin8r (161803398@email.tg) | |
# | |
soft_check=$(which jq &>/dev/null; echo $?) | |
if [[ "${soft_check}" -ne 0 ]]; then | |
echo "ERROR: Missing required package: jq" | |
exit 1 | |
fi | |
dpkg -l \ | |
| grep -Ei '(cuda|nvidia)' \ | |
| awk '{print "{\"package\":\""$2"\",\"version\":\""$3"\",\"arch\":\""$4"\",\"system\":\""$5"\"},"}' \ | |
| tr -d '\n' \ | |
| sed 's/,$/\]/;s/^/\[/' \ | |
| jq '.' 2>/dev/null | |
exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment