cleanup update script add discro config

This commit is contained in:
Pascal Vizeli 2017-03-18 23:15:05 +01:00
parent cf92e6cd2d
commit b41bc6232f
3 changed files with 10 additions and 14 deletions

View File

@ -0,0 +1,5 @@
# Add hassio flavor
require conf/distro/include/resin-os.inc
PREFERRED_PROVIDER_docker-disk = "docker-resin-supervisor-disk"
RESIN_CONNECTABLE_SERVICES_remove = "openvpn"

View File

@ -5,4 +5,4 @@ BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
BBFILE_COLLECTIONS += "hassio"
BBFILE_PATTERN_hassio := "^${LAYERDIR}/"
BBFILE_PRIORITY_hassio = "10"
LAYERDEPENDS_hassio := "resin-common"

View File

@ -69,15 +69,6 @@ function error_handler {
trap 'error_handler $LINENO' ERR
# Detect containers engine
if which docker &>/dev/null; then
DOCKER=docker
elif which rce &>/dev/null; then
DOCKER=rce
else
error_handler $LINENO "no container engine detected"
fi
request=$(curl -X PUT $API_ENDPOINT/supervisor | jq -e -r '.message')
if [ request != "ok" ]; then
error_handler $LINENO $request
@ -103,7 +94,7 @@ tag=$UPDATER_SUPERVISOR_TAG
# Get image id of tag. This will be non-empty only in case it's already downloaded.
echo "Getting image id..."
imageid=$($DOCKER inspect -f '{{.Id}}' "$image_name:$tag") || imageid=""
imageid=$(docker inspect -f '{{.Id}}' "$image_name:$tag") || imageid=""
if [ -n "$imageid" ]; then
echo "Supervisor $image_name:$tag already downloaded."
@ -116,9 +107,9 @@ systemctl stop resin-supervisor
# Pull target version.
echo "Pulling supervisor $image_name:$tag..."
$DOCKER pull "$image_name:$tag"
docker pull "$image_name:$tag"
$DOCKER rm --force resin_supervisor || true
docker rm --force resin_supervisor || true
# Store the tagged image string so resin-supervisor.service can pick it up
echo "SUPERVISOR_IMAGE=$image_name:$tag" > $UPDATECONF
@ -130,6 +121,6 @@ systemctl start resin-supervisor
# Mark supervisor as working. This version will run when the device reboots.
echo "Mark pulled tag as latest..."
$DOCKER tag -f "$image_name:$tag" "$image_name:latest"
docker tag -f "$image_name:$tag" "$image_name:latest"
sed --in-place "s|SUPERVISOR_IMAGE=.*|SUPERVISOR_IMAGE=$image_name|" /etc/resin-supervisor/supervisor.conf
sed --in-place "s|SUPERVISOR_TAG=.*|SUPERVISOR_TAG=$tag|" /etc/resin-supervisor/supervisor.conf