#!/bin/bash
set -ue

(( $$ == 1 )) || {
  echo "ERROR: Script must be ran as PID 1, via 'CMD [\"/usr/sbin/init.sh\"]' entry in Dockerfile." >&2
  exit 1
}


mkdir -p /etc/systemd/system.conf.d/
echo >/etc/systemd/system.conf.d/forward-log-to-journal.conf "
[Manager]
LogLevel=info
LogTarget=journal-or-kmsg
LogColor=yes
#LogLocation=no
DefaultTimeoutStartSec=5s
DefaultTimeoutStopSec=5s
"

# Change target init stage from from graphical mode to multiuser text-only mode.
systemctl set-default oardocker.target

# Run systemd as PID 1.
exec /lib/systemd/systemd "$@"
