1
0
mirror of https://github.com/containers/podman.git synced 2026-02-05 06:45:31 +01:00

bin/docker: fix broken escaping and variable substitution

In #24034 more variables were added to the envsubst input, but there is no
escaping with envsubst, so the resulting bash script never used
XDG_CONFIG_HOME. Also it replaced HOME with the build time HOME env
var breaking the runtime subsitution, resulting in something bogus like:

[ -e "\${XDG_CONFIG_HOME-\/home/build/.config}/containers/nodocker" ]

Fix by telling envsubst to just replace BINDIR and ETCDIR and remove
the broken escaping in the envsubst input.

Signed-off-by: Christoph Reiter <reiter.christoph@gmail.com>
This commit is contained in:
Christoph Reiter
2024-12-07 14:48:45 +01:00
parent 8ff491b0d9
commit 9c14d15f4c
2 changed files with 2 additions and 2 deletions

View File

@@ -964,7 +964,7 @@ install.completions:
install.docker:
install ${SELINUXOPT} -d -m 755 $(DESTDIR)$(BINDIR)
$(eval INTERPOLATED_DOCKER_SCRIPT := $(shell mktemp))
env BINDIR=${BINDIR} ETCDIR=${ETCDIR} envsubst < docker/docker.in > ${INTERPOLATED_DOCKER_SCRIPT}
env BINDIR=${BINDIR} ETCDIR=${ETCDIR} envsubst '$$BINDIR;$$ETCDIR' < docker/docker.in > ${INTERPOLATED_DOCKER_SCRIPT}
install ${SELINUXOPT} -m 755 ${INTERPOLATED_DOCKER_SCRIPT} $(DESTDIR)$(BINDIR)/docker
rm ${INTERPOLATED_DOCKER_SCRIPT}
install ${SELINUXOPT} -m 755 -d $(DESTDIR)${SYSTEMDDIR} $(DESTDIR)${USERSYSTEMDDIR} $(DESTDIR)${TMPFILESDIR} $(DESTDIR)${USERTMPFILESDIR}

View File

@@ -1,4 +1,4 @@
#!/bin/sh
[ -e ${ETCDIR}/containers/nodocker ] || [ -e "\${XDG_CONFIG_HOME-\$HOME/.config}/containers/nodocker" ] || \
[ -e ${ETCDIR}/containers/nodocker ] || [ -e "${XDG_CONFIG_HOME-$HOME/.config}/containers/nodocker" ] || \
echo "Emulate Docker CLI using podman. Create ${ETCDIR}/containers/nodocker to quiet msg." >&2
exec ${BINDIR}/podman "$@"