-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist-nvidia.sh
executable file
·35 lines (26 loc) · 1.04 KB
/
list-nvidia.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#! /bin/bash
#
# script: list-nvidia.sh
# author: Craig Sanders <cas@taz.net.au>
# license: Public Domain (this script is too trivial to be anything else)
# options:
# default/none list the packages, one per line
# -v verbose (dpkg -l) list the packages
# -h hold the packages with apt-mark
# -u unhold the packages with apt-mark
# build an array of currently-installed nvidia packages.
#PKGS=$(dlocate -l nvidia cuda vdpau | awk '/^[hi]i/ {print $2}' | sed -e 's/:.*//')
#PKGS=$(dlocate -l nvidia cuda vdpau | awk '/^[hi]i/ {print $2}')
PKGS=( $(dpkg -l '*nvidia*' '*cuda*' '*vdpau*' 2>/dev/null| awk '/^[hi][^n]/ && ! /mesa/ {print $2}') )
#PKGS=$(for p in nvidia cuda vdpau ; do apt-cache search "$p" ; done |
# cut -d" " -f1 | xargs -d'\n' dpkg -l 2>/dev/null |
# awk '/^[hi]i/ {print $2}')
if [ "$1" == "-v" ] ; then
dpkg -l "${PKGS[@]}"
elif [ "$1" == "-h" ] ; then
apt-mark hold "${PKGS[@]}"
elif [ "$1" == "-u" ] ; then
apt-mark unhold "${PKGS[@]}"
else
printf "%s\n" "${PKGS[@]}"
fi