Add scripts for desktop apps

This commit is contained in:
Manuel Thalmann 2024-08-07 23:53:12 +02:00
parent a32a3d0b4c
commit 3c2459b715
3 changed files with 110 additions and 0 deletions

View file

@ -195,6 +195,15 @@ $null = New-Module {
. "$softwarePath/WinSCP/Manage.ps1" @arguments;
. "$softwarePath/Thunderbird/Manage.ps1" @arguments;
}
if (Test-Collection "desktopExperience") {
# Internet Access
. "$softwarePath/Firefox/Manage.ps1" @arguments;
if (Test-Collection "fileSync") {
. "$softwarePath/Nextcloud/Manage.ps1" @arguments;
}
}
};
}

View file

@ -0,0 +1,43 @@
param(
$Action,
[hashtable] $Arguments
)
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
. "$PSScriptRoot/../../Scripts/AppAssociations.ps1";
Start-SoftwareInstaller @PSBoundParameters `
-Installer {
param(
[scriptblock] $Installer
)
Install-ChocoPackage firefox;
& $Installer -Action ([InstallerAction]::Configure)
} `
-Configurator {
Write-Host "Making Firefox the default browser…";
$progIdSuffix = "-308046B0AF4A39CB";
$appName = "Firefox";
$extensions = @(
".htm",
".html",
".svg",
".xht",
".xhtml"
);
$schemes = @(
"http",
"https"
);
foreach ($extension in $extensions) {
Set-DefaultAppAssociation -Identifier $extensions -ProgId "${appName}HTML$progIdSuffix" -ApplicationName $appName;
}
foreach ($scheme in $schemes) {
Set-DefaultAppAssociation -Identifier $scheme -ProgId "${appName}URL$progIdSuffix" -ApplicationName $appName;
}
};

View file

@ -0,0 +1,58 @@
param(
$Action,
[hashtable] $Arguments
)
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
Start-SoftwareInstaller @PSBoundParameters `
-Installer {
Install-ChocoPackage nextcloud-client -ArgumentList "-y","--params='/KeepUpdateCheck'";
} `
-Configurator {
Write-Host "Making Firefox the default browser…";
$progIdSuffix = "-308046B0AF4A39CB";
$appName = "Firefox";
$extensions = @(
".htm",
".html",
".svg",
".xht",
".xhtml"
);
$schemes = @(
"http",
"https"
);
foreach ($extension in $extensions) {
Set-DefaultAppAssociation -Identifier $extensions -ProgId "${appName}HTML$progIdSuffix" -ApplicationName $appName;
}
foreach ($scheme in $schemes) {
Set-DefaultAppAssociation -Identifier $scheme -ProgId "${appName}URL$progIdSuffix" -ApplicationName $appName;
}
} `
-UserConfigurator {
if (-not (Test-Path $context.GetNextcloudConfigFile())) {
Write-Information "Setting up Nextcloud configuration";
Write-Information "Ensuring all Let's Encrypt certificates are cached";
$null = Invoke-WebRequest https://valid-isrgrootx1.letsencrypt.org/;
while (-not (Test-Path $context.GetNextcloudConfigFile())) {
Write-Host "Nextcloud has been installed!";
Read-Host "Please log in in the Nextcloud app and hit enter to continue";
if (-not (Test-Path $context.GetNextcloudConfigFile())) {
Write-Error "The login seems to have failed. Please try again.";
}
}
$context.Reboot();
exit;
}
};