LibrePortal/scripts/docker/app/functions/function_install_app.sh
librelad 875a60f90f LibrePortal v0.1.0 — initial release
A free, open, self-hosted app platform (GNU AGPLv3): one-click app deploys,
Traefik reverse proxy with automatic SSL, rootless Docker support, gluetun
VPN routing, and a web dashboard to manage it all.

Free & open forever to self-host; optional paid hosted services fund it.
See PROMISE.md.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-21 20:37:54 +01:00

50 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
dockerInstallApp()
{
local app_name="$1"
local config_variables="$2"
local reset_network="$3"
local app_name_ucfirst="$(tr '[:lower:]' '[:upper:]' <<< ${app_name:0:1})${app_name:1}"
local installFuncName="install${app_name_ucfirst}"
if [[ "$reset_network" == "true" ]]; then
export LIBREPORTAL_RESET_NETWORK=1
if declare -f ipRemoveFromDatabase >/dev/null 2>&1; then
ipRemoveFromDatabase "$app_name"
fi
if declare -f portsRemoveFromDatabase >/dev/null 2>&1; then
portsRemoveFromDatabase "$app_name"
fi
isNotice "Network reset: cleared previous IP/port allocations for $app_name."
fi
# Silently update the template config so apps.json regen reflects the saved
# values. The visible "Updated CFG_X" lines come from the deployed-config
# pass inside dockerConfigSetupToContainer.
if [[ -n "$config_variables" ]]; then
local template_config="$install_containers_dir$app_name/$app_name.config"
if [[ -f "$template_config" ]]; then
IFS='|' read -ra config_pairs <<< "$config_variables"
for pair in "${config_pairs[@]}"; do
if [[ "$pair" =~ ^(CFG_[A-Z0-9_]+)=(.*)$ ]]; then
local _value="${BASH_REMATCH[2]//%7C/|}"
updateConfigOption "${BASH_REMATCH[1]}" "$_value" "$template_config" >/dev/null
fi
done
fi
fi
# Create a variable with the name of $app_name and set its value to "i"
declare "${app_name}=i"
"${installFuncName}" "$config_variables"
if declare -f webuiGenerateLibrePortalConfig >/dev/null 2>&1; then
webuiGenerateLibrePortalConfig >/dev/null 2>&1 || true
fi
unset LIBREPORTAL_RESET_NETWORK
}