#!/bin/bash

# Generic post-install/update dispatcher. App-specific behavior lives WITH the app:
# containers/<app>/scripts/<app>_update_specifics.sh defines appUpdateSpecifics_<app>
# (live-sourced by the container scan). A hook may set shouldrestart=true to request
# a container restart. Apps with no specifics simply ship no hook.
appUpdateSpecifics()
{
    local app_name="$1"

    # Initialize setup (loads CFG_* for the hook to read).
    initializeAppVariables $app_name;

    local hook="appUpdateSpecifics_${app_name}"
    if declare -F "$hook" >/dev/null 2>&1; then
        "$hook" "$app_name"
    fi

    if [[ $shouldrestart == "true" ]]; then
        dockerComposeRestart $app_name;
    fi

    isSuccessful "All application specific updates have been completed."
}
