From 1be5a72dfeafdabe17728be338eeb1a48e6cc121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 6 Dec 2016 15:51:33 +0100 Subject: [PATCH] fix docker --- contrib/packager.io/functions | 17 +++++++++++++++++ contrib/packager.io/postinstall.sh | 2 ++ 2 files changed, 19 insertions(+) diff --git a/contrib/packager.io/functions b/contrib/packager.io/functions index 5b49df62a..1e8d5963e 100644 --- a/contrib/packager.io/functions +++ b/contrib/packager.io/functions @@ -21,6 +21,18 @@ function detect_os () { fi } +function detect_docker() { + if [ -n "$(grep docker < /proc/1/cgroup)" ]; then + DOCKER="yes" + else + DOCKER="no" + fi + + if [ "${DEBUG_OUTPUT}" == "yes" ]; then + echo "os runs in docker container = ${DOCKER}" + fi +} + function detect_initcmd () { if [ -n "$(which systemctl 2> /dev/null)" ]; then INIT_CMD="systemctl" @@ -33,11 +45,16 @@ function detect_initcmd () { INIT_CMD="sysvinit" fi + if [ "${DOCKER}" == "yes" ]; then + INIT_CMD="initctl" + fi + if [ "${DEBUG_OUTPUT}" == "yes" ]; then echo "INIT CMD = ${INIT_CMD}" fi } + function detect_database () { if [ -n "$(which psql 2> /dev/null)" ]; then ADAPTER="postgresql" diff --git a/contrib/packager.io/postinstall.sh b/contrib/packager.io/postinstall.sh index 8e520725a..b09189845 100755 --- a/contrib/packager.io/postinstall.sh +++ b/contrib/packager.io/postinstall.sh @@ -15,6 +15,8 @@ set -e detect_os +detect_docker + detect_initcmd detect_database