Files
operating-system/buildroot-external/rootfs-overlay/usr/sbin/hassos-supervisor
Pascal Vizeli 60c9013535 Travis (#269)
* Update build-all.sh

* Delete ovf-create.sh

* Update patches.sh

* Update hdd-image.sh

* Create .travis.yml

* Update hdd-image.sh

* Update hdd-image.sh

* Update hdd-image.sh

* Update hdd-image.sh

* Update ota.sh

* Update post-build.sh

* Update post-image.sh

* Update rauc.sh

* Update rootfs-layer.sh

* Update hassos-cli

* Update hassos-supervisor

* Update hassos-config

* Update hassos-apparmor

* Update hassos-expand

* Update hassos-persists-journald

* Update hassos-rate

* Update hassos-hook.sh

* Update hassos-hook.sh

* Rename uboot-boot.sh to uboot-boot.ush

* Rename uboot-boot.sh to uboot-boot.ush

* Update hassos-hook.sh

* Rename uboot-boot.sh to uboot-boot.ush

* Rename uboot-boot.sh to uboot-boot.ush

* Update hassos-hook.sh

* Update odroid_c2_defconfig

* Update rpi0_w_defconfig

* Update rpi2_defconfig

* Update rpi3_64_defconfig

* Update rpi3_defconfig

* Update rpi_defconfig

* Update tinker_defconfig

* Update enter.sh

* Update .travis.yml
2018-11-30 16:22:04 +01:00

40 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
set -e
# Load configs
CONFIG_FILE=/mnt/data/hassos.json
SUPERVISOR="$(jq --raw-output '.supervisor' ${CONFIG_FILE})"
DOCKER_ARGS="$(jq --raw-output '.supervisor_args // empty' ${CONFIG_FILE})"
APPARMOR="$(jq --raw-output '.supervisor_apparmor // "docker-default"' ${CONFIG_FILE})"
# Init supervisor
HASSOS_DATA=/mnt/data/supervisor
HASSOS_IMAGE_ID=$(docker inspect --format='{{.Id}}' "${SUPERVISOR}")
HASSOS_CONTAINER_ID=$(docker inspect --format='{{.Image}}' hassos_supervisor || echo "")
# Fix wrong AppArmor profiles
if ! grep "${APPARMOR}" /sys/kernel/security/apparmor/profiles > /dev/null; then
APPARMOR=docker-default
fi
runSupervisor() {
docker container rm --force hassos_supervisor || true
# shellcheck disable=SC2086
docker container run --name hassos_supervisor \
--security-opt apparmor="${APPARMOR}" \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/run/dbus:/var/run/dbus \
-v /etc/machine-id:/etc/machine-id:ro \
-v ${HASSOS_DATA}:/data \
-e SUPERVISOR_SHARE=${HASSOS_DATA} \
-e SUPERVISOR_NAME=hassos_supervisor \
$DOCKER_ARGS \
"${SUPERVISOR}"
}
# Run supervisor
mkdir -p ${HASSOS_DATA}
([ "${HASSOS_IMAGE_ID}" = "${HASSOS_CONTAINER_ID}" ] && docker container start --attach hassos_supervisor) || runSupervisor