You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lntop/docker/lntop/home/run-lntop

24 lines
646 B
Bash

#!/usr/bin/env bash
set -e -o pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
LNTOP_HOME_DIR=.lntop
LNTOP_CONFIG="$LNTOP_HOME_DIR/config.toml"
LNTOP_HOST_GID=${LNTOP_HOST_GID:?required}
LNTOP_HOST_UID=${LNTOP_HOST_UID:?required}
# make sure lntop's home dir exists (should be mapped to host via a volume)
if [[ ! -d "$LNTOP_HOME_DIR" ]]; then
mkdir -p "$LNTOP_HOME_DIR"
chown ${LNTOP_HOST_UID}:${LNTOP_HOST_GID} "$LNTOP_HOME_DIR"
fi
# prepare config file only if it does not already exist
if [[ ! -e "$LNTOP_CONFIG" ]]; then
cp initial-config.toml "$LNTOP_CONFIG"
chown ${LNTOP_HOST_UID}:${LNTOP_HOST_GID} "$LNTOP_CONFIG"
fi
exec lntop