Add force option to interactive menu

This commit is contained in:
Ruben Solvang 2025-03-03 13:35:14 +01:00
parent 75a8370c9f
commit 5273eb4d04
2 changed files with 8 additions and 5 deletions

View file

@ -70,7 +70,8 @@ This will present a menu with the following options:
1. Process all certificates 1. Process all certificates
2. List installed certificates 2. List installed certificates
3. Check certificate expiration 3. Check certificate expiration
4. Exit 4. Force update all certificates
5. Exit
### Automated Mode ### Automated Mode
Run the script with the `--silent` flag for automated operations: Run the script with the `--silent` flag for automated operations:

View file

@ -200,15 +200,17 @@ main_menu() {
echo "1. Process all certificates" echo "1. Process all certificates"
echo "2. List installed certificates" echo "2. List installed certificates"
echo "3. Check certificate expiration" 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 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" ;; 2) ls -l "$CERT_PATH"/*.crt 2>/dev/null || echo "No certificates found" ;;
3) check_cert_expiration ;; 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}" ;; *) echo -e "${RED}Invalid option${NC}" ;;
esac esac
done done