Fix Authelia password copying and update menu logic

- Fix password hash copying to user_database.yml by removing premature env cleanup
- Update menu case logic to match display options (1-4)
- Add input validation loop for better user experience
- Handle special menu options (prerequisites, NVIDIA drivers) appropriately
This commit is contained in:
Kelin
2026-02-01 01:12:03 -05:00
parent ea5e34935b
commit 0041b15cc2

View File

@@ -906,7 +906,6 @@ deploy_core() {
sed -i '/^BITWARDEN_/d' /opt/stacks/core/.env sed -i '/^BITWARDEN_/d' /opt/stacks/core/.env
sed -i '/^FORMIO_/d' /opt/stacks/core/.env sed -i '/^FORMIO_/d' /opt/stacks/core/.env
sed -i '/^HOMEPAGE_VAR_/d' /opt/stacks/core/.env sed -i '/^HOMEPAGE_VAR_/d' /opt/stacks/core/.env
sed -i '/^AUTHELIA_ADMIN_PASSWORD=/d' /opt/stacks/core/.env
# Replace placeholders in core compose file (fail on missing critical vars) # Replace placeholders in core compose file (fail on missing critical vars)
replace_env_placeholders "/opt/stacks/core/docker-compose.yml" true replace_env_placeholders "/opt/stacks/core/docker-compose.yml" true
@@ -1356,37 +1355,77 @@ main() {
debug_log "No existing .env file found" debug_log "No existing .env file found"
fi fi
# Show main menu # Menu selection loop
show_main_menu while true; do
read -p "Choose an option (1-3): " MAIN_CHOICE # Show main menu
show_main_menu
read -p "Choose an option (1-4 or q): " MAIN_CHOICE
case $MAIN_CHOICE in case $MAIN_CHOICE in
1) 1)
log_info "Selected: Core Server" log_info "Selected: Install Prerequisites"
DEPLOY_CORE=true FORCE_SYSTEM_SETUP=true
DEPLOY_INFRASTRUCTURE=true DEPLOY_CORE=false
DEPLOY_DASHBOARDS=true DEPLOY_INFRASTRUCTURE=false
SETUP_STACKS=true DEPLOY_DASHBOARDS=false
;; SETUP_STACKS=false
2) break
log_info "Selected: Additional Server" ;;
DEPLOY_CORE=false 2)
DEPLOY_INFRASTRUCTURE=true log_info "Selected: Deploy Core Server"
DEPLOY_DASHBOARDS=false DEPLOY_CORE=true
SETUP_STACKS=true DEPLOY_INFRASTRUCTURE=true
;; DEPLOY_DASHBOARDS=true
3) SETUP_STACKS=true
log_info "Exiting..." break
exit 0 ;;
;; 3)
*) log_info "Selected: Deploy Additional Server"
log_error "Invalid choice. Please run the script again." DEPLOY_CORE=false
exit 1 DEPLOY_INFRASTRUCTURE=true
;; DEPLOY_DASHBOARDS=false
esac SETUP_STACKS=true
break
;;
4)
log_info "Selected: Install NVIDIA Drivers"
INSTALL_NVIDIA=true
DEPLOY_CORE=false
DEPLOY_INFRASTRUCTURE=false
DEPLOY_DASHBOARDS=false
SETUP_STACKS=false
break
;;
[Qq]|[Qq]uit)
log_info "Exiting..."
exit 0
;;
*)
log_warning "Invalid choice '$MAIN_CHOICE'. Please select 1-4 or q to quit."
echo ""
sleep 2
continue
;;
esac
done
echo "" echo ""
# Handle special menu options
if [ "$FORCE_SYSTEM_SETUP" = true ]; then
log_info "Installing prerequisites..."
system_setup "$@"
log_success "Prerequisites installed successfully."
exit 0
fi
if [ "$INSTALL_NVIDIA" = true ]; then
log_info "Installing NVIDIA drivers..."
# TODO: Implement NVIDIA driver installation
log_warning "NVIDIA driver installation not yet implemented."
exit 0
fi
# Check if system setup is needed # Check if system setup is needed
# Only run system setup if Docker is not installed OR if running as root and Docker setup hasn't been done # Only run system setup if Docker is not installed OR if running as root and Docker setup hasn't been done
DOCKER_INSTALLED=false DOCKER_INSTALLED=false