mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-30 02:28:53 +00:00
f716624f89
This requires the initialisation of both DBus and Avahi in the `entry.sh` script to allow resolution via libc. Due to issues with Avahi's `init.d` script, the previous PIDfile is explicitly removed. Connects-to: #712 Change-type: minor Signed-off-by: Heds Simons <heds@resin.io>
42 lines
1.0 KiB
Bash
Executable File
42 lines
1.0 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -o errexit
|
|
|
|
# Start Avahi to allow MDNS lookups
|
|
mkdir -p /var/run/dbus
|
|
rm -f /var/run/avahi-daemon/pid
|
|
/etc/init.d/dbus-1 start
|
|
/etc/init.d/avahi-daemon start
|
|
|
|
[ -d /mnt/root/tmp/resin-supervisor ] ||
|
|
mkdir -p /mnt/root/tmp/resin-supervisor
|
|
|
|
# If DOCKER_ROOT isn't set then default it
|
|
if [ -z "${DOCKER_ROOT}" ]; then
|
|
DOCKER_ROOT=/mnt/root/var/lib/rce
|
|
fi
|
|
|
|
# Mount the DOCKER_ROOT path equivalent in the container fs
|
|
DOCKER_LIB_PATH=${DOCKER_ROOT#/mnt/root}
|
|
|
|
if [ ! -d "${DOCKER_LIB_PATH}" ]; then
|
|
ln -s "${DOCKER_ROOT}" "${DOCKER_LIB_PATH}"
|
|
fi
|
|
|
|
if [ -z "$DOCKER_SOCKET" ]; then
|
|
export DOCKER_SOCKET=/run/docker.sock
|
|
fi
|
|
|
|
export DBUS_SYSTEM_BUS_ADDRESS="unix:path=/mnt/root/run/dbus/system_bus_socket"
|
|
|
|
# Include self-signed CAs, should they exist
|
|
if [ ! -z "${BALENA_ROOT_CA}" ]; then
|
|
if [ ! -e '/etc/ssl/certs/balenaRootCA.pem' ]; then
|
|
mkdir -p /usr/local/share/ca-certificates
|
|
echo "${BALENA_ROOT_CA}" > /usr/local/share/ca-certificates/balenaRootCA.crt
|
|
update-ca-certificates
|
|
fi
|
|
fi
|
|
|
|
exec node /usr/src/app/dist/app.js
|