fix(run_installation): avoid ((current_step++)) under set -e by using explicit arithmetic increment

This commit is contained in:
Mărcziem ™
2025-10-03 10:38:30 +02:00
parent 3fb7f3479e
commit 3e048ba938

View File

@@ -354,78 +354,78 @@ run_installation() {
log_info "Starting NAS installation process..." log_info "Starting NAS installation process..."
# Core system setup # Core system setup
((current_step++)); log_debug "run_installation: about to install dependencies (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Installing dependencies" current_step=$((current_step + 1)); log_debug "run_installation: about to install dependencies (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Installing dependencies"
install_dependencies install_dependencies
((current_step++)); log_debug "run_installation: about to configure network (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Configuring network" current_step=$((current_step + 1)); log_debug "run_installation: about to configure network (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Configuring network"
if [[ "${CONFIGURE_STATIC_IP:-false}" == "true" ]]; then if [[ "${CONFIGURE_STATIC_IP:-false}" == "true" ]]; then
configure_network configure_network
fi fi
((current_step++)); log_debug "run_installation: about to configure SSH (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Configuring SSH" current_step=$((current_step + 1)); log_debug "run_installation: about to configure SSH (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Configuring SSH"
configure_ssh configure_ssh
((current_step++)); log_debug "run_installation: about to setup Samba (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Setting up Samba" current_step=$((current_step + 1)); log_debug "run_installation: about to setup Samba (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Setting up Samba"
setup_samba setup_samba
((current_step++)); log_debug "run_installation: about to configure firewall (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Configuring firewall" current_step=$((current_step + 1)); log_debug "run_installation: about to configure firewall (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Configuring firewall"
configure_firewall configure_firewall
# Security setup # Security setup
((current_step++)); log_debug "run_installation: about to implement security measures (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Implementing security measures" current_step=$((current_step + 1)); log_debug "run_installation: about to implement security measures (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Implementing security measures"
secure_shared_memory secure_shared_memory
install_fail2ban install_fail2ban
configure_automatic_updates configure_automatic_updates
# Optional services # Optional services
if [[ "${INSTALL_DOCKER:-false}" == "true" ]]; then if [[ "${INSTALL_DOCKER:-false}" == "true" ]]; then
((current_step++)); log_debug "run_installation: about to install Docker (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Installing Docker" current_step=$((current_step + 1)); log_debug "run_installation: about to install Docker (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Installing Docker"
install_docker install_docker
else else
((current_step++)) current_step=$((current_step + 1))
fi fi
if [[ "${INSTALL_NFS:-false}" == "true" ]]; then if [[ "${INSTALL_NFS:-false}" == "true" ]]; then
((current_step++)); log_debug "run_installation: about to install NFS (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Installing NFS" current_step=$((current_step + 1)); log_debug "run_installation: about to install NFS (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Installing NFS"
install_nfs install_nfs
else else
((current_step++)) current_step=$((current_step + 1))
fi fi
if [[ "${INSTALL_NETDATA:-false}" == "true" ]]; then if [[ "${INSTALL_NETDATA:-false}" == "true" ]]; then
((current_step++)); log_debug "run_installation: about to install Netdata (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Installing Netdata" current_step=$((current_step + 1)); log_debug "run_installation: about to install Netdata (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Installing Netdata"
install_netdata install_netdata
else else
((current_step++)) current_step=$((current_step + 1))
fi fi
if [[ "${INSTALL_VAULTWARDEN:-false}" == "true" ]]; then if [[ "${INSTALL_VAULTWARDEN:-false}" == "true" ]]; then
((current_step++)); log_debug "run_installation: about to install Vaultwarden (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Installing Vaultwarden" current_step=$((current_step + 1)); log_debug "run_installation: about to install Vaultwarden (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Installing Vaultwarden"
install_vaultwarden install_vaultwarden
else else
((current_step++)) current_step=$((current_step + 1))
fi fi
if [[ "${INSTALL_JELLYFIN:-false}" == "true" ]]; then if [[ "${INSTALL_JELLYFIN:-false}" == "true" ]]; then
((current_step++)); log_debug "run_installation: about to install Jellyfin (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Installing Jellyfin" current_step=$((current_step + 1)); log_debug "run_installation: about to install Jellyfin (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Installing Jellyfin"
install_jellyfin install_jellyfin
else else
((current_step++)) current_step=$((current_step + 1))
fi fi
if [[ "${INSTALL_PORTAINER:-false}" == "true" ]]; then if [[ "${INSTALL_PORTAINER:-false}" == "true" ]]; then
((current_step++)); log_debug "run_installation: about to install Portainer (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Installing Portainer" current_step=$((current_step + 1)); log_debug "run_installation: about to install Portainer (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Installing Portainer"
install_portainer install_portainer
else else
((current_step++)) current_step=$((current_step + 1))
fi fi
if [[ "${INSTALL_WEBMIN:-false}" == "true" ]]; then if [[ "${INSTALL_WEBMIN:-false}" == "true" ]]; then
((current_step++)); log_debug "run_installation: about to install Webmin (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Installing Webmin" current_step=$((current_step + 1)); log_debug "run_installation: about to install Webmin (step $current_step/$total_steps)"; show_progress $current_step $total_steps "Installing Webmin"
install_webmin install_webmin
configure_webmin configure_webmin
else else
((current_step++)) current_step=$((current_step + 1))
fi fi
} }