#!/usr/bin/env bash
# Run in Container Manager > shiny-server > Terminal > /bin/bash.
# Requires root inside this existing container. Does not rebuild the app.
set -euo pipefail
if [[ $(id -u) -ne 0 ]]; then
  echo 'Run this installer as root inside the shiny-server container.' >&2
  exit 1
fi
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
  libhdf5-dev libcurl4-openssl-dev libssl-dev libxml2-dev \
  libfontconfig1-dev libfreetype6-dev libpng-dev libtiff-dev libjpeg-dev \
  libharfbuzz-dev libfribidi-dev pkg-config
Rscript "$SCRIPT_DIR/install_runtime.R"
echo 'Installation complete. Check the copied app with verify_app.R.'
