LibrePortal/scripts/docker/command/docker_run_install.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

44 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
dockerCommandRunInstallUser()
{
local silent_flag=""
if [ "$1" == "--silent" ]; then
silent_flag="$1"
shift
fi
local remote_command="$1"
# Get the value of PasswordAuthentication from sshd_config
local result=$(sudo sed -i '/#PasswordAuthentication/d' $sshd_config)
local passwordAuth=$(grep -i "^PasswordAuthentication" $sshd_config | awk '{print $2}')
# Keys
local private_path="${ssh_dir}private/"
local install_user_key="${CFG_INSTALL_NAME}_sshkey_${CFG_DOCKER_INSTALL_USER}"
# Run the SSH command using the existing SSH variables
local output
if [ "$passwordAuth" == "no" ]; then
if [ -z "$silent_flag" ]; then
ssh -i "${private_path}${install_user_key}" -o StrictHostKeyChecking=no "$CFG_DOCKER_INSTALL_USER@localhost" "$remote_command"
else
ssh -i "${private_path}${install_user_key}" -o StrictHostKeyChecking=no "$CFG_DOCKER_INSTALL_USER@localhost" "$remote_command" > /dev/null 2>&1
fi
else
if [ -z "$silent_flag" ]; then
sshpass -p "$CFG_DOCKER_INSTALL_PASS" ssh -o StrictHostKeyChecking=no "$CFG_DOCKER_INSTALL_USER@localhost" "$remote_command"
else
sshpass -p "$CFG_DOCKER_INSTALL_PASS" ssh -o StrictHostKeyChecking=no "$CFG_DOCKER_INSTALL_USER@localhost" "$remote_command" > /dev/null 2>&1
fi
fi
local exit_code=$?
if [ $exit_code -eq 0 ]; then
:
else
:
fi
}