diff --git a/install.sh b/install.sh index 548b86d..a878c81 100755 --- a/install.sh +++ b/install.sh @@ -95,8 +95,15 @@ discover_services() { read -r DISCOVERY_CONFIG_FILE; if [ "$DISCOVERY_CONFIG_FILE" == "" ] ; then DISCOVERY_CONFIG_FILE=$PWD"/discovery.conf"; + if [ ! -f $DISCOVERY_CONFIG_FILE ]; then + touch $DISCOVERY_CONFIG_FILE; + fi fi DISCOVERY_CONFIG_DIR=$(dirname $DISCOVERY_CONFIG_FILE) + if [ "$DISCOVERY_CONFIG_DIR" == "/root" ]; then + DISCOVERY_CONFIG_DIR=""; + fi + fi } @@ -159,17 +166,22 @@ check_dirs_and_files() { check_running() { - DOCKERD_STATUS=$($SUDO_CMD systemctl status docker | grep running | wc -l) - if [ "$DOCKERD_STATUS" == "0" ]; then - $SUDO_CMD systemctl start docker - sleep 5; + # Custom gentoo docker status check + DOCKERD_STATUS=$($SUDO_CMD rc-status |grep docker |grep started | wc -l); + if [ "$DOCKERD_STATUS" == "0" ]; then + DOCKERD_STATUS=$($SUDO_CMD systemctl status docker | grep running | wc -l) - if [ "$DOCKERD_STATUS" == "0" ]; then - echo "Docker daemon not running, please check and execute again the install script"; - exit; + if [ "$DOCKERD_STATUS" == "0" ]; then + $SUDO_CMD systemctl start docker + sleep 5; + DOCKERD_STATUS=$($SUDO_CMD systemctl status docker | grep running | wc -l) + if [ "$DOCKERD_STATUS" == "0" ]; then + echo "Docker daemon not running, please check and execute again the install script"; + exit; + fi fi fi - + # bridge check BRIDGE_NUM=$($SUDO_CMD docker network ls | grep bridge | awk '{print $2":"$3}' | sort | uniq | wc -l); @@ -573,11 +585,15 @@ if [ ! -f "/etc/user/config/system.json" ]; then if [ "$DISCOVERY_DIR" != "" ]; then VAR_DISCOVERY_DIR="--env DISCOVERY_DIR=$DISCOVERY_DIR"; VAR_DISCOVERY_DIRECTORY="--volume $DISCOVERY_DIR/:$DISCOVERY_DIR/"; + echo "VAR_DISCOVERY_DIRECTORY="--volume $DISCOVERY_DIR/:$DISCOVERY_DIR/";" fi if [ "$DISCOVERY_CONFIG_FILE" != "" ]; then VAR_DISCOVERY_CONFIG_FILE="--env DISCOVERY_CONFIG_FILE=$DISCOVERY_CONFIG_FILE"; - VAR_DISCOVERY_CONFIG_DIRECTORY="--volume $DISCOVERY_CONFIG_DIR/:$DISCOVERY_CONFIG_DIR/"; + if [ "$DISCOVERY_CONFIG_DIR" != "" ]; then + VAR_DISCOVERY_CONFIG_DIRECTORY="--volume $DISCOVERY_CONFIG_DIR/:$DISCOVERY_CONFIG_DIR/"; + echo "VAR_DISCOVERY_CONFIG_DIRECTORY="--volume $DISCOVERY_CONFIG_DIR/:$DISCOVERY_CONFIG_DIR/";" + fi fi @@ -594,7 +610,7 @@ if [ ! -f "/etc/user/config/system.json" ]; then $VAR_DISCOVERY_DIRECTORY \ $VAR_DISCOVERY_CONFIG_FILE \ $VAR_DISCOVERY_CONFIG_DIRECTORY \ - --volume $HOME/.ssh/installer:/root/.ssh/id_rsa \ + --volume /root/.ssh/installer:/root/.ssh/id_rsa \ --volume /etc/user/:/etc/user/ \ --volume /etc/system/:/etc/system/ \ --env LETSENCRYPT_MAIL=$LETSENCRYPT_MAIL registry.format.hu/installer-tool @@ -838,3 +854,4 @@ fi; rm $PWD/.init_services +