diff --git a/install.sh b/install.sh index a878c81..45b3988 100755 --- a/install.sh +++ b/install.sh @@ -96,7 +96,23 @@ discover_services() { if [ "$DISCOVERY_CONFIG_FILE" == "" ] ; then DISCOVERY_CONFIG_FILE=$PWD"/discovery.conf"; if [ ! -f $DISCOVERY_CONFIG_FILE ]; then - touch $DISCOVERY_CONFIG_FILE; + USE_SUDO=$(whoami); + if [ "$USE_SUDO" == "root" ]; then + USE_SUDO=0; + else + USE_SUDO=1; + fi + + { + echo '#!/bin/bash'; + echo 'SOURCE_DIRS="/etc/user/data/|/etc/user/config/"; # separator space or |'; + echo 'DIRNAME="services misc"; # separator space or |'; + echo 'FILENAME="service healthcheck"; # separator space or |'; + echo 'KEYS="START_ON_BOOT"; # separator space or |'; + echo 'DEST_FILE="results.txt";'; + echo 'USE_SUDO='$USE_SUDO';'; + + } >> $DISCOVERY_CONFIG_FILE; fi fi DISCOVERY_CONFIG_DIR=$(dirname $DISCOVERY_CONFIG_FILE) @@ -610,7 +626,7 @@ if [ ! -f "/etc/user/config/system.json" ]; then $VAR_DISCOVERY_DIRECTORY \ $VAR_DISCOVERY_CONFIG_FILE \ $VAR_DISCOVERY_CONFIG_DIRECTORY \ - --volume /root/.ssh/installer:/root/.ssh/id_rsa \ + --volume $HOME/.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