new modules

This commit is contained in:
2025-10-12 01:05:54 +03:00
parent 1d8c700fb0
commit c283bbce40
5 changed files with 89 additions and 5 deletions
+2
View File
@@ -10,6 +10,8 @@ $Modules = @(
@{ Name = 'autostartManagerModule'; Apply = 'update'; Clean = 'remove' },
@{ Name = 'appsDataManagerModule'; Apply = 'reconnect'; Clean = 'disconnect' },
@{ Name = 'mountsManagerModule'; Apply = 'reconnect'; Clean = 'disconnect' }
@{ Name = 'wingetInstallerModule'; Apply = 'install'; Clean = 'check' }
@{ Name = 'packageManagerModule'; Apply = 'install'; Clean = 'uninstall' }
)
foreach ($module in $Modules) {
+38
View File
@@ -0,0 +1,38 @@
param(
[Parameter(Mandatory=$true)]
[ValidateSet("install","uninstall")]
[string]$Mode
)
$packageList = @(
"MartiCliment.UniGetUI"
)
if (-not (checkWingetStatus)) {
Write-Host "winget is not available. Aborting." -ForegroundColor Red
return
}
foreach ($pkg in $packageList) {
switch ($Mode) {
"install" {
Write-Host "Installing $pkg..." -ForegroundColor Cyan
try {
winget install --id $pkg --silent --accept-package-list-agreements --accept-source-agreements
}
catch {
Write-Host "Failed to install $pkg : $($_.Exception.Message)" -ForegroundColor Red
}
}
"uninstall" {
Write-Host "Uninstalling $pkg..." -ForegroundColor Cyan
try {
winget uninstall --id $pkg --silent
}
catch {
Write-Host "Failed to uninstall $pkg : $($_.Exception.Message)" -ForegroundColor Red
}
}
}
}
Write-Host "All requested packages processed." -ForegroundColor Green
+33
View File
@@ -0,0 +1,33 @@
param(
[Parameter(Mandatory=$true)]
[ValidateSet("check","install")]
[string]$Mode
)
function install {
if (checkWingetStatus) {
Write-Host "Skipping installation, winget already present." -ForegroundColor Cyan
return
}
$wingetUrl = "https://aka.ms/getwinget"
$wingetFile = "$tempFolder\winget.msixbundle"
try {
Write-Host "Downloading winget..." -ForegroundColor Cyan
Invoke-WebRequest -Uri $wingetUrl -OutFile $wingetFile -UseBasicParsing
Write-Host "Installing winget..." -ForegroundColor Cyan
Add-AppxPackage $wingetFile
Write-Host "winget successfully installed." -ForegroundColor Green
}
catch {
Write-Host "Failed to install winget: $($_.Exception.Message)" -ForegroundColor Red
}
finally {
if (Test-Path $wingetFile) { Remove-Item $wingetFile -Force }
}
}
switch ($Mode) {
"check" { return checkWingetStatus | Out-Null }
"install" { install }
}
+16 -2
View File
@@ -3,6 +3,8 @@ $appsDataManagerModule = "$PSScriptRoot\modules\appdata-manager.ps1"
$autostartManagerModule = "$PSScriptRoot\modules\autostart-manager.ps1"
$mountsManagerModule = "$PSScriptRoot\modules\mounts-manager.ps1"
$deployModule = "$PSScriptRoot\modules\deploy.ps1"
$wingetInstallerModule = "$PSScriptRoot\modules\winget-installer.ps1"
$packageManagerModule = "$PSScriptRoot\modules\package-manager.ps1"
# Define available modules with their respective actions
$modules = @{
@@ -10,10 +12,21 @@ $modules = @{
"autostartManagerModule" = @("update", "remove")
"deployModule" = @("apply", "clean")
"mountsManagerModule" = @("reconnect", "connect", "disconnect")
"packageManagerModule" = @("install", "uninstall")
}
# Package Manager Installers
$winget = "$PSScriptRoot\winget.ps1"
# Functions
function checkWingetStatus {
try {
$null = winget --version 2>$null
Write-Host "Winget is installed." -ForegroundColor Green
return $true
}
catch {
Write-Host "Winget is not installed." -ForegroundColor Yellow
return $false
}
}
# Data folder
$data = "$root\data"
@@ -24,5 +37,6 @@ $appsAll = "$data\apps.csv"
$mountsAll = "$data\mounts.csv"
# GLOBAL
$tempFolder = "$env:TEMP\winos";
$storage = "$env:USERPROFILE\Storage"
$autostartDir = "$data\autorun"
-3
View File
@@ -1,3 +0,0 @@
Invoke-WebRequest -Uri https://aka.ms/getwinget -OutFile winget.msixbundle
Add-AppxPackage winget.msixbundle
Remove-Item winget.msixbundle