gravitl / netmaker

Netmaker makes networks with WireGuard. Netmaker automates fast, secure, and distributed virtual networks.
https://netmaker.io
Other
9.5k stars 552 forks source link

Path for Netclient.exe wrong in netclient-install.ps1 #646

Closed Bastika07 closed 2 years ago

Bastika07 commented 2 years ago

Everytime i ran

. { iwr -useb https://raw.githubusercontent.com/gravitl/netmaker/master/scripts/netclient-install.ps1 } | iex; Netclient-Install -version "v0.9.4" -token ***

The Powershell Script doesn´t detect the Installed Netclient Version.

The Problem ist, that in the Script, the Testpath differs from the installed Path of Netclient.

$outpath = ""; if (Test-Path -Path "C:\ProgramData\Netclient\bin\netclient.exe") { $outpath = "C:\ProgramData\Netclient\bin\netclient.exe"; } else { $outpath = "$env:userprofile\Downloads\netclient.exe" Write-Host "'netclient.exe' is NOT installed. installing..."; Write-Host "https://github.com/gravitl/netmaker/releases/download/$version/netclient.exe"; $url = "https://github.com/gravitl/netmaker/releases/download/$version/netclient.exe" Invoke-WebRequest -Uri $url -OutFile $outpath $loc = Get-Location Copy-Item -Path "$env:userprofile\Downloads\netclient.exe" -Destination "$loc\netclient.exe"

My Netclient is sitting in: C:\ProgramData\Netclient\netclient.exe

So no "bin" Folder in the Path. Also after runing the Script, the bin Folder isn´t created.

Should the Path verification be changed to the "non bin" Path Structure?

This is the Output after running the Script everytime.

ModuleType Version Name ExportedCommands


Script 0.0 netclient-install {Netclient-Install, Quit} 'WireGuard' is installed. 'netclient.exe' is NOT installed. installing... https://github.com/gravitl/netmaker/releases/download/v0.9.4/netclient.exe re-running setup to confirm all components are installed. 'netclient' is installed.

Bastika07 commented 2 years ago

Just some debugging: I already got netclient on my pc.

Get-command "netclient.exe" gives me this Output:

CommandType Name Version Source


Application netclient.exe 0.8.5.0 C:\Windows\system32\netclient.exe

Because of this, the Scriptsection if ((Get-Command "netclient.exe" -ErrorAction SilentlyContinue) -eq $null) { if (-not (Test-Path -Path "C:\ProgramData\Netclient\bin\netclient.exe")) { New-Item -Path "C:\ProgramData\Netclient" -Name "bin" -ItemType "directory" Move-Item -Path "$env:userprofile\Downloads\netclient.exe" -Destination "C:\ProgramData\Netclient\bin\netclient.exe" $oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path $newpath = "$oldpath;C:\ProgramData\Netclient\bin" Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath $env:Path += ";C:\ProgramData\Netclient\bin" } }

is not working.

jstlouis-psd commented 2 years ago

for me my issue was a combination of the folder being missing, which was solved by creating it, but also the default install script from the key page is using the "vdev" instead of the version the server is currently running (which in my case is v.0.10.0)

. { iwr -useb https://raw.githubusercontent.com/gravitl/netmaker/master/scripts/netclient-install.ps1 } | iex; Netclient-Install -version "vdev" -token "****"

once I change that to the proper version the install ran normally (aside from some windows defender errors which can be ignored in my case)

e.g. mkdir C:\ProgramData\Netclient\bin; . { iwr -useb https://raw.githubusercontent.com/gravitl/netmaker/master/scripts/netclient-install.ps1 } | iex; Netclient-Install -version "v0.10.0" -token "****"

this may be moot as I'm sure this will be fixed as the upgrade process is defined, but thought I would still leave a comment to help anyone else.

afeiszli commented 2 years ago

Path should be set by MSI installer correctly as of 0.14.0. Closing.