From 5273eb4d043c8efbe6a378e302014ea65f7ffb1d Mon Sep 17 00:00:00 2001 From: Ruben Date: Mon, 3 Mar 2025 13:35:14 +0100 Subject: [PATCH] Add force option to interactive menu --- README.md | 3 ++- certman.sh | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 158c1c9..bcd828a 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,8 @@ This will present a menu with the following options: 1. Process all certificates 2. List installed certificates 3. Check certificate expiration -4. Exit +4. Force update all certificates +5. Exit ### Automated Mode Run the script with the `--silent` flag for automated operations: diff --git a/certman.sh b/certman.sh index 8236671..bdf9589 100755 --- a/certman.sh +++ b/certman.sh @@ -200,15 +200,17 @@ main_menu() { echo "1. Process all certificates" echo "2. List installed certificates" echo "3. Check certificate expiration" - echo "4. Exit" + echo "4. Force update all certificates" + echo "5. Exit" - read -r -p "Select an option (1-4): " choice + read -r -p "Select an option (1-5): " choice case $choice in - 1) process_certificates ;; + 1) FORCE_UPDATE="false"; process_certificates ;; 2) ls -l "$CERT_PATH"/*.crt 2>/dev/null || echo "No certificates found" ;; 3) check_cert_expiration ;; - 4) echo -e "${GREEN}Exiting...${NC}"; exit 0 ;; + 4) FORCE_UPDATE="true"; process_certificates; FORCE_UPDATE="false" ;; + 5) echo -e "${GREEN}Exiting...${NC}"; exit 0 ;; *) echo -e "${RED}Invalid option${NC}" ;; esac done