Browse Source

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

pull/440/head
gitclonebrian 3 days ago
parent
commit
ab66bb519f
  1. 21
      run.ps1

21
run.ps1

@ -70,8 +70,7 @@ function Install() {
"--email ${email} -d ${domain} --logs-dir /etc/letsencrypt/logs" "--email ${email} -d ${domain} --logs-dir /etc/letsencrypt/logs"
Invoke-Expression ($certbotExp -f $qFlag) Invoke-Expression ($certbotExp -f $qFlag)
# check if the certbot image should be removed from the system Cleanup-Certbot
certbotCleanup
} }
} }
@ -155,8 +154,7 @@ function Update-Lets-Encrypt {
"renew{0} --logs-dir /etc/letsencrypt/logs" -f $qFlag "renew{0} --logs-dir /etc/letsencrypt/logs" -f $qFlag
Invoke-Expression $certbotExp Invoke-Expression $certbotExp
# check if the certbot image should be removed from the system Cleanup-Certbot
certbotCleanup
} }
} }
@ -168,8 +166,7 @@ function Force-Update-Lets-Encrypt {
"renew{0} --logs-dir /etc/letsencrypt/logs --force-renew" -f $qFlag "renew{0} --logs-dir /etc/letsencrypt/logs --force-renew" -f $qFlag
Invoke-Expression $certbotExp Invoke-Expression $certbotExp
# check if the certbot image should be removed from the system Cleanup-Certbot
certbotCleanup
} }
} }
@ -212,7 +209,6 @@ function Uninstall() {
$uninstallAction = $( Read-Host "Are you sure you want to uninstall Bitwarden? (y/n)" ) $uninstallAction = $( Read-Host "Are you sure you want to uninstall Bitwarden? (y/n)" )
} }
if ($uninstallAction -eq "y") { if ($uninstallAction -eq "y") {
Write-Host "uninstalling Bitwarden..." Write-Host "uninstalling Bitwarden..."
Docker-Compose-Down Docker-Compose-Down
@ -229,10 +225,9 @@ function Uninstall() {
if ($purgeAction -eq "y") { if ($purgeAction -eq "y") {
Docker-Prune Docker-Prune
# check if the certbot image should be removed from the system
certbotCleanup
} }
Cleanup-Certbot
} }
function Print-Environment { function Print-Environment {
@ -269,14 +264,12 @@ function Write-Line($str) {
} }
} }
function certbotCleanup { function Cleanup-Certbot {
# check if the certbot image is being used by any containers # Check if the certbot image is being used by any containers
if ([string]::IsNullOrEmpty((docker ps -a --filter ancestor=certbot/certbot --quiet))) { if ([string]::IsNullOrEmpty((docker ps -a --filter ancestor=certbot/certbot --quiet))) {
# prompt the user
Write-Host "(!) " -f red -nonewline 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)" ) $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') { if ($response.ToLower() -eq 'y') {
docker image rm certbot/certbot docker image rm certbot/certbot
} }

Loading…
Cancel
Save