fix docker
This commit is contained in:
parent
e524a82aeb
commit
1be5a72dfe
2 changed files with 19 additions and 0 deletions
|
@ -21,6 +21,18 @@ function detect_os () {
|
||||||
fi
|
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 () {
|
function detect_initcmd () {
|
||||||
if [ -n "$(which systemctl 2> /dev/null)" ]; then
|
if [ -n "$(which systemctl 2> /dev/null)" ]; then
|
||||||
INIT_CMD="systemctl"
|
INIT_CMD="systemctl"
|
||||||
|
@ -33,11 +45,16 @@ function detect_initcmd () {
|
||||||
INIT_CMD="sysvinit"
|
INIT_CMD="sysvinit"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "${DOCKER}" == "yes" ]; then
|
||||||
|
INIT_CMD="initctl"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${DEBUG_OUTPUT}" == "yes" ]; then
|
if [ "${DEBUG_OUTPUT}" == "yes" ]; then
|
||||||
echo "INIT CMD = ${INIT_CMD}"
|
echo "INIT CMD = ${INIT_CMD}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function detect_database () {
|
function detect_database () {
|
||||||
if [ -n "$(which psql 2> /dev/null)" ]; then
|
if [ -n "$(which psql 2> /dev/null)" ]; then
|
||||||
ADAPTER="postgresql"
|
ADAPTER="postgresql"
|
||||||
|
|
|
@ -15,6 +15,8 @@ set -e
|
||||||
|
|
||||||
detect_os
|
detect_os
|
||||||
|
|
||||||
|
detect_docker
|
||||||
|
|
||||||
detect_initcmd
|
detect_initcmd
|
||||||
|
|
||||||
detect_database
|
detect_database
|
||||||
|
|
Loading…
Reference in a new issue