Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
darnir opened this issue Jan 14, 2024 · 2 comments
Open

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

darnir opened this issue Jan 14, 2024 · 2 comments

Comments

@darnir
Copy link

darnir commented Jan 14, 2024

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
Copy link
Author

darnir commented Jan 14, 2024

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

@vmstan
Copy link
Owner

vmstan commented Jan 15, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants