Browse Source

removed extra comments. corrected indentation. certbot image cleanup now always happens when uninstalling, regardless of BW image cleanup

pull/440/head
gitclonebrian 2 days ago
parent
commit
ab66bb519f
  1. 27
      run.ps1

27
run.ps1

@ -70,8 +70,7 @@ function Install() { @@ -70,8 +70,7 @@ function Install() {
"--email ${email} -d ${domain} --logs-dir /etc/letsencrypt/logs"
Invoke-Expression ($certbotExp -f $qFlag)
# check if the certbot image should be removed from the system
certbotCleanup
Cleanup-Certbot
}
}
@ -155,8 +154,7 @@ function Update-Lets-Encrypt { @@ -155,8 +154,7 @@ function Update-Lets-Encrypt {
"renew{0} --logs-dir /etc/letsencrypt/logs" -f $qFlag
Invoke-Expression $certbotExp
# check if the certbot image should be removed from the system
certbotCleanup
Cleanup-Certbot
}
}
@ -168,8 +166,7 @@ function Force-Update-Lets-Encrypt { @@ -168,8 +166,7 @@ function Force-Update-Lets-Encrypt {
"renew{0} --logs-dir /etc/letsencrypt/logs --force-renew" -f $qFlag
Invoke-Expression $certbotExp
# check if the certbot image should be removed from the system
certbotCleanup
Cleanup-Certbot
}
}
@ -212,7 +209,6 @@ function Uninstall() { @@ -212,7 +209,6 @@ function Uninstall() {
$uninstallAction = $( Read-Host "Are you sure you want to uninstall Bitwarden? (y/n)" )
}
if ($uninstallAction -eq "y") {
Write-Host "uninstalling Bitwarden..."
Docker-Compose-Down
@ -225,14 +221,13 @@ function Uninstall() { @@ -225,14 +221,13 @@ function Uninstall() {
}
Write-Host "(!) " -f red -nonewline
$purgeAction = $( Read-Host "Would you like to purge all local Bitwarden container images? (y/n)" )
$purgeAction = $( Read-Host "Would you like to purge all local Bitwarden container images? (y/n)" )
if ($purgeAction -eq "y") {
Docker-Prune
if ($purgeAction -eq "y") {
Docker-Prune
}
# check if the certbot image should be removed from the system
certbotCleanup
}
Cleanup-Certbot
}
function Print-Environment {
@ -269,14 +264,12 @@ function Write-Line($str) { @@ -269,14 +264,12 @@ function Write-Line($str) {
}
}
function certbotCleanup {
# check if the certbot image is being used by any containers
function Cleanup-Certbot {
# Check if the certbot image is being used by any containers
if ([string]::IsNullOrEmpty((docker ps -a --filter ancestor=certbot/certbot --quiet))) {
# prompt the user
Write-Host "(!) " -f red -nonewline
$response = $( Read-Host "The [certbot/certbot] container image used by this script is no longer associated with any containers. Would you like to purge it? (y/N)" )
# remove the image if that's what the user chooses
if ($response.ToLower() -eq 'y') {
docker image rm certbot/certbot
}

Loading…
Cancel
Save