Skip to content

Commit 715e16c

Browse files
committed
Update chocolateyinstall.ps1
1 parent ec6368c commit 715e16c

File tree

5 files changed

+88
-72
lines changed

5 files changed

+88
-72
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Made with <img src="https://raw.githubusercontent.com/farag2/Sophia-Script-for-W
4949

5050
* [How to use](#how-to-use)
5151
* [Download via PowerShell](#download-via-powershell)
52+
* [Download via Chocolatey](#download-via-chocolatey)
5253
* [Manual method](#manual-method)
5354
* [How to run the specific function(s)](#how-to-run-the-specific-functions)
5455
* [Wrapper](#wrapper)
@@ -85,6 +86,20 @@ The command will download and expand the latest Sophia Script archive (`without
8586
iwr sl.sophia.team -useb | iex
8687
```
8788

89+
### Download via Chocolatey
90+
91+
The command will download and expand the latest Sophia Script archive (`without running`) according which Windows it is run on. If you run it on Windows 11, it will download Sophia Script for `Windows 11`. For `PowerShell 5.1` by default is not otherwise specified.
92+
93+
```powershell
94+
choco install sophia --force -y
95+
```
96+
97+
Download `Sophia Script for Windows` for `PowerShell 7`.
98+
99+
```powershell
100+
choco install sophia --params "/PS7" --force -y
101+
```
102+
88103
### Manual method
89104

90105
* Download an [archive](https://github.com/farag2/Sophia-Script-for-Windows/releases/latest) according to your Windows and PowerShell versions;

chocolatey/tools/chocolateyinstall.ps1

Lines changed: 25 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
<#
22
.SYNOPSIS
3-
Get direct URL of Sophia Script archive, depending on which Windows or PowerShell versions are used to
3+
Get direct URL of Sophia Script archive, depending on which Windows it is run on
44
55
.SYNOPSIS
6-
For example, if you start script on Windows 11 via PowerShell 5.1 you will start downloading Sophia Script for Windows 11 PowerShell 5.1
6+
For example, if you start script on Windows 11 you will start downloading Sophia Script for Windows 11
77
8+
.EXAMPLE To download for PowerShell 5.1
9+
choco install sophia --force -y
10+
11+
.EXAMPLE To download for PowerShell 7
12+
choco install sophia --params "/PS7" --force -y
813
#>
914
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
1015

11-
if ($Host.Version.Major -eq 5)
12-
{
13-
# Progress bar can significantly impact cmdlet performance
14-
# https://github.com/PowerShell/PowerShell/issues/2138
15-
$Script:ProgressPreference = "SilentlyContinue"
16-
}
17-
1816
$Parameters = @{
1917
Uri = "https://api.github.com/repos/farag2/Sophia-Script-for-Windows/releases/latest"
2018
UseBasicParsing = $true
@@ -46,6 +44,9 @@ $Parameters = @{
4644
}
4745
$JSONVersions = Invoke-RestMethod @Parameters
4846

47+
$null = $packageParameters
48+
$packageParameters = $env:chocolateyPackageParameters
49+
4950
switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
5051
{
5152
"17763"
@@ -55,15 +56,6 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
5556
{
5657
$LatestRelease = $JSONVersions.Sophia_Script_Windows_10_LTSC2019
5758
$URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.10.LTSC.2019.v$LatestRelease.zip"
58-
$Parameters = @{
59-
Uri = $URL
60-
OutFile = "$DownloadsFolder\Sophia.Script.zip"
61-
UseBasicParsing = $true
62-
Verbose = $true
63-
}
64-
Invoke-WebRequest @Parameters
65-
66-
$Version = "Windows_10_LTSC2019"
6759
}
6860
else
6961
{
@@ -89,13 +81,6 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
8981
{
9082
$LatestRelease = $JSONVersions.Sophia_Script_Windows_10_LTSC2021
9183
$URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.10.LTSC.2021.v$LatestRelease.zip"
92-
$Parameters = @{
93-
Uri = $URL
94-
OutFile = "$DownloadsFolder\Sophia.Script.zip"
95-
UseBasicParsing = $true
96-
Verbose = $true
97-
}
98-
Invoke-WebRequest @Parameters
9984
}
10085
else
10186
{
@@ -116,72 +101,43 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
116101
}
117102
"19045"
118103
{
119-
if ($Host.Version.Major -eq 5)
104+
if ($packageParameters)
120105
{
121-
$LatestRelease = $JSONVersions.Sophia_Script_Windows_10_PowerShell_5_1
122-
$URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.10.v$LatestRelease.zip"
123-
$Parameters = @{
124-
Uri = $URL
125-
OutFile = "$DownloadsFolder\Sophia.Script.zip"
126-
UseBasicParsing = $true
127-
Verbose = $true
106+
if ($packageParameters.Contains('PS7'))
107+
{
108+
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_7
109+
$URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.10.PowerShell.7.v$LatestRelease.zip"
128110
}
129-
Invoke-WebRequest @Parameters
130111
}
131112
else
132113
{
133-
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_7
134-
$URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.10.PowerShell.7.v$LatestRelease.zip"
135-
$Parameters = @{
136-
Uri = $URL
137-
OutFile = "$DownloadsFolder\Sophia.Script.zip"
138-
UseBasicParsing = $true
139-
Verbose = $true
140-
}
141-
Invoke-WebRequest @Parameters
114+
$LatestRelease = $JSONVersions.Sophia_Script_Windows_10_PowerShell_5_1
115+
$URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.10.v$LatestRelease.zip"
142116
}
143117
}
144-
{$_ -ge 22631}
118+
{$_ -ge 26100}
145119
{
146120
# Check for Windows 11 LTSC 2024
147121
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ProductName) -notmatch "LTSC 2024")
148122
{
149-
if ($Host.Version.Major -eq 5)
123+
if ($packageParameters)
150124
{
151-
$LatestRelease = $JSONVersions.Sophia_Script_Windows_11_PowerShell_5_1
152-
$URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.v$LatestRelease.zip"
153-
$Parameters = @{
154-
Uri = $URL
155-
OutFile = "$DownloadsFolder\Sophia.Script.zip"
156-
UseBasicParsing = $true
157-
Verbose = $true
125+
if ($packageParameters.Contains('PS7'))
126+
{
127+
$LatestRelease = $JSONVersions.Sophia_Script_Windows_11_PowerShell_7
128+
$URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.PowerShell.7.v$LatestRelease.zip"
158129
}
159-
Invoke-WebRequest @Parameters
160130
}
161131
else
162132
{
163-
$LatestRelease = $JSONVersions.Sophia_Script_Windows_11_PowerShell_7
164-
$URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.PowerShell.7.v$LatestRelease.zip"
165-
$Parameters = @{
166-
Uri = $URL
167-
OutFile = "$DownloadsFolder\Sophia.Script.zip"
168-
UseBasicParsing = $true
169-
Verbose = $true
170-
}
171-
Invoke-WebRequest @Parameters
133+
$LatestRelease = $JSONVersions.Sophia_Script_Windows_11_PowerShell_5_1
134+
$URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.v$LatestRelease.zip"
172135
}
173136
}
174137
else
175138
{
176139
$LatestRelease = $JSONVersions.Sophia_Script_Windows_11_LTSC2024
177140
$URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.LTSC.2024.v$LatestRelease.zip"
178-
$Parameters = @{
179-
Uri = $URL
180-
OutFile = "$DownloadsFolder\Sophia.Script.zip"
181-
UseBasicParsing = $true
182-
Verbose = $true
183-
}
184-
Invoke-WebRequest @Parameters
185141
}
186142
}
187143
}

docs/README_de-de.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Mit <img src="https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows
4949

5050
* [Verwendung](#verwendung)
5151
* [Herunterladen über PowerShell](#herunterladen-über-powershell)
52+
* [Herunterladen über Chocolatey](#herunterladen-über-chocolatey)
5253
* [Manuelle Methode](#manuelle-methode)
5354
* [Verwendung von spezifischen Funktionen](#verwendung-von-spezifischen-funktionen)
5455
* [Wrapper](#wrapper)
@@ -79,12 +80,26 @@ Der Befehl lädt das neueste Sophia Script-Archiv herunter und extrahiert es (`o
7980
iwr script.sophia.team -useb | iex
8081
```
8182

82-
Der Befehl lädt das neueste Sophia Script-Archiv (ohne es auszuführen) aus dem letzten verfügbaren Commit herunter und erweitert es, je nachdem, auf welchen Windows- und PowerShell-Versionen es ausgeführt wird.
83+
Der Befehl lädt das neueste Sophia Script-Archiv (`ohne es auszuführen`) aus dem letzten verfügbaren Commit herunter und erweitert es, je nachdem, auf welchen Windows- und PowerShell-Versionen es ausgeführt wird.
8384

8485
```powershell
8586
iwr sl.sophia.team -useb | iex
8687
```
8788

89+
### Herunterladen über Chocolatey
90+
91+
Der Befehl lädt das neueste Sophia Script-Archiv herunter und erweitert es (`ohne es auszuführen)`, je nachdem, unter welchem Windows er ausgeführt wird. Wenn Sie ihn unter Windows 11 ausführen, wird Sophia Script für `Windows 11` heruntergeladen. Für `PowerShell 5.1` ist standardmäßig nichts anderes angegeben.
92+
93+
```powershell
94+
choco install sophia --force -y
95+
```
96+
97+
Download `Sophia Script for Windows` for `PowerShell 7`.
98+
99+
```powershell
100+
choco install sophia --params "/PS7" --force -y
101+
```
102+
88103
### Manuelle Methode
89104

90105
* Laden Sie ein [Archiv](https://github.com/farag2/Sophia-Script-for-Windows/releases/latest) entsprechend Ihrer Windows- und PowerShell-Version herunter;

docs/README_ru-ru.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949

5050
* [Как использовать](#как-использовать)
5151
* [Скачать через PowerShell](#скачать-через-powershell)
52+
* [Скачать через Chocolatey](#скачать-через-chocolatey)
5253
* [Вручную](#вручную)
5354
* [Как выполните конкретную функцию(и)](#как-выполните-конкретную-функциюи)
5455
* [Wrapper](#wrapper)
@@ -85,6 +86,20 @@ iwr script.sophia.team -useb | iex
8586
iwr sl.sophia.team -useb | iex
8687
```
8788

89+
### Скачать через Chocolatey
90+
91+
Команда скачает и распакуют последнюю версию архива Sophia Script (`без последующего запуска`) согласно версии Windows, на которой она запускалась. Допустим, если вы запустите ее на Windows 11, то скачается Sophia Script для `Windows 11`. По умолчанию для `PowerShell 5.1`, если не указано обратное.
92+
93+
```powershell
94+
choco install sophia --force -y
95+
```
96+
97+
Скачать `Sophia Script for Windows` для `PowerShell 7`.
98+
99+
```powershell
100+
choco install sophia --params "/PS7" --force -y
101+
```
102+
88103
### Вручную
89104

90105
* Скачайте [архив](https://github.com/farag2/Sophia-Script-for-Windows/releases/latest) согласно версиям вашей Windows и PowerShell;

docs/README_uk-ua.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
## Зміст
4949

5050
* [Як користуватися](#як-користуватися)
51-
* [Як завантажити Sophia Script через PowerShell](#завантажити-через-powershell)
51+
* [Завантажити через PowerShell](#завантажити-через-powershell)
52+
* [Завантажити через Chocolatey](#завантажити-через-chocolatey)
5253
* [Вручну](#вручну)
5354
* [Як запустити певну функцію(ї)](#як-запустити-певну-функціюї)
5455
* [Wrapper](#wrapper)
@@ -71,7 +72,7 @@
7172
>
7273
> `Sophia Script для Windows` може не працювати на "самопальних" збірках Windows. Особливо, якщо збірка була створена так, що в ній спеціально було зламано Microsoft Defender і вимкнено телеметрію, вирізавши системні компоненти.
7374
74-
## Завантажити через PowerShell
75+
### Завантажити через PowerShell
7576

7677
Команда завантажить і розпакує останній архів Sophia Script (`без запуску`) відповідно до того, під якою версією Windows і PowerShell він запускається. Якщо запустити її, наприклад, в Windows 11 через PowerShell 5.1, вона завантажить Sophia Script для `Windows 11 PowerShell 5.1`.
7778

@@ -85,6 +86,20 @@ iwr script.sophia.team -useb | iex
8586
iwr sl.sophia.team -useb | iex
8687
```
8788

89+
### Завантажити через Chocolatey
90+
91+
TКоманда завантажить і розпакує останню версію архіву Sophia Script (`без подальшого запуску`) згідно з версією Windows, на якій вона запускалася. Припустимо, якщо ви запустите її на Windows 11, то завантажиться Sophia Script для `Windows 11`. За замовчуванням для `PowerShell 5.1`, якщо не вказано зворотне.
92+
93+
```powershell
94+
choco install sophia --force -y
95+
```
96+
97+
Завантажити `Sophia Script for Windows` для `PowerShell 7`.
98+
99+
```powershell
100+
choco install sophia --params "/PS7" --force -y
101+
```
102+
88103
### Вручну
89104

90105
* Завантажити [архів](https://github.com/farag2/Sophia-Script-for-Windows/releases/latest) згідно з вашою версією Windows і PowerShell;

0 commit comments

Comments
 (0)