Skip to content

Commit ce2ae0a

Browse files
committed
Add Notion
1 parent e6d1b13 commit ce2ae0a

5 files changed

Lines changed: 91 additions & 0 deletions

File tree

Apps/Notion/detect.ps1

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#region Setup
2+
$AppName = "Notion"
3+
$CommonLocation = "Programs\Notion\Uninstall Notion.exe"
4+
5+
$Locations = @(
6+
# User Locations
7+
[string](Join-path $env:LOCALAPPDATA $CommonLocation)
8+
9+
# System Locations
10+
[string](Join-path $env:ProgramFiles $CommonLocation)
11+
[string](Join-path ${env:ProgramFiles(x86)} $CommonLocation)
12+
)
13+
#endregion
14+
15+
############
16+
17+
#region Define Functions
18+
function Test-FilePresence {
19+
param ($f)
20+
if(Test-Path $f){
21+
Write-Output "Located at '$f'"
22+
exit 0
23+
}
24+
}
25+
function Find-UninstallKey {
26+
param ($n)
27+
$x = @(
28+
# User Locations
29+
"Registry::HKEY_CURRENT_USER\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
30+
"Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall"
31+
32+
# System Locations
33+
"Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
34+
"Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
35+
) | ForEach-Object {
36+
if(Test-Path $_){
37+
Get-ChildItem $_ | ForEach-Object {
38+
Get-ItemProperty $_.PSPath
39+
} | Where-Object {
40+
$_.DisplayName -like "*$n*"
41+
}
42+
}
43+
}
44+
if($null -ne $x){
45+
Write-Output "Found Uninstall Keys"
46+
exit 0
47+
}
48+
}
49+
#endregion
50+
#region Check Presence
51+
# confirm files don't exist on common paths
52+
$Locations | ForEach-Object {
53+
Test-FilePresence -f $_
54+
}
55+
56+
# confirm no matching products installed, in case installed in a different directory
57+
Find-UninstallKey -n $AppName
58+
59+
exit 1
60+
#endregion

Apps/Notion/download.ps1

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<#
2+
.DESCRIPTION
3+
Script downloads installer for the software.
4+
Since (in most cases) we aren't allowed to redistribute the installers, a script to download them on demand is provided instead.
5+
6+
To use, fill out the parameters in the script, so all you need to do is run ./download.ps1
7+
8+
For GitHub Releases that change, a script is provided in /scripts/Get-LatestGitHubRelease.ps1 to get the latest link which you can pass in via -URI.
9+
10+
(this download script could probably be improved later down the line across the board)
11+
12+
.EXAMPLE
13+
# Get the latest ARM version of PowerShell
14+
$URI = (& '../../Scripts/Get-LatestGitHubRelease.ps1' -Repo 'PowerShell/PowerShell' -Filter {$_.name -like '*win-arm64.msi'}).DownloadURI,
15+
./download.ps1 -URI $URI -OutFileName 'ps7-win-arm64.msi'
16+
#>
17+
[CmdletBinding()]
18+
param(
19+
[Parameter()]
20+
[uri]$URI = 'https://www.notion.com/desktop/windows/download',
21+
[Parameter()]
22+
[string]$OutFileName = 'Notion-Installer.exe'
23+
)
24+
25+
$OutPath = Join-Path -Path (Join-Path $PSScriptRoot 'source') -ChildPath $OutFileName
26+
Invoke-RestMethod -Method Get -Uri $URI -OutFile $OutPath -UseBasicParsing -ErrorAction Stop
27+
28+
return $OutFileName

Apps/Notion/logo.png

2.65 KB
Loading

Apps/Notion/source/install.cmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Notion-Installer.exe /S

Apps/Notion/source/uninstall.cmd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:: User:
2+
cmd.exe /c ""%LOCALAPPDATA%\Programs\Notion\Uninstall Notion.exe" /S"

0 commit comments

Comments
 (0)