gravity-sync icon indicating copy to clipboard operation
gravity-sync copied to clipboard

Can't install on a system with both docker and podman

Open darnir opened this issue 1 year ago • 2 comments

Issue Description

Background: I have a system that has both Docker and Podman configured. Pihole runs as a podman container. Issue: Installing gravity-sync fails because it thinks pihole is not installed and configured Root Cause: The logic in the installation script is incorrect. It assumes that if docker is found on the system, then pihole must be a docker container.

Solution: (Not making this a PR, since this is not a full solution and is likely not even the best way to do it)

index 0604c4d..0370b55 100644
--- a/gs-install.sh
+++ b/g.sh
@@ -55,7 +55,7 @@ LOGO="${PURPLE}∞${NC}"
 
 # Variables
 CROSSCOUNT="0"
-PHFOUND="0"
+PHFAILCOUNT="0"
 CURRENTUSER=$(whoami)
 
 
@@ -176,28 +176,28 @@ if [ "$GS_DOCKER" != "1" ]; then
                 if [ "$FTLCHECK" != "" ]
                 then
                     echo -e "${GOOD} Docker container of Pi-hole has been detected"
-		    PHFOUND=$((PHFOUND+1))
                 else
                     echo -e "${WARN} There is no Docker container of Pi-hole running"
+                    PHFAILCOUNT=$((PHFAILCOUNT+1))
                 fi
-	fi
-	if [ "$PHFOUND" == 0 ] && hash podman 2>/dev/null; then
+        elif hash podman 2>/dev/null; then
             echo -e "${GOOD} Podman installation has been detected"
             FTLCHECK=$(sudo podman container ls | grep 'pihole/pihole')
                 if [ "$FTLCHECK" != "" ]
                 then
                     echo -e "${GOOD} Podman container of Pi-hole has been detected"
-		    PHFOUND=$((PHFOUND+1))
                 else
                     echo -e "${WARN} There is no Podman container of Pi-hole running"
+                    PHFAILCOUNT=$((PHFAILCOUNT+1))
                 fi
         else
             echo -e "${FAIL} No local Pi-hole install detected"
+            PHFAILCOUNT=$((PHFAILCOUNT+1))
         fi
     fi
 
 
-    if [ "$PHFOUND" == "0" ]
+    if [ "$PHFAILCOUNT" != "0" ]
     then
         echo -e "${FAIL} Pi-hole was not found on this system"
         CROSSCOUNT=$((CROSSCOUNT+1))

This worked for making the installation go through. But I can't get gravity-sync itself to work. This is because it uses a similar logic in that script as well. However, my first attempt at a similar fix did not work. Could someone please look into this and help me resolve it.

darnir avatar Jan 14 '24 01:01 darnir

Funnily enough, when detecting a remote install, it worked flawlessly

darnir avatar Jan 14 '24 01:01 darnir

Root Cause: The logic in the installation script is incorrect.

I wouldn't say it's incorrect, I just didn't anticipate that people would want to run two container engines on the same box.

vmstan avatar Jan 15 '24 15:01 vmstan

Effective July 26, 2024, this project has been retired. Thank you for your use and enthusiasm for a project that began as a few lines of bash in a Slack channel and envolved into something far more complex, and used by many thousands of Pi-hole enthusiasts over the last four years.

vmstan avatar Jul 26 '24 18:07 vmstan