diff --git a/containers/adguard/scripts/adguard_update_specifics.sh b/containers/adguard/scripts/adguard_update_specifics.sh new file mode 100644 index 0000000..03fc9ba --- /dev/null +++ b/containers/adguard/scripts/adguard_update_specifics.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Post-install/update specifics for AdGuard Home — dispatched by appUpdateSpecifics +# (containers//scripts/_update_specifics.sh defining appUpdateSpecifics_). +appUpdateSpecifics_adguard() { + local app_name="$1" + if [[ $CFG_REQUIREMENT_DNS_UPDATER == "true" ]]; then + updateDNS "$app_name" install + fi + # Split-horizon local DNS: app subdomains resolve to the box on the LAN. + declare -F setupLocalDnsRewrites >/dev/null 2>&1 && setupLocalDnsRewrites +} diff --git a/containers/crowdsec/crowdsec.sh b/containers/crowdsec/crowdsec.sh index f3455a0..8051147 100644 --- a/containers/crowdsec/crowdsec.sh +++ b/containers/crowdsec/crowdsec.sh @@ -4,8 +4,8 @@ # Description : CrowdSec - Intrusion Prevention (c/u/s/r/i): # # Host-installed agent (apt + systemd) — no Docker container. Host install -# logic lives in scripts/install/install_crowdsec.sh (installCrowdsecHost); -# install registration uses the shared hostAppInstall helper +# logic lives in scripts/crowdsec_install_host.sh (installCrowdsecHost) beside +# this file; install registration uses the shared hostAppInstall helper # (scripts/install/host_app.sh). uninstall/stop/restartCrowdsec (below) are the # host-side hooks dockerUninstallApp / dockerStopApp / dockerRestartApp invoke. diff --git a/scripts/install/install_crowdsec.sh b/containers/crowdsec/scripts/crowdsec_install_host.sh similarity index 100% rename from scripts/install/install_crowdsec.sh rename to containers/crowdsec/scripts/crowdsec_install_host.sh diff --git a/containers/dashy/scripts/dashy_update_specifics.sh b/containers/dashy/scripts/dashy_update_specifics.sh new file mode 100644 index 0000000..f4a3f55 --- /dev/null +++ b/containers/dashy/scripts/dashy_update_specifics.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Post-install/update specifics for Dashy — dispatched by appUpdateSpecifics. +appUpdateSpecifics_dashy() { + # Refresh apps-services.json (the source of truth appDashyUpdateConf reads) + # before generating dashy's conf.yml. On a first dashy install the file may + # not yet reflect dashy itself; on a re-install the previous selection survives. + webuiLibrePortalUpdate + appDashyUpdateConf +} diff --git a/containers/focalboard/scripts/focalboard_update_specifics.sh b/containers/focalboard/scripts/focalboard_update_specifics.sh new file mode 100644 index 0000000..31597b0 --- /dev/null +++ b/containers/focalboard/scripts/focalboard_update_specifics.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Post-install/update specifics for Focalboard — dispatched by appUpdateSpecifics. +appUpdateSpecifics_focalboard() { + local app_name="$1" + # Focalboard runs as nobody (65534) and writes its sqlite db + uploads under + # its mounted data dir; fixPermissionsBeforeStart hands the dir to the install + # user, so give it to 65534 here or the server can't open the database. + # Setting shouldrestart (not local) requests the restart in appUpdateSpecifics. + runOwnership app-data-nobody "$app_name" + shouldrestart="true" +} diff --git a/scripts/gluetun/gluetun_route_apps.sh b/containers/gluetun/scripts/gluetun_route_apps.sh similarity index 100% rename from scripts/gluetun/gluetun_route_apps.sh rename to containers/gluetun/scripts/gluetun_route_apps.sh diff --git a/containers/libreportal/scripts/libreportal_update_specifics.sh b/containers/libreportal/scripts/libreportal_update_specifics.sh new file mode 100644 index 0000000..61b140e --- /dev/null +++ b/containers/libreportal/scripts/libreportal_update_specifics.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Post-install/update specifics for LibrePortal itself — dispatched by +# appUpdateSpecifics. Regenerate the WebUI data so the dashboard reflects the +# just-(re)installed control plane. +appUpdateSpecifics_libreportal() { + webuiLibrePortalUpdate +} diff --git a/containers/pihole/scripts/pihole_update_specifics.sh b/containers/pihole/scripts/pihole_update_specifics.sh new file mode 100644 index 0000000..3846867 --- /dev/null +++ b/containers/pihole/scripts/pihole_update_specifics.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Post-install/update specifics for Pi-hole — dispatched by appUpdateSpecifics. +appUpdateSpecifics_pihole() { + local app_name="$1" + if [[ $CFG_REQUIREMENT_DNS_UPDATER == "true" ]]; then + updateDNS "$app_name" install + fi + # Split-horizon local DNS: app subdomains resolve to the box on the LAN. + declare -F setupLocalDnsRewrites >/dev/null 2>&1 && setupLocalDnsRewrites +} diff --git a/scripts/app/app_update_specifics.sh b/scripts/app/app_update_specifics.sh index 91699ba..a799359 100755 --- a/scripts/app/app_update_specifics.sh +++ b/scripts/app/app_update_specifics.sh @@ -1,40 +1,19 @@ #!/bin/bash +# Generic post-install/update dispatcher. App-specific behavior lives WITH the app: +# containers//scripts/_update_specifics.sh defines appUpdateSpecifics_ +# (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. + # Initialize setup (loads CFG_* for the hook to read). initializeAppVariables $app_name; - if [[ $app_name == "adguard" ]] || [[ $app_name == "pihole" ]]; then - if [[ $CFG_REQUIREMENT_DNS_UPDATER == "true" ]]; then - updateDNS $app_name install; - fi - # Split-horizon local DNS: app subdomains resolve to the box on the LAN. - declare -F setupLocalDnsRewrites >/dev/null 2>&1 && setupLocalDnsRewrites - fi - - if [[ $app_name == "libreportal" ]]; then - webuiLibrePortalUpdate; - fi - - if [[ $app_name == "dashy" ]]; then - # Refresh apps-services.json (the source of truth that - # appDashyUpdateConf reads) before generating dashy's conf.yml. - # On a first dashy install the file may not yet reflect dashy - # itself; on a re-install the previous selection survives. - webuiLibrePortalUpdate; - appDashyUpdateConf; - fi - - if [[ $app_name == "focalboard" ]]; then - # Focalboard runs as nobody (65534) and writes its sqlite db + uploads - # under its mounted data dir; fixPermissionsBeforeStart hands the dir to - # the install user, so give it to 65534 here or the server can't open - # the database. Restart so it picks the dir up. - runOwnership app-data-nobody "$app_name"; - shouldrestart="true"; + local hook="appUpdateSpecifics_${app_name}" + if declare -F "$hook" >/dev/null 2>&1; then + "$hook" "$app_name" fi if [[ $shouldrestart == "true" ]]; then diff --git a/scripts/source/files/arrays/files_gluetun.sh b/scripts/source/files/arrays/files_gluetun.sh deleted file mode 100644 index 92b013e..0000000 --- a/scripts/source/files/arrays/files_gluetun.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# This file is auto-generated by generate_arrays.sh -# Do not edit manually - run './scripts/source/files/generate_arrays.sh run' to regenerate - -gluetun_scripts=( - "gluetun/gluetun_route_apps.sh" - -) diff --git a/scripts/source/files/arrays/files_install.sh b/scripts/source/files/arrays/files_install.sh index bd47d70..4fd1034 100755 --- a/scripts/source/files/arrays/files_install.sh +++ b/scripts/source/files/arrays/files_install.sh @@ -6,7 +6,6 @@ install_scripts=( "install/host_app.sh" "install/install_certificate.sh" - "install/install_crowdsec.sh" "install/install_restic.sh" "install/install_swapfile.sh" "install/install_ufwd.sh" diff --git a/scripts/source/files/arrays/files_source.sh b/scripts/source/files/arrays/files_source.sh index 8c12d51..3af26c4 100755 --- a/scripts/source/files/arrays/files_source.sh +++ b/scripts/source/files/arrays/files_source.sh @@ -14,7 +14,6 @@ source_scripts=( "source/files/arrays/files_database.sh" "source/files/arrays/files_docker.sh" "source/files/arrays/files_function.sh" - "source/files/arrays/files_gluetun.sh" "source/files/arrays/files_headscale.sh" "source/files/arrays/files_install.sh" "source/files/arrays/files_logs.sh"