ZenitH-AT / nvidia-update

Checks for a new version of the NVIDIA driver, downloads and installs it.
MIT License
56 stars 8 forks source link

how downlaod files locally instead of downloading from GitHub since organizations will block this site- https://raw.githubusercontent.com/ #8

Closed Pkistampally closed 1 year ago

Pkistampally commented 1 year ago

Hello Robert,

Thank you in helping the community with your PS script, we usually use "ELPumpo /TinyNvidiaupdatechecker" but recently it seems to be having lot of issues.. So we would like to teat your PS1 script and we did. while doing so, our company blocked the content download from GitHub especially from these two lines in your code.. and this is not only my company but usually happens in many institutions since they want to be extra careful in downloading the content for external sources .. New-Variable -Name "gpuDataFileUrl" -Value "https://raw.githubusercontent.com/ZenitH-AT/nvidia-data/main/gpu-data.json" -Option Constant New-Variable -Name "osDataFileUrl" -Value "https://raw.githubusercontent.com/ZenitH-AT/nvidia-data/main/os-data.json" -Option Constant

can we modify these lines where in we point to a local file and I call those files locally. please help..

image

ZenitH-AT commented 1 year ago

Assuming pastebin isn't blocked, you can always host these files on pastebin and replace the URL in the script with the raw pastebin link.

If you want to use a file path, you need to change the lines later on in the code like this:

$gpuId = (Get-Content $gpuDataFilePath | Out-String | ConvertTo-Json | ConvertFrom-Json).$gpuType.$GpuName

ConvertTo-Json may not be required but best to keep it in. $osData doesn't require | ConvertTo-Json | ConvertFrom-Json.

In a future update, I'll probably add the ability to use a different URL or even a file path. I'll keep this issue open until that's done.


P.S. The error shown is actually because PowerShell ISE doesn't understand ReadKey for the press any key to exit functionality. But yeah, GPU data couldn't be determined because the request failed.

Pkistampally commented 1 year ago

Yes, Pastebin seems to be blocked as well screenshot below. I think we need to build something which will refer to a file locally. I see that you have mentioned above , but i am not really sure how to Implement it . new to coding.. :)

image

ZenitH-AT commented 1 year ago

Replace these lines:

$gpuId = (Invoke-RestMethod -Uri $gpuDataFileUrl | ConvertTo-Json | ConvertFrom-Json).$gpuType.$GpuName
$osData = Invoke-RestMethod -Uri $osDataFileUrl

with:

$gpuId = (Get-Content "gpu-data.json" | ConvertFrom-Json).$gpuType.$GpuName
$osData = Get-Content "os-data.json" | ConvertFrom-Json

It might be better to replace the "gpu-data.json" to the full path to the file like "C:\Users\user\Desktop\gpu-data.json".


I'll keep this issue open until I've implemented custom URL/path support.

ZenitH-AT commented 1 year ago

Fixed by https://github.com/ZenitH-AT/nvidia-update/commit/23033654d31fb4600ffa2ea33fb06143d6f5fcff. Will be in the next release once I've refined a few things.

Pkistampally commented 1 year ago

should I copy the updated script now and run it once.

Pkistampally commented 1 year ago

or should I wait until it is fully released.. i see the .ps1 file updated 3 hours ago so just copied the script and ran on my system by renaming the file...

image

ZenitH-AT commented 1 year ago

You need to run it specifying the file path like .\rnvidia.ps1 -GpuDataFileUrl "C:\temp\gpu-data.json" -OsDataFileUrl "C:\temp\os-data.json".

No need to wait for it to be fully released. I'm going to release a new version when a few other changes I have been working on are ready. I'll update README.md then, to add documentation for these new parameters, too.