#!/usr/bin/env bash

RUNTIME_PROJECT_ROOT=""
RUNTIME_LOG_DIR=""
RUNTIME_LOG_FILE=""

runtime_init() {
  local uid_suffix=""

  RUNTIME_PROJECT_ROOT="$1"

  if [[ "${EUID:-$(id -u)}" -eq 0 ]]; then
    RUNTIME_LOG_DIR="${TMPDIR:-/tmp}/postinstall-debian"
  else
    uid_suffix="$(id -u)"
    RUNTIME_LOG_DIR="${TMPDIR:-/tmp}/postinstall-debian-$uid_suffix"
  fi

  RUNTIME_LOG_FILE="$RUNTIME_LOG_DIR/install.log"
  mkdir -p "$RUNTIME_LOG_DIR"
}
