diff --git a/Makefile b/Makefile index f39b179131..7645c9d006 100644 --- a/Makefile +++ b/Makefile @@ -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: @@ -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: @@ -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/podman-kube@.service ${DESTDIR}${USERSYSTEMDDIR}/podman-kube@.service + 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/podman-kube@.service $(DESTDIR)${USERSYSTEMDDIR}/podman-kube@.service # 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/podman-kube@.service ${DESTDIR}${SYSTEMDDIR}/podman-kube@.service - 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/podman-kube@.service $(DESTDIR)${SYSTEMDDIR}/podman-kube@.service + 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: @@ -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 diff --git a/docker.in b/docker/docker.in similarity index 100% rename from docker.in rename to docker/docker.in diff --git a/docker/podman-docker.csh b/docker/podman-docker.csh new file mode 100644 index 0000000000..fd82a6e229 --- /dev/null +++ b/docker/podman-docker.csh @@ -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 diff --git a/docker/podman-docker.sh b/docker/podman-docker.sh new file mode 100644 index 0000000000..cd07e361e0 --- /dev/null +++ b/docker/podman-docker.sh @@ -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 diff --git a/rpm/podman.spec b/rpm/podman.spec index cf073d9d18..62ca4dce9f 100644 --- a/rpm/podman.spec +++ b/rpm/podman.spec @@ -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 \ @@ -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