gentooize
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2024-01-08 11:50:02 +00:00
parent e775b5ce60
commit 88eaea2a26

View File

@@ -183,10 +183,11 @@ check_dirs_and_files() {
check_running() { check_running() {
# Custom gentoo docker status check DOCKERD_STATUS="0";
DOCKERD_STATUS=$($SUDO_CMD rc-status 2>/dev/null | grep docker | grep started | wc -l);
if [ "$DOCKERD_STATUS" == "0" ]; then
which systemctl;
if [ "$?" == "0" ]; then
DOCKERD_STATUS=$($SUDO_CMD systemctl status docker | grep running | wc -l) DOCKERD_STATUS=$($SUDO_CMD systemctl status docker | grep running | wc -l)
if [ "$DOCKERD_STATUS" == "0" ]; then if [ "$DOCKERD_STATUS" == "0" ]; then
$SUDO_CMD systemctl start docker $SUDO_CMD systemctl start docker
@@ -197,6 +198,27 @@ check_running() {
exit; exit;
fi fi
fi fi
DEBIAN="true";
else
echo "systemctl was not found";
echo "Do you want to continue? (Y/n)";
read -r ANSWER;
if [ "$ANSWER" == "y" ] || [ "$ANSWER" == "Y" ] || [ "$ANSWER" == "" ] ; then
# Custom gentoo docker status check
DOCKERD_STATUS=$($SUDO_CMD rc-status 2>/dev/null | grep docker | grep started | wc -l);
if [ "$DOCKERD_STATUS" == "0" ]; then
$SUDO_CMD /etc/init.d/docker start
sleep 5;
DOCKERD_STATUS=$($SUDO_CMD rc-status 2>/dev/null | grep docker | grep started | wc -l);
if [ "$DOCKERD_STATUS" == "0" ]; then
echo "Docker daemon not running, please check and execute again the install script";
exit;
fi
fi;
GENTOO="true";
else
exit;
fi;
fi fi
# bridge check # bridge check
@@ -836,37 +858,40 @@ if [ "$DISCOVERY" == "yes" ] ; then
fi; fi;
fi; fi;
if [ "$DEBIAN" == "true" ] || [ "$GENTOO" == "true" ] ; then
echo "Do you want to start the discovered and actually started services at the next time when your system restarting? (Y/n)"; echo "Do you want to start the discovered and actually started services at the next time when your system restarting? (Y/n)";
read -r ANSWER; read -r ANSWER;
if [ "$ANSWER" == "y" ] || [ "$ANSWER" == "Y" ] || [ "$ANSWER" == "" ] ; then if [ "$ANSWER" == "y" ] || [ "$ANSWER" == "Y" ] || [ "$ANSWER" == "" ] ; then
cp $DISCOVERY_CONFIG_FILE $DISCOVERY_CONFIG_FILE".copy"; cp $DISCOVERY_CONFIG_FILE $DISCOVERY_CONFIG_FILE".copy";
cp $DEST_FILE $DEST_FILE".copy"; cp $DEST_FILE $DEST_FILE".copy";
DISCOVERY_CONFIG_FILENAME=$(basename $DISCOVERY_CONFIG_FILE); DISCOVERY_CONFIG_FILENAME=$(basename $DISCOVERY_CONFIG_FILE);
source $DISCOVERY_CONFIG_FILE; source $DISCOVERY_CONFIG_FILE;
{ {
echo '#!/bin/bash'; echo '#!/bin/bash';
echo 'SOURCE_DIRS="'$SOURCE_DIRS'"; # separator space or |'; echo 'SOURCE_DIRS="'$SOURCE_DIRS'"; # separator space or |';
echo 'DIRNAME="'$DIRNAME'"; # separator space or |'; echo 'DIRNAME="'$DIRNAME'"; # separator space or |';
echo 'FILENAME="'$FILENAME'"; # separator space or |'; echo 'FILENAME="'$FILENAME'"; # separator space or |';
echo 'KEYS="'$KEYS'"; # separator space or |'; echo 'KEYS="'$KEYS'"; # separator space or |';
echo 'DEST_FILE="/usr/local/etc/results.txt";'; echo 'DEST_FILE="/usr/local/etc/results.txt";';
echo 'USE_SUDO=0;'; echo 'USE_SUDO=0;';
} > /tmp/$DISCOVERY_CONFIG_FILENAME } > /tmp/$DISCOVERY_CONFIG_FILENAME
$SUDO_CMD mv /tmp/$DISCOVERY_CONFIG_FILENAME /usr/local/etc/$DISCOVERY_CONFIG_FILENAME $SUDO_CMD mv /tmp/$DISCOVERY_CONFIG_FILENAME /usr/local/etc/$DISCOVERY_CONFIG_FILENAME
{ {
cat $PWD/.init_services; cat $PWD/.init_services;
cat $DEST_FILE; cat $DEST_FILE;
} > /tmp/$DEST_FILE } > /tmp/$DEST_FILE
$SUDO_CMD mv /tmp/$DEST_FILE /usr/local/etc/$DEST_FILE $SUDO_CMD mv /tmp/$DEST_FILE /usr/local/etc/$DEST_FILE
{
echo " if [ "$DEBIAN" == "true" ] ; then
{
echo "
[Unit] [Unit]
Description=Discover services Description=Discover services
@@ -878,10 +903,15 @@ ExecStart=/usr/local/bin/service-files.sh /usr/local/etc/results.txt restart
WantedBy=multi-user.target WantedBy=multi-user.target
"; ";
} > /tmp/discovery.service } > /tmp/discovery.service
$SUDO_CMD mv /tmp/discovery.service /etc/systemd/system/discovery.service
$SUDO_CMD systemctl enable discovery.service
$SUDO_CMD mv /tmp/discovery.service /etc/systemd/system/discovery.service else if [ "$GENTOO" == "true" ] ; then
$SUDO_CMD systemctl enable discovery.service $SUDO_CMD echo "/usr/local/bin/service-files.sh /usr/local/etc/results.txt restart" > /etc/local.d/service-file.start;
$SUDO_CMD chmod a+x /etc/local.d/service-file.start;
fi;
fi;
fi; fi;
rm $PWD/.init_services rm $PWD/.init_services