mirror of
https://github.com/keylase/nvidia-patch.git
synced 2024-11-22 05:27:22 +00:00
add option to export patches as JSON (#779)
This commit is contained in:
parent
e416c41eff
commit
134770c255
14
patch-fbc.sh
14
patch-fbc.sh
@ -26,13 +26,14 @@ DESCRIPTION
|
|||||||
-d VERSION Use VERSION driver version when looking for libraries
|
-d VERSION Use VERSION driver version when looking for libraries
|
||||||
instead of using nvidia-smi to detect it.
|
instead of using nvidia-smi to detect it.
|
||||||
-f Enable support for Flatpak NVIDIA drivers.
|
-f Enable support for Flatpak NVIDIA drivers.
|
||||||
|
-j Output the patch list to stdout as JSON
|
||||||
'
|
'
|
||||||
}
|
}
|
||||||
|
|
||||||
# shellcheck disable=SC2209
|
# shellcheck disable=SC2209
|
||||||
opmode="patch"
|
opmode="patch"
|
||||||
|
|
||||||
while getopts 'rshc:ld:f' flag; do
|
while getopts 'rshjc:ld:f' flag; do
|
||||||
case "${flag}" in
|
case "${flag}" in
|
||||||
r) opmode="${opmode}rollback" ;;
|
r) opmode="${opmode}rollback" ;;
|
||||||
s) silent_flag='true' ;;
|
s) silent_flag='true' ;;
|
||||||
@ -41,6 +42,7 @@ while getopts 'rshc:ld:f' flag; do
|
|||||||
l) opmode="${opmode}listversions" ;;
|
l) opmode="${opmode}listversions" ;;
|
||||||
d) manual_driver_version="$OPTARG" ;;
|
d) manual_driver_version="$OPTARG" ;;
|
||||||
f) flatpak_flag='true' ;;
|
f) flatpak_flag='true' ;;
|
||||||
|
j) opmode="dump" ;;
|
||||||
*) echo "Incorrect option specified in command line" ; exit 2 ;;
|
*) echo "Incorrect option specified in command line" ; exit 2 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@ -354,12 +356,22 @@ list_supported_versions () {
|
|||||||
get_supported_versions
|
get_supported_versions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dump_patches () {
|
||||||
|
for i in "${!patch_list[@]}"
|
||||||
|
do
|
||||||
|
echo "$i"
|
||||||
|
echo "${patch_list[$i]}"
|
||||||
|
done |
|
||||||
|
jq --sort-keys -n -R 'reduce inputs as $i ({}; . + { ($i): (input|(tonumber? // .)) })'
|
||||||
|
}
|
||||||
|
|
||||||
case "${opmode}" in
|
case "${opmode}" in
|
||||||
patch) patch ;;
|
patch) patch ;;
|
||||||
patchrollback) rollback ;;
|
patchrollback) rollback ;;
|
||||||
patchhelp) print_usage ; exit 2 ;;
|
patchhelp) print_usage ; exit 2 ;;
|
||||||
patchcheckversion) query_version_support ;;
|
patchcheckversion) query_version_support ;;
|
||||||
patchlistversions) list_supported_versions ;;
|
patchlistversions) list_supported_versions ;;
|
||||||
|
dump) dump_patches ;;
|
||||||
*) echo "Incorrect combination of flags. Use option -h to get help."
|
*) echo "Incorrect combination of flags. Use option -h to get help."
|
||||||
exit 2 ;;
|
exit 2 ;;
|
||||||
esac
|
esac
|
||||||
|
14
patch.sh
14
patch.sh
@ -26,13 +26,14 @@ DESCRIPTION
|
|||||||
-d VERSION Use VERSION driver version when looking for libraries
|
-d VERSION Use VERSION driver version when looking for libraries
|
||||||
instead of using nvidia-smi to detect it.
|
instead of using nvidia-smi to detect it.
|
||||||
-f Enable support for Flatpak NVIDIA drivers.
|
-f Enable support for Flatpak NVIDIA drivers.
|
||||||
|
-j Output the patch list to stdout as JSON
|
||||||
'
|
'
|
||||||
}
|
}
|
||||||
|
|
||||||
# shellcheck disable=SC2209
|
# shellcheck disable=SC2209
|
||||||
opmode="patch"
|
opmode="patch"
|
||||||
|
|
||||||
while getopts 'rshc:ld:f' flag; do
|
while getopts 'rshjc:ld:f' flag; do
|
||||||
case "${flag}" in
|
case "${flag}" in
|
||||||
r) opmode="${opmode}rollback" ;;
|
r) opmode="${opmode}rollback" ;;
|
||||||
s) silent_flag='true' ;;
|
s) silent_flag='true' ;;
|
||||||
@ -41,6 +42,7 @@ while getopts 'rshc:ld:f' flag; do
|
|||||||
l) opmode="${opmode}listversions" ;;
|
l) opmode="${opmode}listversions" ;;
|
||||||
d) manual_driver_version="$OPTARG" ;;
|
d) manual_driver_version="$OPTARG" ;;
|
||||||
f) flatpak_flag='true' ;;
|
f) flatpak_flag='true' ;;
|
||||||
|
j) opmode="dump" ;;
|
||||||
*) echo "Incorrect option specified in command line" ; exit 2 ;;
|
*) echo "Incorrect option specified in command line" ; exit 2 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@ -399,12 +401,22 @@ list_supported_versions () {
|
|||||||
get_supported_versions
|
get_supported_versions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dump_patches () {
|
||||||
|
for i in "${!patch_list[@]}"
|
||||||
|
do
|
||||||
|
echo "$i"
|
||||||
|
echo "${patch_list[$i]}"
|
||||||
|
done |
|
||||||
|
jq --sort-keys -n -R 'reduce inputs as $i ({}; . + { ($i): (input|(tonumber? // .)) })'
|
||||||
|
}
|
||||||
|
|
||||||
case "${opmode}" in
|
case "${opmode}" in
|
||||||
patch) patch ;;
|
patch) patch ;;
|
||||||
patchrollback) rollback ;;
|
patchrollback) rollback ;;
|
||||||
patchhelp) print_usage ; exit 2 ;;
|
patchhelp) print_usage ; exit 2 ;;
|
||||||
patchcheckversion) query_version_support ;;
|
patchcheckversion) query_version_support ;;
|
||||||
patchlistversions) list_supported_versions ;;
|
patchlistversions) list_supported_versions ;;
|
||||||
|
dump) dump_patches ;;
|
||||||
*) echo "Incorrect combination of flags. Use option -h to get help."
|
*) echo "Incorrect combination of flags. Use option -h to get help."
|
||||||
exit 2 ;;
|
exit 2 ;;
|
||||||
esac
|
esac
|
||||||
|
Loading…
Reference in New Issue
Block a user