87 Commits

Author SHA1 Message Date
Ross Smith II
643cfb0da8 Merge branch 'develop' into master 2020-10-22 13:24:31 -07:00
Jakub Čábera
9b29bbb711 fix(core): Fosshub download (#4051)
https://github.com/Ash258/Scoop-Core/releases/tag/0.5.0.1
2020-07-01 10:57:59 +02:00
Jakub Čábera
22a59866c7 fix(install): Aria2 inline progress negative values (#4053) 2020-07-01 10:56:39 +02:00
Jakub Čábera
6df80c1aee fix(tests): Force pester v4 (#4040) 2020-07-01 10:23:44 +02:00
Greg Hutchinson
22fd6986bf fix(git): Don't execute autostart programs when executing git commands (#3993) 2020-05-21 19:54:44 +02:00
Brian Jubelirer
078b29bc80 chore(update): Update outdated PowerShell 5 warning (#3986) 2020-05-17 12:44:31 +02:00
Jakub Čábera
33a357241d feat(aria2): Inline progress (#3987) 2020-05-17 12:41:24 +02:00
Richard Kuhnt
573e0933cf Merge branch 'master' into develop 2020-05-14 19:39:49 +02:00
Richard Kuhnt
96de9c14bb hotfix(download): Progress bar on small files
Closes #3923
2020-05-14 19:39:35 +02:00
Hsiao-nan Cheung
7995f99dc1 fix(install): [Array]::Reverse error (#3976) 2020-05-12 21:08:43 +02:00
Hsiao-nan Cheung
f91968cb16 fix(install): let pathes in 'env_add_path' be added ascendantly (#3788)
Co-Authored-By: Chawye Hsu <chawyehsu@hotmail.com>
2020-05-11 19:05:33 +02:00
NilsonPark
48f121e466 core(install): Readd "Don't send referer to portableapps.com" (#3961)
PortableApps still get hosted on download3.portableapps.com
Reverts #2401
2020-05-05 12:31:39 +02:00
Chawye Hsu
eada459be9 chore(scoop): Remove temporary code from the scoop executable (#3898) 2020-04-20 15:30:31 +02:00
Jakub Čábera
398ccea2ae feat(checkver): Present script property (#3900) 2020-04-20 15:29:10 +02:00
Hugo Locurcio
50df0c52c4 chore(hold): Replace "locked" terminology with "held" for consistency (#3917) 2020-04-20 15:27:55 +02:00
Samuel Lorétan
e6b355eae0 feat(install): Follow HTTP redirections when downloading a file (#3902)
Co-Authored-By: Jakub Čábera <cabera.jakub@gmail.com>
2020-04-20 15:26:27 +02:00
Hsiao-nan Cheung
4eba120897 fix(install): fix 'failed' function (#3867) 2020-03-01 12:49:20 +01:00
Hsiao-nan Cheung
fe01ed52d5 fix(install): fix wrong output of 'install/failed' (#3784) 2020-02-29 14:24:08 +01:00
Chawye Hsu
ad9f7c6ff1 feat(checkup): Add check_envs_requirements 2020-02-23 13:55:19 +01:00
Chawye Hsu
062e6d7973 feat(diagnostic): Add check_envs_requirements 2020-02-23 13:55:19 +01:00
Jakub Čábera
48bb96a3d8 feat: Add configuration option for default architecture (#3778)
- Closes #3770
- New available command: `scoop config 'default-architecture' '32bit|64bit'`
2019-12-16 11:29:25 +01:00
linsui
e0c5ac2396 fix(scoop-info): check bucket of installed app (#3740)
Co-Authored-By: Jakub Čábera <cabera.jakub@gmail.com>
2019-12-02 12:43:39 +01:00
Sergio Livi
7e32139322 fix(git): enforce pull without rebase (#3765)
Prevent issues if user has `pull.rebase` set `interactive` in global gitconfig
2019-12-02 12:36:58 +01:00
Ross Smith II
a9fa775d59 chore(buckets.json): Update scoop-nonportable URL (#3776) 2019-12-01 12:27:29 +01:00
Chawye Hsu
5afad4e3d1 feat(list): Display main bucket name (#3759) 2019-11-20 20:15:05 +01:00
Richard Kuhnt
8ac23f8fbc feat(autoupdate): Add $urlNoExt and $basenameNoExt substitutions (#3742)
Mentioned in https://github.com/lukesampson/scoop-extras/pull/2124/files#r282758151
2019-11-09 20:02:59 +01:00
linsui
6eb90c9c11 fix(update): support $persist_dir in uninstaller.script (#3692) 2019-10-23 20:37:32 +02:00
Xiang ZHU
eb3d42de8f fix(install): execution policy check (#3619)
fix #3590
2019-10-18 19:16:33 +02:00
Richard Kuhnt
e997017f1a fix(update): Fix scoop update changelog output 2019-10-18 16:22:34 +02:00
Richard Kuhnt
8ee45a57dc chore(git): Remove unnecessary git_proxy_cmd() calls for local commands 2019-10-18 16:22:34 +02:00
linsui
ce3464f2f4 fix(core): Use [Environment]::Is64BitOperatingSystem instead of [intptr]::size (#3690) 2019-10-18 16:14:10 +02:00
Richard Kuhnt
08af9ff6e7 Merge branch 'develop' of github.com:lukesampson/scoop 2019-10-18 14:03:43 +02:00
Richard Kuhnt
e44b848f24 Revert "Update 2019-10-18" (#3696)
This reverts commit d948720961.
2019-10-18 13:56:46 +02:00
Richard Kuhnt
d948720961 Update 2019-10-18 2019-10-18 13:47:57 +02:00
Richard Kuhnt
11c42d782f fix(install): Allow installing specific version if latest is installed
closes #3693
see #3694
2019-10-18 13:36:25 +02:00
Hsiao-nan Cheung
5643818e1b Revert 'Compare-Version' (#3333, #3578) (#3648) 2019-10-18 13:32:06 +02:00
linsui
19ed5e42a8 fix(autoupdate): Decode basename when extract hash (#3615)
Co-authored-by: Jakub Čábera <cabera.jakub@gmail.com>
2019-10-14 14:07:38 +02:00
Stephane
9a3579c523 feature(update): allow updating apps from local manifest or URL (#3685)
- Closes #3683 
- Closes #3607

Co-Authored-By: Jakub Čábera <cabera.jakub@gmail.com>
2019-10-14 12:39:40 +02:00
Chawye Hsu
15e11e62ae fix(checkurls): Trim renaming suffix in url (#3677) 2019-10-06 10:35:09 +02:00
Jakub Čábera
9c04608c48 fix(install): Use Join-Path instead of string gluing. (#3566) 2019-10-04 21:22:31 +02:00
linsui
9f693cbb7d fix(scoop-info): remove a whitespace (#3652) 2019-09-19 16:51:54 +02:00
linsui
6fc708cb25 fix(scoop-info): Fix output for single binaries with alias (#3651) 2019-09-19 12:36:20 +02:00
Jakub Čábera
a09926f5b9 fix(appveyor): use VS2019 image to fix PS6 issues (#3646)
Close #3643
2019-09-17 21:56:51 +02:00
gitolicious
8165b1d468 fix(bucket): only lookup directories in buckets folder (#3631)
IntelliJ is putting a project file in the buckets folder when setting up a project there. The bucket lookup then tries to open this as a folder as it lacks directory filter.
2019-09-06 16:00:23 +02:00
3e55a70971 docs(readme): Improve installation instructions (#3600) 2019-09-02 13:38:30 +02:00
Edgard Lorraine Messias
e37e4ca666 feat(install): Use 7zip when available for faster zip file extraction (#3460) 2019-09-01 13:58:55 +02:00
Jakub Čábera
0d251bafd1 fix(update,uninstall): Regression from Get-Process workaround (#3610)
https://github.com/lukesampson/scoop/pull/3608
2019-08-26 15:32:08 +02:00
Hsiao-nan Cheung
c7d72d21b9 feat(install): Add arch support to env_add_path and env_set (#3503) 2019-08-26 14:58:55 +02:00
Jakub Čábera
f555968c39 fix(uninstall,update): Do not uninstall when application is running (#3608) 2019-08-23 20:09:18 +02:00
Jakub Čábera
f52b339523 feat(tests): Do not force maintainers to have SCOOP_HELPERS (#3604) 2019-08-21 17:17:26 +02:00
Hsiao-nan Cheung
96fef5827d fix(install): Allow $version to be used in uninstaller scripts (#3592) 2019-08-16 17:13:40 +02:00
Richard Kuhnt
7879d272b2 Merge branch 'master' into develop 2019-08-02 17:21:07 +02:00
Richard Kuhnt
79f8538b57 fix(auto-pr): hard reset bucket after running 2019-08-02 17:20:43 +02:00
Richard Kuhnt
073d10dbc9 Merge branch 'master' into develop 2019-08-02 13:18:52 +02:00
Richard Kuhnt
7decfd4c10 fix(auto-pr): Fix git status detection
- Reverts: https://github.com/lukesampson/scoop/pull/3026

See https://git-scm.com/docs/git-status#_short_format
If the file was modified it shows ` M` and `M ` means it's staged.
 Files only containing whitespaces don't get staged by `git add` and we only care about actually staged files.

Since the order of the `git status`-output is not sorted anymore the `Select-Object -First 1` is useless and it now uses `Where-Object` to find the correct line.
2019-08-02 13:18:26 +02:00
Hsiao-nan Cheung
3ca08a5ae8 fix(versions): Hotfix for #3333 (#3578)
* fix(versions): Hotfix for #3333
2019-08-02 11:52:14 +02:00
linsui
9ad783d3a5 fix(autoupdate): remove any whitespace from hash (#3579)
Allow extracting hashes with containing spaces and newlines
(e.g. `ef 5d 41 08 32 9c 71 b4 b5 b6 0f be 2f bc 49 ac ef 86 69 49 42 e8 37 65 a4 86 30
 10 ea be 0d 79`)

FreeCad Example:
```json
"hash": {
    "url": "$url-SHA256.txt",
    "regex": "(?sm):\\s+([a-f\\d\\s]+)CertUtil"
}
```
2019-08-01 18:08:16 +02:00
Hsiao-nan Cheung
1508d2ab00 fix(versions): Refactor compare_versions -> Compare-Version (#3333)
fix #3329 
fix #2981 
fix #2720 
fix lukesampson/scoop-extras#2106
close #3469
2019-07-31 15:36:19 +02:00
issaclin32
544e6094cc fix(decompress): fix bugs on extract_dir (#3540) 2019-07-24 22:37:31 +02:00
Eric Bouchard
78d2ff75f4 fix(help): Rename help() to scoop_help() (#3564)
When a user has an alias named `help`, the `scoop help` command does not work anymore.
To prevent collision with a user alias the function is renamed from `help` to `scoop_help`
2019-07-18 18:33:22 +02:00
Hsiao-nan Cheung
f33799dee8 improvement(core): tweak Invoke-ExternalCommand parameters (#3547)
- Redirect standard error to log file.
- Fix `-RunAs` error.
  - `-RunAs` and `-Log` cannot be used together.
2019-07-16 18:30:15 +02:00
Niklas H
0550605de1 fix(comspec): Escape variables when calling COMSPEC commands (#3538)
COMSPEC commands fail when called with unescaped directory arguments which contain white spaces (typically a compound user name).

- Closes lukesampson/scoop-extras#1781
- Closes lukesampson/scoop-extras#2389
- Closes #2801

Signed-off-by: Niklas H. <Typhoon.CommanderCool@gmail.com>
2019-07-02 15:46:43 +02:00
Huiyi.FYJ
b71b5074b2 fix(editorconfig): add missing } to bat/cmd regex (#3529) 2019-06-24 14:35:15 +02:00
Richard Kuhnt
b9b48182b4 Merge remote-tracking branch 'origin/develop' into develop 2019-06-24 14:27:09 +02:00
Hsiao-nan Cheung
1caaed8f3d feat(compress): Allow 'Expand-InnoArchive -ExtractDir' to accept '{xxx}' (#3487) 2019-06-24 14:26:35 +02:00
Jakub Čábera
e12a7da593 fix(bin): Checkhashes downloading twice when architecture properties does hot have url property (#3479) 2019-06-24 14:26:35 +02:00
Hsiao-nan Cheung
c8047bd5ed fix(decompress): '$ExtractDir' error with '.zip' and subdir (#3472)
For some `extract_dir` in .zip that has sub-dir, the former one would remove parent dir and get error (flac, flac-1.3.2-win\win64), now use temp dir instead. And also fix .msi, in case of some installer that don't have `SourceDir`.

`Expand-DarkArchive` will be used in wix extraction, so it doesn't need `-ExtractDir`.

`Expand-7zipArchive` and `Expand-InnoArchive` works well.

Tested:

- calibre-normal (msi, PFiles\Calibre2)
- flac (zip, flac-1.3.2-win\win64)
- pkg-config (zip, multiple url and extract_dir)

BTW, `Expand-Archive` has `-PassThru` param in PowerShell 6+, and it will be more convinient to support `-ExtractDir` with it. I'll check function's source code and plan to rewrite `Expand-ZipArchive`.

Fix #3473, ref https://github.com/lukesampson/scoop/issues/3473#issuecomment-493446461
2019-06-24 14:26:35 +02:00
Hsiao-nan Cheung
a882c4f1eb fix(decompress): '$ExtractDir' removed original extract file by accident (#3470) 2019-06-24 14:26:35 +02:00
Hsiao-nan Cheung
2fafcb880a feature(decompress): Add 'ExtractDir' to 'Expand-...' functions (#3466)
* feature(decompress): Add 'ExtractDir' to 'Expand-...' functions

* Fix 'TrimEnd' and nested 7z
2019-06-24 14:26:35 +02:00
Hsiao-nan Cheung
61d1c1c41a refactor(core): Add more generic 'Invoke-ExternalCommand' instead of 'run' (#3432) 2019-06-24 14:26:35 +02:00
Mark Huo
2d22ac8233 fix(config): show correct output when removing a config value (#3462) 2019-06-24 14:26:27 +02:00
Jakub Čábera
1836edba88 fix(checkhashes): Do not call scoop directly (#3527)
* fix(checkhashes): Do not call scoop directly

https://github.com/Ash258/GithubActionsBucketForTesting/runs/153802813

* Also fix build
2019-06-22 12:42:05 -07:00
Ross Smith II
e8d0be663b Update readme with correct count of nirsoft apps 2019-06-19 16:05:00 -07:00
Ross Smith II
03bb07c823 Fix typo in readme 2019-06-19 13:20:12 -07:00
Ross Smith II
2849e0f960 Add known buckets to end of readme
Fixes #3515
2019-06-19 13:18:24 -07:00
Asif Mehedi
69a0843e9a Fix a small typo (#3512) 2019-06-17 23:16:17 -07:00
Hsiao-nan Cheung
81e3cf61b6 feat(compress): Allow 'Expand-InnoArchive -ExtractDir' to accept '{xxx}' (#3487) 2019-05-30 14:55:48 +02:00
Richard Kuhnt
51f40e11c9 Sync hotfixes to develop 2019-05-29 18:55:38 +02:00
Jorg Heymans
1ac8ac0c65 hotfix(proxy): rename parameters for Net.NetworkCredential (#3483)
close #3471
2019-05-29 18:48:12 +02:00
jonz94
5d0d39abae fix(readme): adjust URL of runat.json (#3484) 2019-05-29 18:38:34 +02:00
Jakub Čábera
1b84fe04fc fix(bin): Checkhashes downloading twice when architecture properties does hot have url property (#3479) 2019-05-26 11:51:06 +02:00
Hsiao-nan Cheung
a775d452ff fix(decompress): '$ExtractDir' error with '.zip' and subdir (#3472)
For some `extract_dir` in .zip that has sub-dir, the former one would remove parent dir and get error (flac, flac-1.3.2-win\win64), now use temp dir instead. And also fix .msi, in case of some installer that don't have `SourceDir`.

`Expand-DarkArchive` will be used in wix extraction, so it doesn't need `-ExtractDir`.

`Expand-7zipArchive` and `Expand-InnoArchive` works well.

Tested:

- calibre-normal (msi, PFiles\Calibre2)
- flac (zip, flac-1.3.2-win\win64)
- pkg-config (zip, multiple url and extract_dir)

BTW, `Expand-Archive` has `-PassThru` param in PowerShell 6+, and it will be more convinient to support `-ExtractDir` with it. I'll check function's source code and plan to rewrite `Expand-ZipArchive`.

Fix #3473, ref https://github.com/lukesampson/scoop/issues/3473#issuecomment-493446461
2019-05-17 18:19:51 +02:00
Hsiao-nan Cheung
f5fdc275ca fix(decompress): '$ExtractDir' removed original extract file by accident (#3470) 2019-05-17 05:53:57 +02:00
Hsiao-nan Cheung
e6b2e3d31e feature(decompress): Add 'ExtractDir' to 'Expand-...' functions (#3466)
* feature(decompress): Add 'ExtractDir' to 'Expand-...' functions

* Fix 'TrimEnd' and nested 7z
2019-05-16 17:59:42 +02:00
Richard Kuhnt
6141e46d6a fix(decompress): Change dark.exe parameter order
https://github.com/lukesampson/scoop-extras/pull/2143
https://github.com/ScoopInstaller/Main/pull/56
2019-05-15 19:53:54 +02:00
Hsiao-nan Cheung
b9deb57d03 refactor(core): Add more generic 'Invoke-ExternalCommand' instead of 'run' (#3432) 2019-05-15 19:18:28 +02:00
Mark Huo
ad6198eeb4 fix(config): show correct output when removing a config value (#3462) 2019-05-15 18:08:08 +02:00
32 changed files with 497 additions and 273 deletions

View File

@@ -12,7 +12,7 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.{bat,cmd,[Bb][Aa][Tt],[Cc][Mm][Dd]]
[*.{[Bb][Aa][Tt],[Cc][Mm][Dd]}]
# DOS/Win *requires* BAT/CMD files to have CRLF newlines
end_of_line = crlf

View File

@@ -64,10 +64,13 @@ If you've built software that you'd like others to use, Scoop is an alternative
## Installation
Run this command from your PowerShell to install scoop to its default location (`C:\Users\<user>\scoop`)
Run the following command from your PowerShell to install scoop to its default location (`C:\Users\<user>\scoop`)
```powershell
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
# or shorter
iwr -useb get.scoop.sh | iex
```
Once installed, run `scoop help` for instructions.
@@ -76,19 +79,20 @@ The default setup is configured so all user installed programs and Scoop itself
Globally installed programs (`--global`) live in `C:\ProgramData\scoop`.
These settings can be changed through environment variables.
### Install Scoop to a Custom Directory
### Install Scoop to a Custom Directory by changing `SCOOP`
```powershell
$env:SCOOP='D:\Applications\Scoop'
[Environment]::SetEnvironmentVariable('SCOOP', $env:SCOOP, 'User')
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
# run the installer
```
### Configure Scoop to install global programs to a Custom Directory
### Configure Scoop to install global programs to a Custom Directory by changing `SCOOP_GLOBAL`
```powershell
$env:SCOOP_GLOBAL='F:\GlobalScoopApps'
[Environment]::SetEnvironmentVariable('SCOOP_GLOBAL', $env:SCOOP_GLOBAL, 'Machine')
# run the installer
```
## [Documentation](https://github.com/lukesampson/scoop/wiki)
@@ -120,10 +124,39 @@ The apps that install best with Scoop are commonly called "portable" apps: i.e.
Since installers are common, Scoop supports them too (and their uninstallers).
Scoop is also great at handling single-file programs and Powershell scripts. These don't even need to be compressed. See the [runat](https://github.com/lukesampson/scoop/blob/master/bucket/runat.json) package for an example: it's really just a GitHub gist.
Scoop is also great at handling single-file programs and Powershell scripts. These don't even need to be compressed. See the [runat](https://github.com/ScoopInstaller/Main/blob/master/bucket/runat.json) package for an example: it's really just a GitHub gist.
### Support this project
If you find Scoop useful and would like to support ongoing development and maintenance, here's how:
- [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DM2SUH9EUXSKJ) (one-time donation)
## Known application buckets
The following buckets are known to scoop:
- [main](https://github.com/ScoopInstaller/Main) - Default bucket for the most common (mostly CLI) apps
- [extras](https://github.com/lukesampson/scoop-extras) - Apps that don't fit the main bucket's [criteria](https://github.com/lukesampson/scoop/wiki/Criteria-for-including-apps-in-the-main-bucket)
- [games](https://github.com/Calinou/scoop-games) - Open source/freeware games and game-related tools
- [nerd-fonts](https://github.com/matthewjberger/scoop-nerd-fonts) - Nerd Fonts
- [nirsoft](https://github.com/kodybrown/scoop-nirsoft) - A subset of the [250](https://github.com/rasa/scoop-directory/blob/master/by-score.md#MCOfficer_scoop-nirsoft) [Nirsoft](https://nirsoft.net) apps
- [java](https://github.com/ScoopInstaller/Java) - Installers for Oracle Java, OpenJDK, Zulu, ojdkbuild, AdoptOpenJDK, Amazon Corretto, BellSoft Liberica & SapMachine
- [jetbrains](https://github.com/Ash258/Scoop-JetBrains) - Installers for all JetBrains utilities and IDEs
<!-- * [nightlies](https://github.com/ScoopInstaller/Nightlies) - No longer used -->
- [nonportable](https://github.com/TheRandomLabs/scoop-nonportable) - Non-portable apps (may require UAC)
- [php](https://github.com/ScoopInstaller/PHP) - Installers for most versions of PHP
- [versions](https://github.com/ScoopInstaller/Versions) - Alternative versions of apps found in other buckets
The main bucket is installed by default. To add any of the other buckets, type:
```
scoop bucket add bucketname
```
For example, to add the extras bucket, type:
```
scoop bucket add extras
```
## Other application buckets
Many other application buckets hosted on Github can be found in the [Scoop Directory](https://github.com/rasa/scoop-directory).

View File

@@ -5,8 +5,7 @@ branches:
build: off
deploy: off
clone_depth: 49
image:
- Visual Studio 2017
image: Visual Studio 2019
environment:
scoop: C:\projects\scoop
scoop_home: C:\projects\scoop

View File

@@ -185,8 +185,8 @@ hub diff --name-only | ForEach-Object {
# detect if file was staged, because it's not when only LF or CRLF have changed
$status = execute 'hub status --porcelain -uno'
$status = $status | Select-Object -First 1
if ($status -and $status -match "^\x20*M\x20+.*$app.json") {
$status = $status | Where-Object { $_ -match "M\s{2}.*$app.json" }
if ($status -and $status.StartsWith('M ') -and $status.EndsWith("$app.json")) {
execute "hub commit -m '${app}: Update to version $version'"
} else {
Write-Host "Skipping $app because only LF/CRLF changes were detected ..." -ForegroundColor Yellow
@@ -204,4 +204,4 @@ if ($Push) {
execute 'hub checkout -f master'
}
execute 'hub reset'
execute 'hub reset --hard'

View File

@@ -52,7 +52,7 @@ param(
$Dir = Resolve-Path $Dir
if ($ForceUpdate) { $Update = $true }
# Cleanup
if (!$UseCache) { scoop cache rm '*HASH_CHECK*' }
if (!$UseCache) { Remove-Item "$cachedir\*HASH_CHECK*" -Force }
function err ([String] $name, [String[]] $message) {
Write-Host "$name`: " -ForegroundColor Red -NoNewline
@@ -70,15 +70,15 @@ foreach ($single in Get-ChildItem $Dir "$App.json") {
$urls = @()
$hashes = @()
if ($manifest.architecture) {
if ($manifest.url) {
$manifest.url | ForEach-Object { $urls += $_ }
$manifest.hash | ForEach-Object { $hashes += $_ }
} elseif ($manifest.architecture) {
# First handle 64bit
url $manifest '64bit' | ForEach-Object { $urls += $_ }
hash $manifest '64bit' | ForEach-Object { $hashes += $_ }
url $manifest '32bit' | ForEach-Object { $urls += $_ }
hash $manifest '32bit' | ForEach-Object { $hashes += $_ }
} elseif ($manifest.url) {
$manifest.url | ForEach-Object { $urls += $_ }
$manifest.hash | ForEach-Object { $hashes += $_ }
} else {
err $name 'Manifest does not contain URL property.'
continue

View File

@@ -50,6 +50,9 @@ Write-Host ']ailed'
Write-Host ' | | |'
function test_dl([String] $url, $cookies) {
# Trim renaming suffix, prevent getting 40x response
$url = ($url -split '#/')[0]
$wreq = [Net.WebRequest]::Create($url)
$wreq.Timeout = $Timeout * 1000
if ($wreq -is [Net.HttpWebRequest]) {

View File

@@ -196,8 +196,11 @@ while ($in_progress -gt 0) {
$expected_ver = $json.version
$ver = ''
$err = $ev.SourceEventArgs.Error
$page = $ev.SourceEventArgs.Result
$err = $ev.SourceEventArgs.Error
if ($json.checkver.script) {
$page = $json.checkver.script -join "`r`n" | Invoke-Expression
}
if ($err) {
next "$($err.message)`r`nURL $url is not valid"

View File

@@ -1,25 +1,26 @@
#Requires -Version 5
# remote install:
# iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
# Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
$old_erroractionpreference = $erroractionpreference
$erroractionpreference = 'stop' # quit if anything goes wrong
if(($PSVersionTable.PSVersion.Major) -lt 5) {
if (($PSVersionTable.PSVersion.Major) -lt 5) {
Write-Output "PowerShell 5 or later is required to run Scoop."
Write-Output "Upgrade PowerShell: https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell"
break
}
# show notification to change execution policy:
if((Get-ExecutionPolicy) -gt 'RemoteSigned' -or (Get-ExecutionPolicy) -eq 'ByPass') {
Write-Output "PowerShell requires an execution policy of 'RemoteSigned' to run Scoop."
Write-Output "To make this change please run:"
$allowedExecutionPolicy = @('Unrestricted', 'RemoteSigned', 'ByPass')
if ((Get-ExecutionPolicy).ToString() -notin $allowedExecutionPolicy) {
Write-Output "PowerShell requires an execution policy in [$($allowedExecutionPolicy -join ", ")] to run Scoop."
Write-Output "For example, to set the execution policy to 'RemoteSigned' please run :"
Write-Output "'Set-ExecutionPolicy RemoteSigned -scope CurrentUser'"
break
}
if([System.Enum]::GetNames([System.Net.SecurityProtocolType]) -notcontains 'Tls12') {
if ([System.Enum]::GetNames([System.Net.SecurityProtocolType]) -notcontains 'Tls12') {
Write-Output "Scoop requires at least .NET Framework 4.5"
Write-Output "Please download and install it first:"
Write-Output "https://www.microsoft.com/net/download"
@@ -32,10 +33,10 @@ Write-Output 'Initializing...'
Invoke-Expression (new-object net.webclient).downloadstring($core_url)
# prep
if(installed 'scoop') {
if (installed 'scoop') {
write-host "Scoop is already installed. Run 'scoop update' to get the latest version." -f red
# don't abort if invoked with iex that would close the PS session
if($myinvocation.mycommand.commandtype -eq 'Script') { return } else { exit 1 }
if ($myinvocation.mycommand.commandtype -eq 'Script') { return } else { exit 1 }
}
$dir = ensure (versiondir 'scoop' 'current')
@@ -47,7 +48,7 @@ dl $zipurl $zipfile
Write-Output 'Extracting...'
Add-Type -Assembly "System.IO.Compression.FileSystem"
[IO.Compression.ZipFile]::ExtractToDirectory($zipfile,"$dir\_tmp")
[IO.Compression.ZipFile]::ExtractToDirectory($zipfile, "$dir\_tmp")
Copy-Item "$dir\_tmp\*master\*" $dir -Recurse -Force
Remove-Item "$dir\_tmp", $zipfile -Recurse -Force

View File

@@ -10,19 +10,11 @@ set-strictmode -off
reset_aliases
# TODO: remove this in a few weeks
if ((Get-LocalBucket) -notcontains 'main') {
warn "The main bucket of Scoop has been separated to 'https://github.com/ScoopInstaller/Main'"
warn "You don't have the main bucket added, adding main bucket for you..."
add_bucket 'main'
exit
}
$commands = commands
if ('--version' -contains $cmd -or (!$cmd -and '-v' -contains $args)) {
Push-Location $(versiondir 'scoop' 'current')
write-host "Current Scoop version:"
git_log --oneline HEAD -n 1
Invoke-Expression "git --no-pager log --oneline HEAD -n 1"
write-host ""
Pop-Location
@@ -30,7 +22,7 @@ if ('--version' -contains $cmd -or (!$cmd -and '-v' -contains $args)) {
Push-Location (Find-BucketDirectory $_ -Root)
if(test-path '.git') {
write-host "'$_' bucket:"
git_log --oneline HEAD -n 1
Invoke-Expression "git --no-pager log --oneline HEAD -n 1"
write-host ""
}
Pop-Location

View File

@@ -6,7 +6,7 @@
"nirsoft": "https://github.com/kodybrown/scoop-nirsoft",
"php": "https://github.com/ScoopInstaller/PHP",
"nerd-fonts": "https://github.com/matthewjberger/scoop-nerd-fonts",
"nonportable": "https://github.com/oltolm/scoop-nonportable",
"nonportable": "https://github.com/TheRandomLabs/scoop-nonportable",
"java": "https://github.com/ScoopInstaller/Java",
"games": "https://github.com/Calinou/scoop-games",
"jetbrains": "https://github.com/Ash258/Scoop-JetBrains"

View File

@@ -58,7 +58,7 @@ function find_hash_in_textfile([String] $url, [Hashtable] $substitutions, [Strin
$regex = substitute $regex $substitutions $true
debug $regex
if ($hashfile -match $regex) {
$hash = $matches[1] -replace ' ',''
$hash = $matches[1] -replace '\s',''
}
# convert base64 encoded hash values
@@ -172,12 +172,15 @@ function get_hash_for_app([String] $app, $config, [String] $version, [String] $u
$hash = $null
$hashmode = $config.mode
$basename = url_remote_filename($url)
$basename = [System.Web.HttpUtility]::UrlDecode((url_remote_filename($url)))
$substitutions = $substitutions.Clone()
$substitutions.Add('$url', (strip_fragment $url))
$substitutions.Add('$baseurl', (strip_filename (strip_fragment $url)).TrimEnd('/'))
$substitutions.Add('$basename', $basename)
$substitutions.Add('$urlNoExt', (strip_ext (strip_fragment $url)))
$substitutions.Add('$basenameNoExt', (strip_ext $basename))
debug $substitutions
$hashfile_url = substitute $config.url $substitutions

View File

@@ -59,7 +59,7 @@ function Get-LocalBucket {
List all local buckets.
#>
return (Get-ChildItem $bucketsdir).Name
return (Get-ChildItem -Directory $bucketsdir).Name
}
function buckets {
@@ -128,7 +128,7 @@ function new_issue_msg($app, $bucket, $title, $body) {
if (Test-path $bucket_path) {
Push-Location $bucket_path
$remote = git_config --get remote.origin.url
$remote = Invoke-Expression "git config --get remote.origin.url"
# Support ssh and http syntax
# git@PROVIDER:USER/REPO.git
# https://PROVIDER/USER/REPO.git

View File

@@ -100,7 +100,7 @@ function setup_proxy() {
[net.webrequest]::defaultwebproxy.credentials = [net.credentialcache]::defaultcredentials
} elseif($credentials) {
$username, $password = $credentials -split '(?<!\\):' | ForEach-Object { $_ -replace '\\([@:])','$1' }
[net.webrequest]::defaultwebproxy.credentials = new-object net.networkcredential($user, $pass)
[net.webrequest]::defaultwebproxy.credentials = new-object net.networkcredential($username, $password)
}
} catch {
warn "Failed to use proxy '$proxy': $($_.exception.message)"
@@ -233,7 +233,7 @@ function Get-AppFilePath {
}
Function Test-CommandAvailable {
Param (
param (
[String]$Name
)
Return [Boolean](Get-Command $Name -ErrorAction Ignore)
@@ -366,6 +366,93 @@ function is_local($path) {
}
# operations
function run($exe, $arg, $msg, $continue_exit_codes) {
Show-DeprecatedWarning $MyInvocation 'Invoke-ExternalCommand'
Invoke-ExternalCommand -FilePath $exe -ArgumentList $arg -Activity $msg -ContinueExitCodes $continue_exit_codes
}
function Invoke-ExternalCommand {
[CmdletBinding(DefaultParameterSetName = "Default")]
[OutputType([Boolean])]
param (
[Parameter(Mandatory = $true,
Position = 0)]
[Alias("Path")]
[ValidateNotNullOrEmpty()]
[String]
$FilePath,
[Parameter(Position = 1)]
[Alias("Args")]
[String[]]
$ArgumentList,
[Parameter(ParameterSetName = "UseShellExecute")]
[Switch]
$RunAs,
[Alias("Msg")]
[String]
$Activity,
[Alias("cec")]
[Hashtable]
$ContinueExitCodes,
[Parameter(ParameterSetName = "Default")]
[Alias("Log")]
[String]
$LogPath
)
if ($Activity) {
Write-Host "$Activity " -NoNewline
}
$Process = New-Object System.Diagnostics.Process
$Process.StartInfo.FileName = $FilePath
$Process.StartInfo.Arguments = ($ArgumentList | Select-Object -Unique) -join ' '
$Process.StartInfo.UseShellExecute = $false
if ($LogPath) {
if ($FilePath -match '(^|\W)msiexec($|\W)') {
$Process.StartInfo.Arguments += " /lwe `"$LogPath`""
} else {
$Process.StartInfo.RedirectStandardOutput = $true
$Process.StartInfo.RedirectStandardError = $true
}
}
if ($RunAs) {
$Process.StartInfo.UseShellExecute = $true
$Process.StartInfo.Verb = 'RunAs'
}
try {
$Process.Start() | Out-Null
} catch {
if ($Activity) {
Write-Host "error." -ForegroundColor DarkRed
}
error $_.Exception.Message
return $false
}
if ($LogPath -and ($FilePath -notmatch '(^|\W)msiexec($|\W)')) {
Out-File -FilePath $LogPath -Encoding ASCII -Append -InputObject $Process.StandardOutput.ReadToEnd()
}
$Process.WaitForExit()
if ($Process.ExitCode -ne 0) {
if ($ContinueExitCodes -and ($ContinueExitCodes.ContainsKey($Process.ExitCode))) {
if ($Activity) {
Write-Host "done." -ForegroundColor DarkYellow
}
warn $ContinueExitCodes[$Process.ExitCode]
return $true
} else {
if ($Activity) {
Write-Host "error." -ForegroundColor DarkRed
}
error "Exit code was $($Process.ExitCode)!"
return $false
}
}
if ($Activity) {
Write-Host "done." -ForegroundColor Green
}
return $true
}
function dl($url,$to) {
$wc = New-Object Net.Webclient
$wc.headers.add('Referer', (strip_filename $url))
@@ -594,13 +681,25 @@ function strip_path($orig_path, $dir) {
return ($stripped -ne $orig_path), $stripped
}
function remove_from_path($dir,$global) {
function add_first_in_path($dir, $global) {
$dir = fullpath $dir
# future sessions
$null, $currpath = strip_path (env 'path' $global) $dir
env 'path' $global "$dir;$currpath"
# this session
$null, $env:PATH = strip_path $env:PATH $dir
$env:PATH = "$dir;$env:PATH"
}
function remove_from_path($dir, $global) {
$dir = fullpath $dir
# future sessions
$was_in_path, $newpath = strip_path (env 'path' $global) $dir
if($was_in_path) {
write-output "Removing $(friendly_path $dir) from your path."
Write-Output "Removing $(friendly_path $dir) from your path."
env 'path' $global $newpath
}
@@ -801,6 +900,7 @@ function handle_special_urls($url)
$Body = @{
projectUri = $Matches.name;
fileName = $Matches.filename;
source = 'CF';
isLatestVersion = $true
}
if ((Invoke-RestMethod -Uri $url) -match '"p":"(?<pid>[a-f0-9]{24}).*?"r":"(?<rid>[a-f0-9]{24})') {

View File

@@ -1,7 +1,7 @@
function Test-7zipRequirement {
[CmdletBinding(DefaultParameterSetName = "URL")]
[OutputType([Boolean])]
param(
param (
[Parameter(Mandatory = $true, ParameterSetName = "URL")]
[String[]]
$URL,
@@ -23,7 +23,7 @@ function Test-7zipRequirement {
function Test-LessmsiRequirement {
[CmdletBinding()]
[OutputType([Boolean])]
param(
param (
[Parameter(Mandatory = $true)]
[String[]]
$URL
@@ -37,49 +37,63 @@ function Test-LessmsiRequirement {
function Expand-7zipArchive {
[CmdletBinding()]
param(
param (
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)]
[String]
$Path,
[Parameter(Position = 1)]
[String]
$DestinationPath = (Split-Path $Path),
[ValidateSet("All", "Skip", "Rename")]
[String]
$Overwrite,
$ExtractDir,
[Parameter(ValueFromRemainingArguments = $true)]
[String]
$Switches,
[ValidateSet("All", "Skip", "Rename")]
[String]
$Overwrite,
[Switch]
$Removal
)
$LogLocation = "$(Split-Path $Path)\7zip.log"
switch ($Overwrite) {
"All" { $Switches += " -aoa" }
"Skip" { $Switches += " -aos" }
"Rename" { $Switches += " -aou" }
}
if ((get_config 7ZIPEXTRACT_USE_EXTERNAL)) {
try {
7z x "$Path" -o"$DestinationPath" (-split $Switches) -y | Out-File $LogLocation
$7zPath = (Get-Command '7z' -CommandType Application | Select-Object -First 1).Source
} catch [System.Management.Automation.CommandNotFoundException] {
abort "Cannot find external 7-Zip (7z.exe) while '7ZIPEXTRACT_USE_EXTERNAL' is 'true'!`nRun 'scoop config 7ZIPEXTRACT_USE_EXTERNAL false' or install 7-Zip manually and try again."
}
} else {
& (Get-HelperPath -Helper 7zip) x "$Path" -o"$DestinationPath" (-split $Switches) -y | Out-File $LogLocation
$7zPath = Get-HelperPath -Helper 7zip
}
if ($LASTEXITCODE -ne 0) {
abort "Failed to extract files from $Path.`nLog file:`n $(friendly_path $LogLocation)"
$LogPath = "$(Split-Path $Path)\7zip.log"
$ArgList = @('x', "`"$Path`"", "-o`"$DestinationPath`"", '-y')
$IsTar = ((strip_ext $Path) -match '\.tar$') -or ($Path -match '\.t[abgpx]z2?$')
if (!$IsTar -and $ExtractDir) {
$ArgList += "-ir!`"$ExtractDir\*`""
}
if (Test-Path $LogLocation) {
Remove-Item $LogLocation -Force
if ($Switches) {
$ArgList += (-split $Switches)
}
if ((strip_ext $Path) -match '\.tar$' -or $Path -match '\.tgz$') {
switch ($Overwrite) {
"All" { $ArgList += "-aoa" }
"Skip" { $ArgList += "-aos" }
"Rename" { $ArgList += "-aou" }
}
$Status = Invoke-ExternalCommand $7zPath $ArgList -LogPath $LogPath
if (!$Status) {
abort "Failed to extract files from $Path.`nLog file:`n $(friendly_path $LogPath)`n$(new_issue_msg $app $bucket 'decompress error')"
}
if (!$IsTar -and $ExtractDir) {
movedir "$DestinationPath\$ExtractDir" $DestinationPath | Out-Null
}
if (Test-Path $LogPath) {
Remove-Item $LogPath -Force
}
if ($IsTar) {
# Check for tar
$ArchivedFile = & (Get-HelperPath -Helper 7zip) l "$Path"
if ($LASTEXITCODE -eq 0) {
$TarFile = $ArchivedFile[-3] -replace '.{53}(.*)', '$1' # get inner tar file name
Expand-7zipArchive "$DestinationPath\$TarFile" $DestinationPath -Removal
$Status = Invoke-ExternalCommand $7zPath @('l', "`"$Path`"") -LogPath $LogPath
if ($Status) {
$TarFile = (Get-Content -Path $LogPath)[-4] -replace '.{53}(.*)', '$1' # get inner tar file name
Expand-7zipArchive -Path "$DestinationPath\$TarFile" -DestinationPath $DestinationPath -ExtractDir $ExtractDir -Removal
} else {
abort "Failed to list files in $Path.`nNot a 7-Zip supported archive file."
}
@@ -92,34 +106,55 @@ function Expand-7zipArchive {
function Expand-MsiArchive {
[CmdletBinding()]
param(
param (
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)]
[String]
$Path,
[Parameter(Position = 1)]
[String]
$DestinationPath = (Split-Path $Path),
[String]
$ExtractDir,
[Parameter(ValueFromRemainingArguments = $true)]
[String]
$Switches,
[Switch]
$Removal
)
$LogLocation = "$(Split-Path $Path)\msi.log"
$DestinationPath = $DestinationPath.TrimEnd("\")
if ($ExtractDir) {
$OriDestinationPath = $DestinationPath
$DestinationPath = "$DestinationPath\_tmp"
}
if ((get_config MSIEXTRACT_USE_LESSMSI)) {
& (Get-HelperPath -Helper Lessmsi) x "$Path" "$DestinationPath\" | Out-File $LogLocation
if ($LASTEXITCODE -ne 0) {
abort "Failed to extract files from $Path.`nLog file:`n $(friendly_path $LogLocation)"
}
if (Test-Path "$DestinationPath\SourceDir") {
movedir "$DestinationPath\SourceDir" "$DestinationPath" | Out-Null
}
$MsiPath = Get-HelperPath -Helper Lessmsi
$ArgList = @('x', "`"$Path`"", "`"$DestinationPath\\`"")
} else {
$ok = run 'msiexec' @('/a', "`"$Path`"", '/qn', "TARGETDIR=`"$DestinationPath`"", "/lwe `"$LogLocation`"")
if (!$ok) {
abort "Failed to extract files from $Path.`nLog file:`n $(friendly_path $LogLocation)"
}
$MsiPath = 'msiexec.exe'
$ArgList = @('/a', "`"$Path`"", '/qn', "TARGETDIR=`"$DestinationPath\\SourceDir`"")
}
$LogPath = "$(Split-Path $Path)\msi.log"
if ($Switches) {
$ArgList += (-split $Switches)
}
$Status = Invoke-ExternalCommand $MsiPath $ArgList -LogPath $LogPath
if (!$Status) {
abort "Failed to extract files from $Path.`nLog file:`n $(friendly_path $LogPath)`n$(new_issue_msg $app $bucket 'decompress error')"
}
if ($ExtractDir -and (Test-Path "$DestinationPath\SourceDir")) {
movedir "$DestinationPath\SourceDir\$ExtractDir" $OriDestinationPath | Out-Null
Remove-Item $DestinationPath -Recurse -Force
} elseif ($ExtractDir) {
movedir "$DestinationPath\$ExtractDir" $OriDestinationPath | Out-Null
Remove-Item $DestinationPath -Recurse -Force
} elseif (Test-Path "$DestinationPath\SourceDir") {
movedir "$DestinationPath\SourceDir" $DestinationPath | Out-Null
}
if (($DestinationPath -ne (Split-Path $Path)) -and (Test-Path "$DestinationPath\$(fname $Path)")) {
Remove-Item "$DestinationPath\$(fname $Path)" -Force
}
if (Test-Path $LogLocation) {
Remove-Item $LogLocation -Force
if (Test-Path $LogPath) {
Remove-Item $LogPath -Force
}
if ($Removal) {
# Remove original archive file
@@ -129,26 +164,37 @@ function Expand-MsiArchive {
function Expand-InnoArchive {
[CmdletBinding()]
param(
param (
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)]
[String]
$Path,
[Parameter(Position = 1)]
[String]
$DestinationPath = (Split-Path $Path),
[String]
$ExtractDir,
[Parameter(ValueFromRemainingArguments = $true)]
[String]
$Switches,
[Switch]
$Removal
)
$LogLocation = "$(Split-Path $Path)\innounp.log"
& (Get-HelperPath -Helper Innounp) -x -d"$DestinationPath" -c'{app}' "$Path" (-split $Switches) -y | Out-File $LogLocation
if ($LASTEXITCODE -ne 0) {
abort "Failed to extract files from $Path.`nLog file:`n $(friendly_path $LogLocation)"
$LogPath = "$(Split-Path $Path)\innounp.log"
$ArgList = @('-x', "-d`"$DestinationPath`"", "`"$Path`"", '-y')
switch -Regex ($ExtractDir) {
"^[^{].*" { $ArgList += "-c{app}\$ExtractDir" }
"^{.*" { $ArgList += "-c$ExtractDir" }
Default { $ArgList += "-c{app}" }
}
if (Test-Path $LogLocation) {
Remove-Item $LogLocation -Force
if ($Switches) {
$ArgList += (-split $Switches)
}
$Status = Invoke-ExternalCommand (Get-HelperPath -Helper Innounp) $ArgList -LogPath $LogPath
if (!$Status) {
abort "Failed to extract files from $Path.`nLog file:`n $(friendly_path $LogPath)`n$(new_issue_msg $app $bucket 'decompress error')"
}
if (Test-Path $LogPath) {
Remove-Item $LogPath -Force
}
if ($Removal) {
# Remove original archive file
@@ -158,16 +204,22 @@ function Expand-InnoArchive {
function Expand-ZipArchive {
[CmdletBinding()]
param(
param (
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)]
[String]
$Path,
[Parameter(Position = 1)]
[String]
$DestinationPath = (Split-Path $Path),
[String]
$ExtractDir,
[Switch]
$Removal
)
if ($ExtractDir) {
$OriDestinationPath = $DestinationPath
$DestinationPath = "$DestinationPath\_tmp"
}
# All methods to unzip the file require .NET4.5+
if ($PSVersionTable.PSVersion.Major -lt 5) {
Add-Type -AssemblyName System.IO.Compression.FileSystem
@@ -196,6 +248,10 @@ function Expand-ZipArchive {
# Compatible with Pscx (https://github.com/Pscx/Pscx)
Microsoft.PowerShell.Archive\Expand-Archive -Path $Path -DestinationPath $DestinationPath -Force
}
if ($ExtractDir) {
movedir "$DestinationPath\$ExtractDir" $OriDestinationPath | Out-Null
Remove-Item $DestinationPath -Recurse -Force
}
if ($Removal) {
# Remove original archive file
Remove-Item $Path -Force
@@ -204,23 +260,30 @@ function Expand-ZipArchive {
function Expand-DarkArchive {
[CmdletBinding()]
param(
param (
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)]
[String]
$Path,
[Parameter(Position = 1)]
[String]
$DestinationPath = (Split-Path $Path),
[Parameter(ValueFromRemainingArguments = $true)]
[String]
$Switches,
[Switch]
$Removal
)
$LogLocation = "$(Split-Path $Path)\dark.log"
& (Get-HelperPath -Helper Dark) -nologo -x "$Path" "$DestinationPath" | Out-File $LogLocation
if ($LASTEXITCODE -ne 0) {
abort "Failed to extract files from $Path.`nLog file:`n $(friendly_path $LogLocation)"
$LogPath = "$(Split-Path $Path)\dark.log"
$ArgList = @('-nologo', "-x `"$DestinationPath`"", "`"$Path`"")
if ($Switches) {
$ArgList += (-split $Switches)
}
if (Test-Path $LogLocation) {
Remove-Item $LogLocation -Force
$Status = Invoke-ExternalCommand (Get-HelperPath -Helper Dark) $ArgList -LogPath $LogPath
if (!$Status) {
abort "Failed to extract files from $Path.`nLog file:`n $(friendly_path $LogPath)`n$(new_issue_msg $app $bucket 'decompress error')"
}
if (Test-Path $LogPath) {
Remove-Item $LogPath -Force
}
if ($Removal) {
# Remove original archive file

View File

@@ -50,3 +50,14 @@ function check_long_paths {
return $true
}
function check_envs_requirements {
if ($null -eq $env:COMSPEC) {
warn '$env:COMSPEC environment variable is missing.'
Write-Host " By default the variable should points to the cmd.exe in Windows: '%SystemRoot%\system32\cmd.exe'."
return $false
}
return $true
}

View File

@@ -4,7 +4,7 @@ function git_proxy_cmd {
if($proxy -and $proxy -ne 'none') {
$cmd = "SET HTTPS_PROXY=$proxy&&SET HTTP_PROXY=$proxy&&$cmd"
}
& "$env:COMSPEC" /c $cmd
& "$env:COMSPEC" /d /c $cmd
}
function git_clone {
@@ -19,34 +19,14 @@ function git_checkout {
git_proxy_cmd checkout $args
}
function git_branch {
git_proxy_cmd branch $args
}
function git_pull {
git_proxy_cmd pull $args
git_proxy_cmd pull --rebase=false $args
}
function git_fetch {
git_proxy_cmd fetch $args
}
function git_log {
git_proxy_cmd --no-pager log $args
}
function git_checkout {
git_proxy_cmd checkout $args
}
function git_branch {
git_proxy_cmd branch $args
}
function git_config {
git_proxy_cmd config $args
}
function git_reset {
git_proxy_cmd reset $args
}

View File

@@ -6,7 +6,7 @@ function summary($text) {
$text | Select-String '(?m)^# Summary: ([^\n]*)$' | ForEach-Object { $_.matches[0].groups[1].value }
}
function help($text) {
function scoop_help($text) {
$help_lines = $text | Select-String '(?ms)^# Help:(.(?!^[^#]))*' | ForEach-Object { $_.matches[0].value; }
$help_lines -replace '(?ms)^#\s?(Help: )?', ''
}

View File

@@ -49,8 +49,8 @@ function install_app($app, $architecture, $global, $suggested, $use_cache = $tru
create_startmenu_shortcuts $manifest $dir $global $architecture
install_psmodule $manifest $dir $global
if($global) { ensure_scoop_in_path $global } # can assume local scoop is in path
env_add_path $manifest $dir $global
env_set $manifest $dir $global
env_add_path $manifest $dir $global $architecture
env_set $manifest $dir $global $architecture
# persist data
persist_data $manifest $original_dir $persist_dir
@@ -203,7 +203,7 @@ function dl_with_cache_aria2($app, $version, $manifest, $architecture, $dir, $co
$urls = @(url $manifest $architecture)
# aria2 input file
$urlstxt = "$cachedir\$app.txt"
$urlstxt = Join-Path $cachedir "$app.txt"
$urlstxt_content = ''
$has_downloads = $false
@@ -225,6 +225,7 @@ function dl_with_cache_aria2($app, $version, $manifest, $architecture, $dir, $co
"--min-tls-version=TLSv1.2"
"--stop-with-process=$PID"
"--continue"
"--summary-interval 0"
)
if($cookies) {
@@ -282,21 +283,29 @@ function dl_with_cache_aria2($app, $version, $manifest, $architecture, $dir, $co
# handle aria2 console output
Write-Host "Starting download with aria2 ..."
$prefix = "Download: "
Invoke-Expression $aria2 | ForEach-Object {
if([String]::IsNullOrWhiteSpace($_)) {
# skip blank lines
return
}
Write-Host $prefix -NoNewline
if($_.StartsWith('(OK):')) {
Write-Host $_ -f Green
} elseif($_.StartsWith('[') -and $_.EndsWith(']')) {
Write-Host $_ -f Cyan
} else {
Write-Host $_ -f Gray
# Skip blank lines
if ([String]::IsNullOrWhiteSpace($_)) { return }
# Prevent potential overlaping of text when one line is shorter
$len = $Host.UI.RawUI.WindowSize.Width - $_.Length - 20
$blank = if ($len -gt 0) { ' ' * $len } else { '' }
$color = 'Gray'
if ($_.StartsWith('(OK):')) {
$noNewLine = $true
$color = 'Green'
} elseif ($_.StartsWith('[') -and $_.EndsWith(']')) {
$noNewLine = $true
$color = 'Cyan'
} elseif ($_.StartsWith('Download Results:')) {
$noNewLine = $false
}
Write-Host "`rDownload: $_$blank" -ForegroundColor $color -NoNewline:$noNewLine
}
Write-Host ''
if($lastexitcode -gt 0) {
error "Download failed! (Error $lastexitcode) $(aria_exit_code $lastexitcode)"
@@ -357,7 +366,7 @@ function dl($url, $to, $cookies, $progress) {
$wreq = [net.webrequest]::create($reqUrl)
if($wreq -is [net.httpwebrequest]) {
$wreq.useragent = Get-UserAgent
if (-not ($url -imatch "sourceforge\.net")) {
if (-not ($url -imatch "sourceforge\.net" -or $url -imatch "portableapps\.com")) {
$wreq.referer = strip_filename $url
}
if($cookies) {
@@ -365,7 +374,41 @@ function dl($url, $to, $cookies, $progress) {
}
}
$wres = $wreq.getresponse()
try {
$wres = $wreq.GetResponse()
} catch [System.Net.WebException] {
$exc = $_.Exception
$handledCodes = @(
[System.Net.HttpStatusCode]::MovedPermanently, # HTTP 301
[System.Net.HttpStatusCode]::Found, # HTTP 302
[System.Net.HttpStatusCode]::SeeOther, # HTTP 303
[System.Net.HttpStatusCode]::TemporaryRedirect # HTTP 307
)
# Only handle redirection codes
$redirectRes = $exc.Response
if ($handledCodes -notcontains $redirectRes.StatusCode) {
throw $exc
}
# Get the new location of the file
if ((-not $redirectRes.Headers) -or ($redirectRes.Headers -notcontains 'Location')) {
throw $exc
}
$newUrl = $redirectRes.Headers['Location']
info "Following redirect to $newUrl..."
# Handle manual file rename
if ($url -like '*#/*') {
$null, $postfix = $url -split '#/'
$newUrl = "$newUrl#/$postfix"
}
dl $newUrl $to $cookies $progress
return
}
$total = $wres.ContentLength
if($total -eq -1 -and $wreq -is [net.ftpwebrequest]) {
$total = ftp_file_size($url)
@@ -469,6 +512,7 @@ function dl_progress($read, $total, $url) {
write-host
$left = 0
$top = $top + 1
if($top -gt $console.CursorPosition.Y) { $top = $console.CursorPosition.Y }
}
}
@@ -539,7 +583,12 @@ function dl_urls($app, $version, $manifest, $bucket, $architecture, $dir, $use_c
if ($manifest.innosetup) {
$extract_fn = 'Expand-InnoArchive'
} elseif($fname -match '\.zip$') {
$extract_fn = 'Expand-ZipArchive'
# Use 7zip when available (more fast)
if (((get_config 7ZIPEXTRACT_USE_EXTERNAL) -and (Test-CommandAvailable 7z)) -or (Test-HelperInstalled -Helper 7zip)) {
$extract_fn = 'Expand-7zipArchive'
} else {
$extract_fn = 'Expand-ZipArchive'
}
} elseif($fname -match '\.msi$') {
# check manifest doesn't use deprecated install method
if(msi $manifest $architecture) {
@@ -555,33 +604,8 @@ function dl_urls($app, $version, $manifest, $bucket, $architecture, $dir, $use_c
Write-Host "Extracting " -NoNewline
Write-Host $fname -f Cyan -NoNewline
Write-Host " ... " -NoNewline
ensure "$dir\_tmp" | Out-Null
& $extract_fn "$dir\$fname" "$dir\_tmp" -Removal
if ($extract_to) {
ensure "$dir\$extract_to" | Out-Null
}
# fails if zip contains long paths (e.g. atom.json)
#cp "$dir\_tmp\$extract_dir\*" "$dir\$extract_to" -r -force -ea stop
try {
movedir "$dir\_tmp\$extract_dir" "$dir\$extract_to"
}
catch {
error $_
abort $(new_issue_msg $app $bucket "extract_dir error")
}
if(Test-Path "$dir\_tmp") { # might have been moved by movedir
try {
Remove-Item -r -force "$dir\_tmp" -ea stop
} catch [system.io.pathtoolongexception] {
& "$env:COMSPEC" /c "rmdir /s /q $dir\_tmp"
} catch [system.unauthorizedaccessexception] {
warn "Couldn't remove $dir\_tmp: unauthorized access."
}
}
& $extract_fn -Path "$dir\$fname" -DestinationPath "$dir\$extract_to" -ExtractDir $extract_dir -Removal
Write-Host "done." -f Green
$extracted++
}
}
@@ -686,37 +710,6 @@ function args($config, $dir, $global) {
@()
}
function run($exe, $arg, $msg, $continue_exit_codes) {
if($msg) { write-host "$msg " -nonewline }
try {
#Allow null/no arguments to be passed
$parameters = @{ }
if ($arg)
{
$parameters.arg = $arg;
}
# Don't use Start-Process -Wait
# https://github.com/PowerShell/PowerShell/issues/6561
$proc = start-process $exe -ea stop -passthru @parameters
$proc | Wait-Process
if($proc.exitcode -ne 0) {
if($continue_exit_codes -and ($continue_exit_codes.containskey($proc.exitcode))) {
warn $continue_exit_codes[$proc.exitcode]
return $true
}
write-host "Exit code was $($proc.exitcode)."; return $false
}
} catch {
write-host -f darkred $_.exception.tostring()
return $false
}
if($msg) { Write-Host "done." -f Green }
return $true
}
function run_installer($fname, $manifest, $architecture, $dir, $global) {
# MSI or other installer
$msi = msi $manifest $architecture
@@ -753,7 +746,7 @@ function install_msi($fname, $dir, $msi) {
$continue_exit_codes = @{ 3010 = "a restart is required to complete installation" }
$installed = run 'msiexec' $arg "Running installer..." $continue_exit_codes
$installed = Invoke-ExternalCommand 'msiexec' $arg -Activity "Running installer..." -ContinueExitCodes $continue_exit_codes
if(!$installed) {
abort "Installation aborted. You might need to run 'scoop uninstall $app' before trying again."
}
@@ -785,7 +778,7 @@ function install_prog($fname, $dir, $installer, $global) {
if($prog.endswith('.ps1')) {
& $prog @arg
} else {
$installed = run $prog $arg "Running installer..."
$installed = Invoke-ExternalCommand $prog $arg -Activity "Running installer..."
if(!$installed) {
abort "Installation aborted. You might need to run 'scoop uninstall $app' before trying again."
}
@@ -800,6 +793,7 @@ function install_prog($fname, $dir, $installer, $global) {
function run_uninstaller($manifest, $architecture, $dir) {
$msi = msi $manifest $architecture
$uninstaller = uninstaller $manifest $architecture
$version = $manifest.version
if($uninstaller.script) {
write-output "Running uninstaller script..."
Invoke-Expression (@($uninstaller.script) -join "`r`n")
@@ -837,7 +831,7 @@ function run_uninstaller($manifest, $architecture, $dir) {
if($exe.endswith('.ps1')) {
& $exe @arg
} else {
$uninstalled = run $exe $arg "Running uninstaller..." $continue_exit_codes
$uninstalled = Invoke-ExternalCommand $exe $arg -Activity "Running uninstaller..." -ContinueExitCodes $continue_exit_codes
if(!$uninstalled) { abort "Uninstallation aborted." }
}
}
@@ -949,7 +943,7 @@ function unlink_current($versiondir) {
attrib $currentdir -R /L
# remove the junction
& "$env:COMSPEC" /c "rmdir $currentdir"
& "$env:COMSPEC" /c "rmdir `"$currentdir`""
return $currentdir
}
return $versiondir
@@ -986,54 +980,49 @@ function find_dir_or_subdir($path, $dir) {
return [string]::join(';', $fixed), $removed
}
function env_add_path($manifest, $dir, $global) {
$manifest.env_add_path | Where-Object { $_ } | ForEach-Object {
$path_dir = join-path $dir $_
function env_add_path($manifest, $dir, $global, $arch) {
$env_add_path = arch_specific 'env_add_path' $manifest $arch
if ($env_add_path) {
# GH-3785: Add path in ascending order.
[Array]::Reverse($env_add_path)
$env_add_path | Where-Object { $_ } | ForEach-Object {
$path_dir = Join-Path $dir $_
if(!(is_in_dir $dir $path_dir)) {
abort "Error in manifest: env_add_path '$_' is outside the app directory."
if (!(is_in_dir $dir $path_dir)) {
abort "Error in manifest: env_add_path '$_' is outside the app directory."
}
add_first_in_path $path_dir $global
}
add_first_in_path $path_dir $global
}
}
function add_first_in_path($dir, $global) {
$dir = fullpath $dir
# future sessions
$null, $currpath = strip_path (env 'path' $global) $dir
env 'path' $global "$dir;$currpath"
# this session
$null, $env:PATH = strip_path $env:PATH $dir
$env:PATH = "$dir;$env:PATH"
}
function env_rm_path($manifest, $dir, $global) {
# remove from path
$manifest.env_add_path | Where-Object { $_ } | ForEach-Object {
$path_dir = join-path $dir $_
function env_rm_path($manifest, $dir, $global, $arch) {
$env_add_path = arch_specific 'env_add_path' $manifest $arch
$env_add_path | Where-Object { $_ } | ForEach-Object {
$path_dir = Join-Path $dir $_
remove_from_path $path_dir $global
}
}
function env_set($manifest, $dir, $global) {
if($manifest.env_set) {
$manifest.env_set | Get-Member -member noteproperty | ForEach-Object {
function env_set($manifest, $dir, $global, $arch) {
$env_set = arch_specific 'env_set' $manifest $arch
if ($env_set) {
$env_set | Get-Member -Member NoteProperty | ForEach-Object {
$name = $_.name;
$val = format $manifest.env_set.$($_.name) @{ "dir" = $dir }
$val = format $env_set.$($_.name) @{ "dir" = $dir }
env $name $global $val
Set-Content env:\$name $val
}
}
}
function env_rm($manifest, $global) {
if($manifest.env_set) {
$manifest.env_set | Get-Member -member noteproperty | ForEach-Object {
function env_rm($manifest, $global, $arch) {
$env_set = arch_specific 'env_set' $manifest $arch
if ($env_set) {
$env_set | Get-Member -Member NoteProperty | ForEach-Object {
$name = $_.name
env $name $global $null
if(test-path env:\$name) { Remove-Item env:\$name }
if (Test-Path env:\$name) { Remove-Item env:\$name }
}
}
}
@@ -1080,11 +1069,11 @@ function prune_installed($apps, $global) {
# check whether the app failed to install
function failed($app, $global) {
$ver = current_version $app $global
if(!$ver) { return $false }
$info = install_info $app $ver $global
if(!$info) { return $true }
return $false
if (is_directory (appdir $app $global)) {
return !(install_info $app (current_version $app $global) $global)
} else {
return $false
}
}
function ensure_none_failed($apps, $global) {
@@ -1200,10 +1189,10 @@ function unlink_persist_data($dir) {
# remove read-only attribute on the link
attrib -R /L $filepath
# remove the junction
& "$env:COMSPEC" /c "rmdir /s /q $filepath"
& "$env:COMSPEC" /c "rmdir /s /q `"$filepath`""
} else {
# remove the hard link
& "$env:COMSPEC" /c "del $filepath"
& "$env:COMSPEC" /c "del `"$filepath`""
}
}
}

View File

@@ -59,8 +59,20 @@ function install_info($app, $version, $global) {
}
function default_architecture {
if([intptr]::size -eq 8) { return "64bit" }
"32bit"
$arch = get_config 'default-architecture'
$system = if ([Environment]::Is64BitOperatingSystem) { '64bit' } else { '32bit' }
if ($null -eq $arch) {
$arch = $system
} else {
try {
$arch = ensure_architecture $arch
} catch {
warn 'Invalid default architecture configured. Determining default system architecture'
$arch = $system
}
}
return $arch
}
function arch_specific($prop, $manifest, $architecture) {

View File

@@ -23,10 +23,10 @@ function install_psmodule($manifest, $dir, $global) {
if(test-path $linkfrom) {
warn "$(friendly_path $linkfrom) already exists. It will be replaced."
& "$env:COMSPEC" /c "rmdir $linkfrom"
& "$env:COMSPEC" /c "rmdir `"$linkfrom`""
}
& "$env:COMSPEC" /c "mklink /j $linkfrom $dir" | out-null
& "$env:COMSPEC" /c "mklink /j `"$linkfrom`" `"$dir`"" | out-null
}
function uninstall_psmodule($manifest, $dir, $global) {
@@ -40,7 +40,7 @@ function uninstall_psmodule($manifest, $dir, $global) {
if(test-path $linkfrom) {
write-host "Removing $(friendly_path $linkfrom)"
$linkfrom = resolve-path $linkfrom
& "$env:COMSPEC" /c "rmdir $linkfrom"
& "$env:COMSPEC" /c "rmdir `"$linkfrom`""
}
}

View File

@@ -12,6 +12,7 @@ $issues += !(check_windows_defender $false)
$issues += !(check_windows_defender $true)
$issues += !(check_main_bucket)
$issues += !(check_long_paths)
$issues += !(check_envs_requirements)
if (!(Test-HelperInstalled -Helper 7zip)) {
error "'7-Zip' is not installed! It's required for unpacking most programs. Please Run 'scoop install 7zip' or 'scoop install 7zip-zstd'."
@@ -24,7 +25,7 @@ if (!(Test-HelperInstalled -Helper Innounp)) {
}
if (!(Test-HelperInstalled -Helper Dark)) {
error "'dark' is not installed! It's require for unpacking installers created with the WiX Toolset. Please run 'scoop install dark' or 'scoop install wixtoolset'."
error "'dark' is not installed! It's required for unpacking installers created with the WiX Toolset. Please run 'scoop install dark' or 'scoop install wixtoolset'."
$issues++
}

View File

@@ -1,6 +1,6 @@
# Usage: scoop config [rm] name [value]
# Summary: Get or set configuration values
# Help: The scoop configuration file is saved at ~/.scoop.
# Help: The scoop configuration file is saved at ~/.config/scoop/config.json.
#
# To get a configuration setting:
#
@@ -37,7 +37,7 @@ if(!$name) { my_usage; exit 1 }
if($name -like 'rm') {
set_config $value $null | Out-Null
Write-Output "'$name' has been removed"
Write-Output "'$value' has been removed"
} elseif($null -ne $value) {
set_config $name $value | Out-Null
Write-Output "'$name' has been set to '$value'"

View File

@@ -13,7 +13,7 @@ function print_help($cmd) {
$usage = usage $file
$summary = summary $file
$help = help $file
$help = scoop_help $file
if($usage) { "$usage`n" }
if($help) { $help }

View File

@@ -27,7 +27,7 @@ $apps | ForEach-Object {
$json | Get-Member -MemberType Properties | ForEach-Object { $install.Add($_.Name, $json.($_.Name))}
$install.hold = $true
save_install_info $install $dir
success "$app is now locked and can not be updated anymore."
success "$app is now held and can not be updated anymore."
}
exit $exitcode

View File

@@ -35,6 +35,7 @@ if (!$manifest) {
}
$install = install_info $app $status.version $global
$status.installed = $install.bucket -eq $bucket
$version_output = $manifest.version
if (!$manifest_file) {
$manifest_file = manifest_path $app $bucket
@@ -94,9 +95,9 @@ if($status.installed) {
Write-Output "Installed: No"
}
$binaries = arch_specific 'bin' $manifest $install.architecture
$binaries = @(arch_specific 'bin' $manifest $install.architecture)
if($binaries) {
$binary_output = "Binaries:`n "
$binary_output = "Binaries:`n "
$binaries | ForEach-Object {
if($_ -is [System.Array]) {
$binary_output += " $($_[1]).exe"

View File

@@ -72,8 +72,8 @@ if (is_scoop_outdated) {
}
if ($apps.length -eq 1) {
$app, $null, $null = parse_app $apps
if (is_installed $app $global) {
$app, $null, $version = parse_app $apps
if ($null -eq $version -and (is_installed $app $global)) {
return
}
}

View File

@@ -32,7 +32,7 @@ if($apps) {
if (!$install_info) { Write-Host ' *failed*' -ForegroundColor DarkRed -NoNewline }
if ($install_info.hold) { Write-Host ' *hold*' -ForegroundColor DarkMagenta -NoNewline }
if ($install_info.bucket -and ($install_info.bucket -ne 'main')) {
if ($install_info.bucket) {
write-host -f Yellow " [$($install_info.bucket)]" -NoNewline
} elseif ($install_info.url) {
write-host -f Yellow " [$($install_info.url)]" -NoNewline

View File

@@ -27,7 +27,7 @@ $apps | ForEach-Object {
$json | Get-Member -MemberType Properties | ForEach-Object { $install.Add($_.Name, $json.($_.Name))}
$install.hold = $null
save_install_info $install $dir
success "$app is now unlocked and can be updated again."
success "$app is no longer held and can be updated again."
}
exit $exitcode

View File

@@ -56,6 +56,14 @@ if (!$apps) { exit 0 }
$dir = versiondir $app $version $global
$persist_dir = persistdir $app $global
#region Workaround for #2952
$processdir = appdir $app $global | Resolve-Path | Select-Object -ExpandProperty Path
if (Get-Process | Where-Object { $_.Path -like "$processdir\*" }) {
error "Application is still running. Close all instances and try again."
continue
}
#endregion Workaround for #2952
try {
Test-Path $dir -ErrorAction Stop | Out-Null
} catch [UnauthorizedAccessException] {

View File

@@ -52,16 +52,9 @@ if (!$configBranch) {
if(($PSVersionTable.PSVersion.Major) -lt 5) {
# check powershell version
# should be deleted after Oct 1, 2019
If ((Get-Date).ToUniversalTime() -ge "2019-10-01") {
Write-Output "PowerShell 5 or later is required to run Scoop."
Write-Output "Upgrade PowerShell: https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell"
break
} else {
Write-Output "Scoop is going to stop supporting old version of PowerShell."
Write-Output "Please upgrade to PowerShell 5 or later version before Oct 1, 2019 UTC."
Write-Output "Guideline: https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell"
}
Write-Output "PowerShell 5 or later is required to run Scoop."
Write-Output "Upgrade PowerShell: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-windows"
break
}
function update_scoop() {
@@ -91,34 +84,35 @@ function update_scoop() {
} else {
Push-Location $currentdir
$currentRepo = git_config remote.origin.url
$currentBranch = git_branch
$previousCommit = Invoke-Expression 'git rev-parse HEAD'
$currentRepo = Invoke-Expression "git config remote.origin.url"
$currentBranch = Invoke-Expression "git branch"
$isRepoChanged = !($currentRepo -match $configRepo)
$isBranchChanged = !($currentBranch -match "\*\s+$configBranch")
# Change remote url if the repo is changed
if ($isRepoChanged) {
git_config remote.origin.url "$configRepo"
Invoke-Expression "git config remote.origin.url '$configRepo'"
}
# Fetch and reset local repo if the repo or the branch is changed
if ($isRepoChanged -or $isBranchChanged) {
# Reset git fetch refs, so that it can fetch all branches (GH-3368)
git_config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
Invoke-Expression "git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'"
# fetch remote branch
git_fetch --force origin "refs/heads/`"$configBranch`":refs/remotes/origin/$configBranch" -q
# checkout and track the branch
git_checkout -B $configBranch -t origin/$configBranch -q
# reset branch HEAD
git_reset --hard origin/$configBranch -q
Invoke-Expression "git reset --hard origin/$configBranch -q"
} else {
git_pull -q
}
$res = $lastexitcode
if ($show_update_log) {
git_log --no-decorate --date=local --since="`"$last_update`"" --format="`"tformat: * %C(yellow)%h%Creset %<|(72,trunc)%s %C(cyan)%cr%Creset`"" HEAD
Invoke-Expression "git --no-pager log --no-decorate --format='tformat: * %C(yellow)%h%Creset %<|(72,trunc)%s %C(cyan)%cr%Creset' '$previousCommit..HEAD'"
}
Pop-Location
@@ -147,9 +141,10 @@ function update_scoop() {
}
Push-Location $loc
$previousCommit = (Invoke-Expression 'git rev-parse HEAD')
git_pull -q
if ($show_update_log) {
git_log --no-decorate --date=local --since="`"$last_update`"" --format="`"tformat: * %C(yellow)%h%Creset %<|(72,trunc)%s %C(cyan)%cr%Creset`"" HEAD
Invoke-Expression "git --no-pager log --no-decorate --format='tformat: * %C(yellow)%h%Creset %<|(72,trunc)%s %C(cyan)%cr%Creset' '$previousCommit..HEAD'"
}
Pop-Location
}
@@ -173,7 +168,8 @@ function update($app, $global, $quiet = $false, $independent, $suggested, $use_c
if (!$independent) {
# check dependencies
$deps = @(deps $app $architecture) | Where-Object { !(installed $_) }
$man = if ($url) { $url } else { $app }
$deps = @(deps $man $architecture) | Where-Object { !(installed $_) }
$deps | ForEach-Object { install_app $_ $architecture $global $suggested $use_cache $check_hash }
}
@@ -236,6 +232,15 @@ function update($app, $global, $quiet = $false, $independent, $suggested, $use_c
# endregion Workaround
$dir = versiondir $app $old_version $global
$persist_dir = persistdir $app $global
#region Workaround for #2952
$processdir = appdir $app $global | Resolve-Path | Select-Object -ExpandProperty Path
if (Get-Process | Where-Object { $_.Path -like "$processdir\*" }) {
error "Application is still running. Close all instances and try again."
return
}
#endregion Workaround for #2952
write-host "Uninstalling '$app' ($old_version)"
run_uninstaller $old_manifest $architecture $dir
@@ -264,6 +269,10 @@ function update($app, $global, $quiet = $false, $independent, $suggested, $use_c
# add bucket name it was installed from
$app = "$bucket/$app"
}
if ($install.url) {
# use the url of the install json if the application was installed through url
$app = $install.url
}
install_app $app $architecture $global $suggested $use_cache $check_hash
}
@@ -303,7 +312,7 @@ if (!$apps) {
$outdated += applist $app $global
write-host -f yellow ("$app`: $($status.version) -> $($status.latest_version){0}" -f ('',' (global)')[$global])
} else {
warn "'$app' is locked to version $($status.version)"
warn "'$app' is held to version $($status.version)"
}
} elseif ($apps_param -ne '*') {
write-host -f green "$app`: $($status.version) (latest version)"

View File

@@ -95,6 +95,12 @@
"checkver": {
"$ref": "#/definitions/checkver"
},
"env_add_path": {
"$ref": "#/definitions/stringOrArrayOfStrings"
},
"env_set": {
"type": "object"
},
"extract_dir": {
"$ref": "#/definitions/stringOrArrayOfStrings"
},
@@ -254,6 +260,10 @@
},
"useragent": {
"type": "string"
},
"script": {
"$ref": "#/definitions/stringOrArrayOfStrings",
"description": "Custom PowerShell script to retrieve application version using more complex approach."
}
},
"type": "object"

View File

@@ -1,10 +1,16 @@
Write-Host "PowerShell: $($PSVersionTable.PSVersion)"
(7z.exe | Select-String -Pattern '7-Zip').ToString()
Write-Host "Install dependencies ..."
Install-Module -Repository PSGallery -Scope CurrentUser -Force -Name Pester -SkipPublisherCheck
Install-Module -Repository PSGallery -Scope CurrentUser -Force -Name Pester -RequiredVersion 4.10.1 -SkipPublisherCheck
Install-Module -Repository PSGallery -Scope CurrentUser -Force -Name PSScriptAnalyzer,BuildHelpers
if ($env:CI_WINDOWS -eq $true) {
# Do not force maintainers to have this inside environment appveyor config
if (-not $env:SCOOP_HELPERS) {
$env:SCOOP_HELPERS = 'C:\projects\helpers'
[System.Environment]::SetEnvironmentVariable('SCOOP_HELPERS', $env:SCOOP_HELPERS, 'Machine')
}
if(!(Test-Path $env:SCOOP_HELPERS)) {
New-Item -ItemType Directory -Path $env:SCOOP_HELPERS
}