Compare commits
3 Commits
11cfa1e823
...
4b92de1b38
| Author | SHA1 | Date | |
|---|---|---|---|
| 4b92de1b38 | |||
| d13c505143 | |||
| 8b8d109ba6 |
@@ -15,7 +15,8 @@
|
|||||||
{
|
{
|
||||||
"Name": "Google Chrome",
|
"Name": "Google Chrome",
|
||||||
"Id": "Google.Chrome",
|
"Id": "Google.Chrome",
|
||||||
"Version": "",
|
"Version": "146.0.7680.178",
|
||||||
|
"Manifest": "../manifests/Google.Chrome.yaml",
|
||||||
"Enabled": 1,
|
"Enabled": 1,
|
||||||
"PostInstall": [
|
"PostInstall": [
|
||||||
{
|
{
|
||||||
@@ -132,7 +133,8 @@
|
|||||||
{
|
{
|
||||||
"Name": "Revo Uninstaller",
|
"Name": "Revo Uninstaller",
|
||||||
"Id": "RevoUninstaller.RevoUninstaller",
|
"Id": "RevoUninstaller.RevoUninstaller",
|
||||||
"Version": "2.6.5",
|
"Version": "2.6.8",
|
||||||
|
"Manifest": "../manifests/RevoUninstaller.RevoUninstaller.yaml",
|
||||||
"Enabled": 0,
|
"Enabled": 0,
|
||||||
"PostInstall": [
|
"PostInstall": [
|
||||||
{
|
{
|
||||||
|
|||||||
95
bin/main.ps1
95
bin/main.ps1
@@ -54,6 +54,11 @@ if (Test-Path $selectionPath) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# === 2.2 启用本地 Manifest 安装 ===
|
||||||
|
# winget install --manifest 需要先启用 LocalManifestFiles,重复执行不会影响后续安装。
|
||||||
|
Write-Host "Enabling winget local manifest support..." -ForegroundColor Cyan
|
||||||
|
winget settings --enable LocalManifestFiles
|
||||||
|
|
||||||
# === 3. 主循环 ===
|
# === 3. 主循环 ===
|
||||||
foreach ($app in $apps) {
|
foreach ($app in $apps) {
|
||||||
if ($app.Enabled -ne 1) {
|
if ($app.Enabled -ne 1) {
|
||||||
@@ -70,40 +75,88 @@ foreach ($app in $apps) {
|
|||||||
Write-Host "[System Config] Skipping install..." -ForegroundColor Magenta
|
Write-Host "[System Config] Skipping install..." -ForegroundColor Magenta
|
||||||
} else {
|
} else {
|
||||||
# --- 步骤 A: Winget 安装 ---
|
# --- 步骤 A: Winget 安装 ---
|
||||||
$wingetArgs = @(
|
$manifestPath = $null
|
||||||
"install",
|
$manifestTempDir = $null
|
||||||
"--id", $app.Id,
|
|
||||||
"-e",
|
|
||||||
"--silent",
|
|
||||||
"--accept-package-agreements",
|
|
||||||
"--accept-source-agreements",
|
|
||||||
"--disable-interactivity"
|
|
||||||
# "--scope", "machine"
|
|
||||||
)
|
|
||||||
|
|
||||||
# [版本检查逻辑]
|
if (-not [string]::IsNullOrWhiteSpace($app.Manifest)) {
|
||||||
# 检查 Version 是否存在且不为空字符串
|
Write-Host "-> Manifest: $($app.Manifest)"
|
||||||
if (-not [string]::IsNullOrWhiteSpace($app.Version)) {
|
|
||||||
Write-Host "-> Version: $($app.Version)"
|
if ($app.Manifest -match '^https?://') {
|
||||||
$wingetArgs += "-v"
|
$manifestTempDir = Join-Path $env:TEMP ("winit-helper-manifest-" + [guid]::NewGuid().ToString("N"))
|
||||||
$wingetArgs += $app.Version
|
New-Item -ItemType Directory -Path $manifestTempDir -Force | Out-Null
|
||||||
|
|
||||||
|
$manifestFileName = [System.IO.Path]::GetFileName(([uri]$app.Manifest).AbsolutePath)
|
||||||
|
if ([string]::IsNullOrWhiteSpace($manifestFileName)) {
|
||||||
|
$manifestFileName = "$($app.Id).yaml"
|
||||||
|
}
|
||||||
|
|
||||||
|
$manifestPath = Join-Path $manifestTempDir $manifestFileName
|
||||||
|
Write-Host "-> Downloading custom manifest..."
|
||||||
|
Invoke-WebRequest -Uri $app.Manifest -OutFile $manifestPath
|
||||||
|
} else {
|
||||||
|
$manifestPath = $app.Manifest
|
||||||
|
if (-not [System.IO.Path]::IsPathRooted($manifestPath)) {
|
||||||
|
$manifestPath = Join-Path $PSScriptRoot $manifestPath
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not (Test-Path $manifestPath)) {
|
||||||
|
Write-Error "Cannot find manifest: $manifestPath"
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$wingetArgs = @(
|
||||||
|
"install",
|
||||||
|
"--manifest", $manifestPath,
|
||||||
|
"--silent",
|
||||||
|
"--accept-package-agreements",
|
||||||
|
"--accept-source-agreements",
|
||||||
|
"--disable-interactivity"
|
||||||
|
# "--scope", "machine"
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
Write-Host "-> Version: latest"
|
$wingetArgs = @(
|
||||||
|
"install",
|
||||||
|
"--id", $app.Id,
|
||||||
|
"-e",
|
||||||
|
"--silent",
|
||||||
|
"--accept-package-agreements",
|
||||||
|
"--accept-source-agreements",
|
||||||
|
"--disable-interactivity"
|
||||||
|
# "--scope", "machine"
|
||||||
|
)
|
||||||
|
|
||||||
|
# [版本检查逻辑]
|
||||||
|
# 检查 Version 是否存在且不为空字符串
|
||||||
|
if (-not [string]::IsNullOrWhiteSpace($app.Version)) {
|
||||||
|
Write-Host "-> Version: $($app.Version)"
|
||||||
|
$wingetArgs += "-v"
|
||||||
|
$wingetArgs += $app.Version
|
||||||
|
} else {
|
||||||
|
Write-Host "-> Version: latest"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "-> Installing via winget..."
|
Write-Host "-> Installing via winget..."
|
||||||
|
|
||||||
# 执行安装
|
# 执行安装
|
||||||
$proc = Start-Process -FilePath "winget" -ArgumentList $wingetArgs -Wait -PassThru -NoNewWindow
|
try {
|
||||||
|
& winget @wingetArgs
|
||||||
|
$exitCode = $LASTEXITCODE
|
||||||
|
} finally {
|
||||||
|
if ($manifestTempDir -and (Test-Path $manifestTempDir)) {
|
||||||
|
Remove-Item -LiteralPath $manifestTempDir -Recurse -Force
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# 检查安装结果 (0=成功, -1978335189=已安装)
|
# 检查安装结果 (0=成功, -1978335189=已安装)
|
||||||
if ($proc.ExitCode -eq 0) {
|
if ($exitCode -eq 0) {
|
||||||
Write-Host "[Success]" -ForegroundColor Green
|
Write-Host "[Success]" -ForegroundColor Green
|
||||||
} elseif ($proc.ExitCode -eq -1978335189) {
|
} elseif ($exitCode -eq -1978335189) {
|
||||||
Write-Host "[Skip] Already installed" -ForegroundColor Yellow
|
Write-Host "[Skip] Already installed" -ForegroundColor Yellow
|
||||||
continue # 已经安装的为了避免覆盖配置,也就不配置了
|
continue # 已经安装的为了避免覆盖配置,也就不配置了
|
||||||
} else {
|
} else {
|
||||||
Write-Error "[Fail] Error code: $($proc.ExitCode)"
|
Write-Error "[Fail] Error code: $exitCode"
|
||||||
continue # 安装失败则跳过后续配置
|
continue # 安装失败则跳过后续配置
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
39
manifests/Google.Chrome.yaml
Normal file
39
manifests/Google.Chrome.yaml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# yaml-language-server: $schema=https://aka.ms/winget-manifest.singleton.1.12.0.schema.json
|
||||||
|
|
||||||
|
PackageIdentifier: Google.Chrome
|
||||||
|
PackageVersion: 146.0.7680.178
|
||||||
|
PackageLocale: zh-CN
|
||||||
|
Publisher: Google LLC
|
||||||
|
PackageName: Google Chrome
|
||||||
|
License: 免费软件
|
||||||
|
ShortDescription: 快速安全的网络浏览器,专为您而打造
|
||||||
|
InstallerType: wix
|
||||||
|
Scope: machine
|
||||||
|
UpgradeBehavior: install
|
||||||
|
Protocols:
|
||||||
|
- http
|
||||||
|
- https
|
||||||
|
- mailto
|
||||||
|
- mms
|
||||||
|
- tel
|
||||||
|
- webcal
|
||||||
|
FileExtensions:
|
||||||
|
- htm
|
||||||
|
- html
|
||||||
|
- pdf
|
||||||
|
- shtml
|
||||||
|
- svg
|
||||||
|
- webp
|
||||||
|
- xht
|
||||||
|
- xhtml
|
||||||
|
ElevationRequirement: elevatesSelf
|
||||||
|
Installers:
|
||||||
|
- Architecture: x64
|
||||||
|
InstallerUrl: https://dl.volan.top/winget-repo/manifests/g/Google/Chrome/146.0.7680.178/googlechromestandaloneenterprise64.msi
|
||||||
|
InstallerSha256: DB9C5E0519C83FBECFE5E5AC1FAC0FE44C15B3943C9611D52759FE474436D31E
|
||||||
|
ProductCode: '{6939CB9C-515D-372C-AF4A-BA8D6A40CC4B}'
|
||||||
|
AppsAndFeaturesEntries:
|
||||||
|
- ProductCode: '{6939CB9C-515D-372C-AF4A-BA8D6A40CC4B}'
|
||||||
|
UpgradeCode: '{C1DFDF69-5945-32F2-A35E-EE94C99C7CF4}'
|
||||||
|
ManifestType: singleton
|
||||||
|
ManifestVersion: 1.12.0
|
||||||
23
manifests/RevoUninstaller.RevoUninstaller.yaml
Normal file
23
manifests/RevoUninstaller.RevoUninstaller.yaml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# yaml-language-server: $schema=https://aka.ms/winget-manifest.singleton.1.10.0.schema.json
|
||||||
|
|
||||||
|
PackageIdentifier: RevoUninstaller.RevoUninstaller
|
||||||
|
PackageVersion: 2.6.8
|
||||||
|
PackageLocale: en-US
|
||||||
|
InstallerType: inno
|
||||||
|
Scope: machine
|
||||||
|
InstallModes:
|
||||||
|
- interactive
|
||||||
|
- silent
|
||||||
|
- silentWithProgress
|
||||||
|
UpgradeBehavior: install
|
||||||
|
ElevationRequirement: elevatesSelf
|
||||||
|
Installers:
|
||||||
|
- Architecture: x86
|
||||||
|
InstallerUrl: https://dl.volan.top/winget-repo/manifests/r/RevoUninstaller/RevoUninstaller/2.6.8/revosetup.exe
|
||||||
|
InstallerSha256: 8f90951459936a7e2d0eeb508297604bc3e2746d9f5e3646a3fcba1e35f4049b
|
||||||
|
ManifestType: singleton
|
||||||
|
ManifestVersion: 1.10.0
|
||||||
|
License: Freeware
|
||||||
|
PackageName: Revo Uninstaller
|
||||||
|
Publisher: VS Revo Group, Ltd.
|
||||||
|
ShortDescription: Revo Uninstaller helps you to uninstall software and remove unwanted programs easily.
|
||||||
Reference in New Issue
Block a user