Changed discovery when user is root

This commit is contained in:
gyurix
2023-12-08 10:08:49 +01:00
parent 2e2d7add96
commit 7fd50a08c3

View File

@@ -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,14 +166,19 @@ check_dirs_and_files() {
check_running() {
DOCKERD_STATUS=$($SUDO_CMD systemctl status docker | grep running | wc -l)
# Custom gentoo docker status check
DOCKERD_STATUS=$($SUDO_CMD rc-status |grep docker |grep started | wc -l);
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;
$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
@@ -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