Skip to content

Commit 195191e

Browse files
Merge pull request #78 from richardkoehler/fix/windows-install-ps1-iex-pscmdlet
Fix: Simplify Windows install script
2 parents df30984 + ff2dc74 commit 195191e

4 files changed

Lines changed: 30 additions & 43 deletions

File tree

README.md

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,32 @@
44
[Docs Health](https://github.com/Brain-Modulation-Lab/DBSAnnotator/actions/workflows/docs-health.yml)
55
[Release Drafter](https://github.com/Brain-Modulation-Lab/DBSAnnotator/actions/workflows/release-drafter.yml)
66

7-
A desktop application for annotating Deep Brain Stimulation (DBS) clinical programming sessions. Built for clinicians and researchers working with DBS systems (Medtronic Percept and others).
7+
A desktop application for annotating Deep Brain Stimulation (DBS) programming sessions. Built for clinicians and researchers working with DBS systems.
88

9-
**Version:** derived from `dbs_annotator.__version__`
109
**Publisher:** Wyss Center for Bio and Neuroengineering (contact: [lucia.poma@wysscenter.ch](mailto:lucia.poma@wysscenter.ch))
1110

1211
## For End Users
1312

14-
Releases ship as **Briefcase-generated** artifacts (for example ZIP/MSI on Windows and DMG on macOS). Follow the instructions for the artifact you downloaded.
13+
You can find installation files for Windows (.msi), MacOS (.dmg) and Linux (.deb) under the [GitHub Releases](https://github.com/Brain-Modulation-Lab/DBSAnnotator/releases).
14+
However, note that the files are unsigned, so that a warning might pop up during installation. To proceed with installation, you must accept the risk and continue.
15+
In some cases, for example where your organization has strict settings, this might not be possible. In this case, try the install via PowerShell below.
1516

16-
### Windows — install from GitHub (PowerShell)
17+
### Windows — install via PowerShell
1718

18-
Unsigned **MSI** can trigger **SmartScreen**; the release **portable `.zip`** (same app as the MSI) avoids the MSI path. When that `.zip` is attached to a release, you can install per-user under `%LOCALAPPDATA%\WyssGeneva\DBSAnnotator\app` and get a Start Menu shortcut with one line (from PowerShell; for a branch other than `main`, replace `main` in the URL):
19-
20-
**Note:** `iex` only passes its own parameters — script switches (for example ``-VersionTag v0.4.0a2``) are not the same call. For parameters, use a local copy of `scripts/install.ps1` or: ``& ([scriptblock]::Create((iwr -UseBasicParsing -UserAgent "DBSAnnotator-Install/1" -Uri "https://raw.githubusercontent.com/Brain-Modulation-Lab/DBSAnnotator/main/scripts/install.ps1").Content)) -VersionTag v0.4.0a2``.
19+
In an **open PowerShell** window:
2120

2221
```powershell
23-
iex (iwr -UseBasicParsing -UserAgent "DBSAnnotator-Install/1" -Uri "https://raw.githubusercontent.com/Brain-Modulation-Lab/DBSAnnotator/main/scripts/install.ps1").Content
22+
irm https://raw.githubusercontent.com/Brain-Modulation-Lab/DBSAnnotator/main/scripts/install.ps1 | iex
2423
```
2524

26-
**No Start Menu shortcut:** set ``$env:DBS_ANNOTATOR_NO_START_MENU = "1"`` before the line above, or run with ``-NoStartMenuShortcut`` when using a script block / local `install.ps1`.
25+
From **cmd.exe** (or if execution policy blocks scripts):
2726

28-
The script picks the **newest** release that includes a `DBSAnnotator-*.zip` file (prereleases included). If your release has no `.zip` yet, tag again after [CD](.github/workflows/release.yml) has uploaded it, or use `-VersionTag vX.Y.Z` once that asset exists.
27+
```bat
28+
powershell -ExecutionPolicy Bypass -NoProfile -Command "irm https://raw.githubusercontent.com/Brain-Modulation-Lab/DBSAnnotator/main/scripts/install.ps1 | iex"
29+
```
2930

3031
### macOS / Linux — shell install (curl / wget)
3132

32-
When the release includes **raw** `.tar.gz` bundles (from CD) or a `.deb` / `.dmg`, you can install from the repo script (uses [GitHub Releases](https://github.com/Brain-Modulation-Lab/DBSAnnotator/releases); override repo with `DBS_ANNOTATOR_INSTALL_REPO` if needed):
3333

3434
```sh
3535
curl -LsSf https://raw.githubusercontent.com/Brain-Modulation-Lab/DBSAnnotator/main/scripts/install.sh | sh
@@ -39,11 +39,6 @@ curl -LsSf https://raw.githubusercontent.com/Brain-Modulation-Lab/DBSAnnotator/m
3939
wget -qO- https://raw.githubusercontent.com/Brain-Modulation-Lab/DBSAnnotator/main/scripts/install.sh | sh
4040
```
4141

42-
Pin a tag: `DBS_ANNOTATOR_VERSION=v0.4.0a1 sh` or `./install.sh v0.4.0a1`. Preview only: `sh install.sh --dry-run`.
43-
44-
- **Linux x86_64:** prefers `dbs-annotator_*_linux_x86_64-raw.tar.gz` (installs under `~/.local/lib/dbs-annotator` and symlinks `~/.local/bin/dbs-annotator`); otherwise `sudo dpkg -i` on the `.deb`.
45-
- **macOS (arm64 CI build):** prefers `DBSAnnotator-*-macos-arm64-raw.tar.gz` into `/Applications` or `~/Applications`; otherwise copies from the `.dmg`.
46-
4742
## What It Does
4843

4944
The application guides you through a DBS programming session in three steps:

docs/installation.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ Steps
3232
b. Double-click to launch — no further steps needed.
3333

3434
4. **GitHub release with portable** ``.zip`` **(``DBSAnnotator-*.zip``):** to install
35-
without using the unsigned MSI, run ``scripts/install.ps1`` (see the README
36-
``iex`` one-liner). Script parameters (for example ``-VersionTag``) need a local
37-
file or ``& ([scriptblock]::Create((iwr …).Content)) …``. It unpacks under
35+
without using the unsigned MSI, use the README one-liner
36+
(``irm https://…/install.ps1 | iex``) or a saved copy of ``scripts/install.ps1``
37+
(use parameters such as ``-VersionTag`` only when you run a local file or a
38+
script block; see the README). It unpacks under
3839
``%LOCALAPPDATA%\\WyssGeneva\\DBSAnnotator\\app`` and adds a Start Menu
39-
shortcut unless you set ``DBS_ANNOTATOR_NO_START_MENU`` or pass
40-
``-NoStartMenuShortcut``.
40+
shortcut.
4141

4242
.. note::
4343
The first launch may take 5–10 seconds while Windows extracts bundled

newsfragments/78.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Simplify `install.ps1` and update README.

scripts/install.ps1

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
#Requires -Version 5.1
2-
# Fetches DBSAnnotator-*.zip from GitHub Releases; installs to %LOCALAPPDATA%\WyssGeneva\DBSAnnotator\app.
3-
# Optional: DBS_ANNOTATOR_NO_START_MENU=1 (truthy: 1, true, yes). Repo: DBS_ANNOTATOR_INSTALL_REPO.
2+
# DBSAnnotator-*.zip from GitHub Releases → %LOCALAPPDATA%\WyssGeneva\DBSAnnotator\app + Start Menu shortcut. Override repo: DBS_ANNOTATOR_INSTALL_REPO.
43
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Medium")]
54
param(
65
[string] $GitHubRepository = $(
76
if ($env:DBS_ANNOTATOR_INSTALL_REPO) { $env:DBS_ANNOTATOR_INSTALL_REPO } else { "Brain-Modulation-Lab/DBSAnnotator" }
87
),
98
[string] $VersionTag = "",
10-
[string] $InstallRoot = "",
11-
[switch] $NoStartMenuShortcut
9+
[string] $InstallRoot = ""
1210
)
1311

1412
Set-StrictMode -Version 3.0
@@ -21,14 +19,9 @@ function Install-DbsAnnotatorApp {
2119
if ($env:DBS_ANNOTATOR_INSTALL_REPO) { $env:DBS_ANNOTATOR_INSTALL_REPO } else { "Brain-Modulation-Lab/DBSAnnotator" }
2220
),
2321
[string] $VersionTag = "",
24-
[string] $InstallRoot = "",
25-
[switch] $NoStartMenuShortcut
22+
[string] $InstallRoot = ""
2623
)
2724

28-
if ($env:DBS_ANNOTATOR_NO_START_MENU -match '^(1|true|yes)$') {
29-
$NoStartMenuShortcut = $true
30-
}
31-
3225
if ([string]::IsNullOrWhiteSpace($InstallRoot)) {
3326
$InstallRoot = Join-Path $env:LOCALAPPDATA "WyssGeneva\DBSAnnotator\app"
3427
}
@@ -92,7 +85,7 @@ set -VersionTag to a tag that has the .zip, or add the .zip to the release manua
9285
Write-Host "Asset: $($asset.name) ($([math]::Round($asset.size / 1MB, 1)) MB)"
9386
Write-Host "Install: $InstallRoot"
9487
if ($WhatIfPreference) {
95-
Write-Host "What if: would download, extract, copy files, add Start Menu shortcut (unless -NoStartMenuShortcut)."
88+
Write-Host "What if: would download, extract, copy files, add Start Menu shortcut."
9689
return
9790
}
9891
if (-not $PSCmdlet.ShouldProcess($InstallRoot, "Install DBSAnnotator (overwrite if present)")) {
@@ -129,17 +122,15 @@ set -VersionTag to a tag that has the .zip, or add the .zip to the release manua
129122
}
130123
$exe = Get-ChildItem -LiteralPath $InstallRoot -Recurse -Filter "DBSAnnotator.exe" -ErrorAction SilentlyContinue | Select-Object -First 1
131124
if (-not $exe) { throw "DBSAnnotator.exe not found under $InstallRoot after install." }
132-
if (-not $NoStartMenuShortcut) {
133-
if ($PSCmdlet.ShouldProcess("Start Menu programs", "Create DBSAnnotator shortcut")) {
134-
$programs = [Environment]::GetFolderPath("Programs")
135-
if (-not (Test-Path $programs)) { New-Item -ItemType Directory -Path $programs -Force | Out-Null }
136-
$wsh = New-Object -ComObject WScript.Shell
137-
$lnk = $wsh.CreateShortcut((Join-Path $programs "DBSAnnotator.lnk"))
138-
$lnk.TargetPath = $exe.FullName
139-
$lnk.WorkingDirectory = $exe.DirectoryName
140-
$lnk.IconLocation = $exe.FullName
141-
$lnk.Save() | Out-Null
142-
}
125+
if ($PSCmdlet.ShouldProcess("Start Menu programs", "Create DBSAnnotator shortcut")) {
126+
$programs = [Environment]::GetFolderPath("Programs")
127+
if (-not (Test-Path $programs)) { New-Item -ItemType Directory -Path $programs -Force | Out-Null }
128+
$wsh = New-Object -ComObject WScript.Shell
129+
$lnk = $wsh.CreateShortcut((Join-Path $programs "DBSAnnotator.lnk"))
130+
$lnk.TargetPath = $exe.FullName
131+
$lnk.WorkingDirectory = $exe.DirectoryName
132+
$lnk.IconLocation = $exe.FullName
133+
$lnk.Save() | Out-Null
143134
}
144135
Write-Host "Done. Run: $($exe.FullName)"
145136
} finally {

0 commit comments

Comments
 (0)