PortValhalla/scripts/Windows/Software/Nextcloud/Manage.ps1

33 lines
1.1 KiB
PowerShell
Raw Normal View History

2023-07-12 20:37:31 +00:00
#!/bin/pwsh
2024-08-07 19:05:32 +00:00
. "$PSScriptRoot/../../../Common/Scripts/Context.ps1";
2023-06-30 11:17:00 +00:00
$null = New-Module {
function Restore-Nextcloud([Context] $context) {
2023-07-01 02:33:07 +00:00
choco list --exact nextcloud-client
if (-not $?) {
Write-Information "Installing Nextcloud Client";
2023-06-30 11:17:00 +00:00
choco install nextcloud-client -y --params="'/KeepUpdateCheck'";
}
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";
2023-06-30 11:17:00 +00:00
if (-not (Test-Path $context.GetNextcloudConfigFile())) {
Write-Error "The login seems to have failed. Please try again.";
}
2023-06-30 11:17:00 +00:00
}
$context.Reboot();
exit;
2023-06-30 11:17:00 +00:00
}
}
}