LibrePortal/scripts/docker/app/checks/app_installed.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

40 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
dockerCheckAppInstalled()
{
local app_name="$1"
local flag="$2"
local check_active="$3"
local package_status=""
if [ "$flag" = "linux" ]; then
if dpkg -l | grep -q "$app_name"; then
package_status="installed"
if [ "$check_active" = "check_active" ]; then
if systemctl is-active --quiet "$app_name"; then
package_status="running"
fi
fi
else
package_status="not_installed"
fi
elif [ "$flag" = "docker" ]; then
if ! command -v sudo sqlite3 &> /dev/null; then
package_status="not_installed"
elif [ ! -f "$docker_dir/$db_file" ]; then
package_status="not_installed"
else
results=$(sudo sqlite3 "$docker_dir/$db_file" "SELECT name FROM apps WHERE status = 1 AND name = '$app_name';" 2>/dev/null)
if [ -n "$results" ]; then
package_status="installed"
else
package_status="not_installed"
fi
fi
else
package_status="invalid_flag"
fi
echo "$package_status"
}