From eb17b68ad3943d1c7c99dcff12990e64c0d74a37 Mon Sep 17 00:00:00 2001
From: Pascal Vizeli <pvizeli@syshack.ch>
Date: Fri, 10 Apr 2020 22:04:50 +0200
Subject: [PATCH] Fix shutdown timeout and make it upstream with Supervisor
 (#33973)

* Fix shutdown timeout and make it upstream with Supervisor

* Moved ENV command up

* Update finish

Co-authored-by: Franck Nijhof <git@frenck.dev>
---
 Dockerfile                                  | 6 +++++-
 rootfs/etc/services.d/home-assistant/finish | 5 +++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 647c2b8ac07..4646e9f01f1 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,11 +1,15 @@
 ARG BUILD_FROM
 FROM ${BUILD_FROM}
 
+ENV \
+    S6_SERVICES_GRACETIME=60000
+
 WORKDIR /usr/src
 
 ## Setup Home Assistant
 COPY . homeassistant/
-RUN pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \
+RUN \
+    pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \
         -r homeassistant/requirements_all.txt -c homeassistant/homeassistant/package_constraints.txt \
     && pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \
         -e ./homeassistant \
diff --git a/rootfs/etc/services.d/home-assistant/finish b/rootfs/etc/services.d/home-assistant/finish
index 3afed0ca8d8..d039fc04c86 100644
--- a/rootfs/etc/services.d/home-assistant/finish
+++ b/rootfs/etc/services.d/home-assistant/finish
@@ -1,7 +1,8 @@
-#!/usr/bin/execlineb -S0
+#!/usr/bin/execlineb -S1
 # ==============================================================================
 # Take down the S6 supervision tree when Home Assistant fails
 # ==============================================================================
 if { s6-test ${1} -ne 100 }
+if { s6-test ${1} -ne 256 }
 
-s6-svscanctl -t /var/run/s6/services
\ No newline at end of file
+s6-svscanctl -t /var/run/s6/services
-- 
GitLab