Update scripts from server repo (#7)

This commit is contained in:
Vince Grassia
2022-02-28 10:22:59 -05:00
committed by GitHub
parent f4efc29731
commit 7d2ea000ab
4 changed files with 133 additions and 26 deletions

37
run.ps1
View File

@@ -9,6 +9,7 @@ param (
[switch] $stop,
[switch] $pull,
[switch] $updateconf,
[switch] $uninstall,
[switch] $renewcert,
[switch] $updatedb,
[switch] $update
@@ -183,6 +184,38 @@ function Update([switch] $withpull) {
-keyconnectorv $keyConnectorVersion -q $setupQuiet
}
function Uninstall() {
$keepDatabase = $(Write-Host "(WARNING: UNINSTALL STARTED) Would you like to save the database files? (y/n)" -f red -nonewline) + $(Read-host)
if ($keepDatabase -eq "y") {
Write-Host "Saving database."
Compress-Archive -Path "${outputDir}\mssql" -DestinationPath ".\bitwarden_database.zip"
Write-Host "(SAVED DATABASE FILES: YES) `n(WARNING: ALL DATA WILL BE REMOVED, INCLUDING THE FOLDER $outputDir) " -f red -nonewline
$uninstallAction = $( Read-Host "Are you sure you want to uninstall Bitwarden? (y/n)" )
} else {
Write-Host "(WARNING: ALL DATA WILL BE REMOVED, INCLUDING THE FOLDER $outputDir) " -f red -nonewline
$uninstallAction = $( Read-Host "Are you sure you want to uninstall Bitwarden? (y/n)" )
}
if ($uninstallAction -eq "y") {
Write-Host "uninstalling Bitwarden..."
Docker-Compose-Down
Write-Host "Removing $outputDir"
Remove-Item -Path $outputDir -Force -Recurse
Write-Host "Bitwarden uninstall complete!"
} else {
Write-Host "Bitwarden uninstall canceled."
Exit
}
Write-Host "(!) " -f red -nonewline
$purgeAction = $( Read-Host "Would you like to purge all local Bitwarden container images? (y/n)" )
if ($purgeAction -eq "y") {
Docker-Prune
}
}
function Print-Environment {
Pull-Setup
docker run -it --rm --name setup -v ${outputDir}:/bitwarden bitwarden/setup:$coreVersion `
@@ -250,6 +283,10 @@ elseif ($update) {
Start-Sleep -s 60
Update-Database
}
elseif ($uninstall) {
Docker-Compose-Down
Uninstall
}
elseif ($rebuild) {
Docker-Compose-Down
Update