Skip to content

Commit

Permalink
Merge pull request #21532 from rhatdan/docker
Browse files Browse the repository at this point in the history
[CI:DOCS] Handle DOCKER_HOST environment for podman-docker package
  • Loading branch information
openshift-merge-bot[bot] authored Feb 12, 2024
2 parents c711d87 + ad55ba6 commit 3691f84
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 41 deletions.
83 changes: 43 additions & 40 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -840,14 +840,14 @@ ifneq ($(shell uname -s),FreeBSD)
ln -sfr $(DESTDIR)$(LIBEXECPODMAN)/quadlet $(DESTDIR)$(SYSTEMDGENERATORSDIR)/podman-system-generator
install ${SELINUXOPT} -d -m 755 $(DESTDIR)$(USERSYSTEMDGENERATORSDIR)
ln -sfr $(DESTDIR)$(LIBEXECPODMAN)/quadlet $(DESTDIR)$(USERSYSTEMDGENERATORSDIR)/podman-user-generator
install ${SELINUXOPT} -m 755 -d ${DESTDIR}${TMPFILESDIR}
install ${SELINUXOPT} -m 644 contrib/tmpfile/podman.conf ${DESTDIR}${TMPFILESDIR}/podman.conf
install ${SELINUXOPT} -m 755 -d $(DESTDIR)${TMPFILESDIR}
install ${SELINUXOPT} -m 644 contrib/tmpfile/podman.conf $(DESTDIR)${TMPFILESDIR}/podman.conf
endif

.PHONY: install.modules-load
install.modules-load: # This should only be used by distros which might use iptables-legacy, this is not needed on RHEL
install ${SELINUXOPT} -m 755 -d ${DESTDIR}${MODULESLOADDIR}
install ${SELINUXOPT} -m 644 contrib/modules-load.d/podman-iptables.conf ${DESTDIR}${MODULESLOADDIR}/podman-iptables.conf
install ${SELINUXOPT} -m 755 -d $(DESTDIR)${MODULESLOADDIR}
install ${SELINUXOPT} -m 644 contrib/modules-load.d/podman-iptables.conf $(DESTDIR)${MODULESLOADDIR}/podman-iptables.conf

.PHONY: install.man
install.man:
Expand All @@ -860,27 +860,30 @@ install.man:

.PHONY: install.completions
install.completions:
install ${SELINUXOPT} -d -m 755 ${DESTDIR}${BASHINSTALLDIR}
install ${SELINUXOPT} -m 644 completions/bash/podman ${DESTDIR}${BASHINSTALLDIR}
install ${SELINUXOPT} -m 644 completions/bash/podman-remote ${DESTDIR}${BASHINSTALLDIR}
install ${SELINUXOPT} -d -m 755 ${DESTDIR}${ZSHINSTALLDIR}
install ${SELINUXOPT} -m 644 completions/zsh/_podman ${DESTDIR}${ZSHINSTALLDIR}
install ${SELINUXOPT} -m 644 completions/zsh/_podman-remote ${DESTDIR}${ZSHINSTALLDIR}
install ${SELINUXOPT} -d -m 755 ${DESTDIR}${FISHINSTALLDIR}
install ${SELINUXOPT} -m 644 completions/fish/podman.fish ${DESTDIR}${FISHINSTALLDIR}
install ${SELINUXOPT} -m 644 completions/fish/podman-remote.fish ${DESTDIR}${FISHINSTALLDIR}
install ${SELINUXOPT} -d -m 755 $(DESTDIR)${BASHINSTALLDIR}
install ${SELINUXOPT} -m 644 completions/bash/podman $(DESTDIR)${BASHINSTALLDIR}
install ${SELINUXOPT} -m 644 completions/bash/podman-remote $(DESTDIR)${BASHINSTALLDIR}
install ${SELINUXOPT} -d -m 755 $(DESTDIR)${ZSHINSTALLDIR}
install ${SELINUXOPT} -m 644 completions/zsh/_podman $(DESTDIR)${ZSHINSTALLDIR}
install ${SELINUXOPT} -m 644 completions/zsh/_podman-remote $(DESTDIR)${ZSHINSTALLDIR}
install ${SELINUXOPT} -d -m 755 $(DESTDIR)${FISHINSTALLDIR}
install ${SELINUXOPT} -m 644 completions/fish/podman.fish $(DESTDIR)${FISHINSTALLDIR}
install ${SELINUXOPT} -m 644 completions/fish/podman-remote.fish $(DESTDIR)${FISHINSTALLDIR}
# There is no common location for powershell files so do not install them. Users have to source the file from their powershell profile.

.PHONY: install.docker
install.docker:
install ${SELINUXOPT} -d -m 755 $(DESTDIR)$(BINDIR)
$(eval INTERPOLATED_DOCKER_SCRIPT := $(shell mktemp))
env BINDIR=${BINDIR} ETCDIR=${ETCDIR} envsubst < docker.in > ${INTERPOLATED_DOCKER_SCRIPT}
env BINDIR=${BINDIR} ETCDIR=${ETCDIR} envsubst < 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}
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman-docker.conf -t ${DESTDIR}${TMPFILESDIR}
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman-docker.conf -t ${DESTDIR}${USERTMPFILESDIR}
install ${SELINUXOPT} -m 755 -d $(DESTDIR)${SYSTEMDDIR} $(DESTDIR)${USERSYSTEMDDIR} $(DESTDIR)${TMPFILESDIR} $(DESTDIR)${USERTMPFILESDIR}
install ${SELINUXOPT} -d -m 755 $(DESTDIR)${ETCDIR}/profile.d
install ${SELINUXOPT} -m 644 docker/podman-docker.sh $(DESTDIR)${ETCDIR}/profile.d/podman-docker.sh
install ${SELINUXOPT} -m 644 docker/podman-docker.csh $(DESTDIR)${ETCDIR}/profile.d/podman-docker.csh
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman-docker.conf -t $(DESTDIR)${TMPFILESDIR}
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman-docker.conf -t $(DESTDIR)${USERTMPFILESDIR}

.PHONY: install.docker-docs
install.docker-docs:
Expand All @@ -905,22 +908,22 @@ PODMAN_UNIT_FILES = contrib/systemd/auto-update/podman-auto-update.service \
&& mv -f $@.tmp.$$ $@

install.systemd: $(PODMAN_UNIT_FILES)
install ${SELINUXOPT} -m 755 -d ${DESTDIR}${SYSTEMDDIR} ${DESTDIR}${USERSYSTEMDDIR}
install ${SELINUXOPT} -m 755 -d $(DESTDIR)${SYSTEMDDIR} $(DESTDIR)${USERSYSTEMDDIR}
# User services
install ${SELINUXOPT} -m 644 contrib/systemd/auto-update/podman-auto-update.service ${DESTDIR}${USERSYSTEMDDIR}/podman-auto-update.service
install ${SELINUXOPT} -m 644 contrib/systemd/auto-update/podman-auto-update.timer ${DESTDIR}${USERSYSTEMDDIR}/podman-auto-update.timer
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman.socket ${DESTDIR}${USERSYSTEMDDIR}/podman.socket
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman.service ${DESTDIR}${USERSYSTEMDDIR}/podman.service
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman-restart.service ${DESTDIR}${USERSYSTEMDDIR}/podman-restart.service
install ${SELINUXOPT} -m 644 contrib/systemd/system/[email protected] ${DESTDIR}${USERSYSTEMDDIR}/[email protected]
install ${SELINUXOPT} -m 644 contrib/systemd/auto-update/podman-auto-update.service $(DESTDIR)${USERSYSTEMDDIR}/podman-auto-update.service
install ${SELINUXOPT} -m 644 contrib/systemd/auto-update/podman-auto-update.timer $(DESTDIR)${USERSYSTEMDDIR}/podman-auto-update.timer
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman.socket $(DESTDIR)${USERSYSTEMDDIR}/podman.socket
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman.service $(DESTDIR)${USERSYSTEMDDIR}/podman.service
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman-restart.service $(DESTDIR)${USERSYSTEMDDIR}/podman-restart.service
install ${SELINUXOPT} -m 644 contrib/systemd/system/[email protected] $(DESTDIR)${USERSYSTEMDDIR}/[email protected]
# System services
install ${SELINUXOPT} -m 644 contrib/systemd/auto-update/podman-auto-update.service ${DESTDIR}${SYSTEMDDIR}/podman-auto-update.service
install ${SELINUXOPT} -m 644 contrib/systemd/auto-update/podman-auto-update.timer ${DESTDIR}${SYSTEMDDIR}/podman-auto-update.timer
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman.socket ${DESTDIR}${SYSTEMDDIR}/podman.socket
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman.service ${DESTDIR}${SYSTEMDDIR}/podman.service
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman-restart.service ${DESTDIR}${SYSTEMDDIR}/podman-restart.service
install ${SELINUXOPT} -m 644 contrib/systemd/system/[email protected] ${DESTDIR}${SYSTEMDDIR}/[email protected]
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman-clean-transient.service ${DESTDIR}${SYSTEMDDIR}/podman-clean-transient.service
install ${SELINUXOPT} -m 644 contrib/systemd/auto-update/podman-auto-update.service $(DESTDIR)${SYSTEMDDIR}/podman-auto-update.service
install ${SELINUXOPT} -m 644 contrib/systemd/auto-update/podman-auto-update.timer $(DESTDIR)${SYSTEMDDIR}/podman-auto-update.timer
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman.socket $(DESTDIR)${SYSTEMDDIR}/podman.socket
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman.service $(DESTDIR)${SYSTEMDDIR}/podman.service
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman-restart.service $(DESTDIR)${SYSTEMDDIR}/podman-restart.service
install ${SELINUXOPT} -m 644 contrib/systemd/system/[email protected] $(DESTDIR)${SYSTEMDDIR}/[email protected]
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman-clean-transient.service $(DESTDIR)${SYSTEMDDIR}/podman-clean-transient.service
rm -f $(PODMAN_UNIT_FILES)
else
install.systemd:
Expand Down Expand Up @@ -994,15 +997,15 @@ uninstall:
rm -f $(DESTDIR)$(BINDIR)/podman
rm -f $(DESTDIR)$(BINDIR)/podman-remote
# Remove related config files
rm -f ${DESTDIR}${ETCDIR}/cni/net.d/87-podman-bridge.conflist
rm -f ${DESTDIR}${TMPFILESDIR}/podman.conf
rm -f ${DESTDIR}${SYSTEMDDIR}/io.podman.socket
rm -f ${DESTDIR}${USERSYSTEMDDIR}/io.podman.socket
rm -f ${DESTDIR}${SYSTEMDDIR}/io.podman.service
rm -f ${DESTDIR}${SYSTEMDDIR}/podman.service
rm -f ${DESTDIR}${SYSTEMDDIR}/podman.socket
rm -f ${DESTDIR}${USERSYSTEMDDIR}/podman.socket
rm -f ${DESTDIR}${USERSYSTEMDDIR}/podman.service
rm -f $(DESTDIR)${ETCDIR}/cni/net.d/87-podman-bridge.conflist
rm -f $(DESTDIR)${TMPFILESDIR}/podman.conf
rm -f $(DESTDIR)${SYSTEMDDIR}/io.podman.socket
rm -f $(DESTDIR)${USERSYSTEMDDIR}/io.podman.socket
rm -f $(DESTDIR)${SYSTEMDDIR}/io.podman.service
rm -f $(DESTDIR)${SYSTEMDDIR}/podman.service
rm -f $(DESTDIR)${SYSTEMDDIR}/podman.socket
rm -f $(DESTDIR)${USERSYSTEMDDIR}/podman.socket
rm -f $(DESTDIR)${USERSYSTEMDDIR}/podman.service

.PHONY: clean-binaries
clean-binaries: ## Remove platform/architecture specific binary files
Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletions docker/podman-docker.csh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# DOCKER_HOST initialization

if ($?DOCKER_HOST) exit
if ( "$euid" == 0 ) then
setenv DOCKER_HOST unix:///run/podman/podman.sock
else
if ($?XDG_RUNTIME_DIR) then
setenv DOCKER_HOST unix://$XDG_RUNTIME_DIR/podman/podman.sock
endif
endif
11 changes: 11 additions & 0 deletions docker/podman-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# DOCKER_HOST initialization

if [ -z "$DOCKER_HOST" ]; then
if [ $(id -u) -eq 0 ]; then
export DOCKER_HOST=unix:///run/podman/podman.sock
else
if [ -n "$XDG_RUNTIME_DIR" ]; then
export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/podman/podman.sock
fi
fi
fi
3 changes: 2 additions & 1 deletion rpm/podman.spec
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ LDFLAGS=''

%install
install -dp %{buildroot}%{_unitdir}
PODMAN_VERSION=%{version} %{__make} PREFIX=%{buildroot}%{_prefix} ETCDIR=%{_sysconfdir} \
PODMAN_VERSION=%{version} %{__make} DESTDIR=%{buildroot} PREFIX=%{_prefix} ETCDIR=%{_sysconfdir} \
install.bin \
install.man \
install.systemd \
Expand Down Expand Up @@ -300,6 +300,7 @@ cp -pav test/system %{buildroot}/%{_datadir}/%{name}/test/
%files docker
%{_bindir}/docker
%{_mandir}/man1/docker*.1*
%{_sysconfdir}/profile.d/%{name}-docker.*
%{_tmpfilesdir}/%{name}-docker.conf
%{_user_tmpfilesdir}/%{name}-docker.conf

Expand Down

1 comment on commit 3691f84

@packit-as-a-service
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podman-next COPR build failed. @containers/packit-build please check.

Please sign in to comment.