librelad 21afae2eff refactor(desudo): drop runtime root from docker_run, sqlite guards, restores
- docker_run: in rooted mode run docker AS the manager via the docker
  group (no sudo); the type=='sudo' branch was unreachable dead code
- 8 db helpers: fix 'command -v sudo sqlite3' guard to 'command -v
  sqlite3' (bodies already query via runInstallOp)
- restic/kopia single-file dump: write target_file via runBackupOp tee
  (as the backup user, matching the snapshot-restore path) instead of
  root tee
- adguard auth: root-owned scratch via runSystem mktemp

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-24 18:03:36 +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 sqlite3 &> /dev/null; then
package_status="not_installed"
elif [ ! -f "$docker_dir/$db_file" ]; then
package_status="not_installed"
else
results=$(runInstallOp 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"
}