Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows install scripot does not really handle upgrades #3827

Closed
soerennielsen opened this issue Mar 26, 2025 · 2 comments · Fixed by #3841
Closed

Windows install scripot does not really handle upgrades #3827

soerennielsen opened this issue Mar 26, 2025 · 2 comments · Fixed by #3841
Assignees

Comments

@soerennielsen
Copy link

Describe the bug
Current install-telepresence.ps1 script adds to the path environment no matter if entries are already there.

To Reproduce
Run install script twice.
Check path environment var.

Expected behavior
Only one entry for telepresence.exe and for sshfs-win.exe

Versions (please complete the following information):
2.21.1
2.22.0

Additional context
This is the fixed script, that in addition is also marked with run as admin prop:

#Requires -RunAsAdministrator

param
(
    $Path = "$env:ProgramFiles\telepresence"
)

$current_directory = (Get-Location).path

echo "Installing telepresence to $Path"

Start-Process msiexec -Wait -verb runAs -Args "/i $current_directory\winfsp.msi /passive /qn /L*V winfsp-install.log"
Start-Process msiexec -Wait -verb runAs -Args "/i $current_directory\sshfs-win.msi /passive /qn /L*V sshfs-win-install.log"

if(!(test-path $Path))
{
    New-Item -ItemType Directory -Force -Path $Path
}

Copy-Item "telepresence.exe" -Destination "$Path" -Force
Copy-Item "wintun.dll" -Destination "$Path" -Force

# Update PATH if entries do not exist only
$currentPath = [Environment]::GetEnvironmentVariable("Path", "Machine")
@("$Path", "C:\Program Files\SSHFS-Win\bin") | Where-Object { $currentPath -notlike "*$_*" } | ForEach-Object { $currentPath = "$_;$currentPath" }
[Environment]::SetEnvironmentVariable("Path", $currentPath, "Machine")

echo "Telepresence installed to $Path"

@thallgren
Copy link
Member

Thanks for reporting this @soerennielsen . Would it be possible for you to submit a pull-request? That way, you'll get listed as a contributor to the project and get some recognition for your effort.

@thallgren thallgren self-assigned this Apr 5, 2025
thallgren added a commit that referenced this issue Apr 5, 2025
The following changes were made:
- The script now requires administrator privileges
- Telepresence is installed to "$env:ProgramFiles\telepresence"
- The Path environment is only updated when there's a need for it

Closes #3827

Signed-off-by: Thomas Hallgren <[email protected]>
@soerennielsen
Copy link
Author

Sorry, missed the notification (13 days ago 🙈).

I do not need recognition, but I will go the extra effort the next time to save you guys a bit of time.

Thanks for inclusion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants