github.com/shiroyuki/docker@v1.9.0/hack/make/.build-rpm/docker-engine.spec (about)

     1  Name: docker-engine
     2  Version: %{_version}
     3  Release: %{_release}%{?dist}
     4  Summary: The open-source application container engine
     5  Group: Tools/Docker
     6  
     7  License: ASL 2.0
     8  Source: %{name}.tar.gz
     9  
    10  URL: https://dockerproject.org
    11  Vendor: Docker
    12  Packager: Docker <support@docker.com>
    13  
    14  # docker builds in a checksum of dockerinit into docker,
    15  # # so stripping the binaries breaks docker
    16  %global __os_install_post %{_rpmconfigdir}/brp-compress
    17  %global debug_package %{nil}
    18  
    19  # is_systemd conditional
    20  %if 0%{?fedora} >= 21 || 0%{?centos} >= 7 || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1300
    21  %global is_systemd 1
    22  %endif
    23  
    24  # required packages for build
    25  # most are already in the container (see contrib/builder/rpm/generate.sh)
    26  # only require systemd on those systems
    27  %if 0%{?is_systemd}
    28  BuildRequires: pkgconfig(systemd)
    29  Requires: systemd-units
    30  %if !0%{?suse_version}
    31  BuildRequires: pkgconfig(libsystemd-journal)
    32  %endif
    33  %else
    34  Requires(post): chkconfig
    35  Requires(preun): chkconfig
    36  # This is for /sbin/service
    37  Requires(preun): initscripts
    38  %endif
    39  
    40  # required packages on install
    41  Requires: /bin/sh
    42  Requires: iptables
    43  Requires: libcgroup
    44  Requires: tar
    45  Requires: xz
    46  %if 0%{?fedora} >= 21
    47  # Resolves: rhbz#1165615
    48  Requires: device-mapper-libs >= 1.02.90-1
    49  %endif
    50  %if 0%{?oraclelinux} == 6
    51  # Require Oracle Unbreakable Enterprise Kernel R3 and newer device-mapper
    52  Requires: kernel-uek >= 3.8
    53  Requires: device-mapper >= 1.02.90-2
    54  %endif
    55  
    56  # docker-selinux conditional
    57  %if 0%{?fedora} >= 20 || 0%{?centos} >= 7 || 0%{?rhel} >= 7 || 0%{?oraclelinux} >= 7
    58  %global with_selinux 1
    59  %endif
    60  
    61  # start if with_selinux
    62  %if 0%{?with_selinux}
    63  # Version of SELinux we were using
    64  %if 0%{?fedora} == 20
    65  %global selinux_policyver 3.12.1-197
    66  %endif # fedora 20
    67  %if 0%{?fedora} == 21
    68  %global selinux_policyver 3.13.1-105
    69  %endif # fedora 21
    70  %if 0%{?fedora} >= 22
    71  %global selinux_policyver 3.13.1-128
    72  %endif # fedora 22
    73  %if 0%{?centos} >= 7 || 0%{?rhel} >= 7 || 0%{?oraclelinux} >= 7
    74  %global selinux_policyver 3.13.1-23
    75  %endif # centos,oraclelinux 7
    76  %endif # with_selinux
    77  
    78  # RE: rhbz#1195804 - ensure min NVR for selinux-policy
    79  %if 0%{?with_selinux}
    80  Requires: selinux-policy >= %{selinux_policyver}
    81  Requires(pre): %{name}-selinux >= %{epoch}:%{version}-%{release}
    82  %endif # with_selinux
    83  
    84  # conflicting packages
    85  Conflicts: docker
    86  Conflicts: docker-io
    87  
    88  %description
    89  Docker is an open source project to build, ship and run any application as a
    90  lightweight container.
    91  
    92  Docker containers are both hardware-agnostic and platform-agnostic. This means
    93  they can run anywhere, from your laptop to the largest EC2 compute instance and
    94  everything in between - and they don't require you to use a particular
    95  language, framework or packaging system. That makes them great building blocks
    96  for deploying and scaling web apps, databases, and backend services without
    97  depending on a particular stack or provider.
    98  
    99  %prep
   100  %if 0%{?centos} <= 6
   101  %setup -n %{name}
   102  %else
   103  %autosetup -n %{name}
   104  %endif
   105  
   106  %build
   107  export DOCKER_GITCOMMIT=%{_gitcommit}
   108  ./hack/make.sh dynbinary
   109  # ./man/md2man-all.sh runs outside the build container (if at all), since we don't have go-md2man here
   110  
   111  %check
   112  ./bundles/%{_origversion}/dynbinary/docker -v
   113  
   114  %install
   115  # install binary
   116  install -d $RPM_BUILD_ROOT/%{_bindir}
   117  install -p -m 755 bundles/%{_origversion}/dynbinary/docker-%{_origversion} $RPM_BUILD_ROOT/%{_bindir}/docker
   118  
   119  # install dockerinit
   120  install -d $RPM_BUILD_ROOT/%{_libexecdir}/docker
   121  install -p -m 755 bundles/%{_origversion}/dynbinary/dockerinit-%{_origversion} $RPM_BUILD_ROOT/%{_libexecdir}/docker/dockerinit
   122  
   123  # install udev rules
   124  install -d $RPM_BUILD_ROOT/%{_sysconfdir}/udev/rules.d
   125  install -p -m 755 contrib/udev/80-docker.rules $RPM_BUILD_ROOT/%{_sysconfdir}/udev/rules.d/80-docker.rules
   126  
   127  # add init scripts
   128  install -d $RPM_BUILD_ROOT/etc/sysconfig
   129  install -d $RPM_BUILD_ROOT/%{_initddir}
   130  
   131  
   132  %if 0%{?is_systemd}
   133  install -d $RPM_BUILD_ROOT/%{_unitdir}
   134  install -p -m 644 contrib/init/systemd/docker.service $RPM_BUILD_ROOT/%{_unitdir}/docker.service
   135  install -p -m 644 contrib/init/systemd/docker.socket $RPM_BUILD_ROOT/%{_unitdir}/docker.socket
   136  %else
   137  install -p -m 644 contrib/init/sysvinit-redhat/docker.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/docker
   138  install -p -m 755 contrib/init/sysvinit-redhat/docker $RPM_BUILD_ROOT/%{_initddir}/docker
   139  %endif
   140  # add bash completions
   141  install -d $RPM_BUILD_ROOT/usr/share/bash-completion/completions
   142  install -d $RPM_BUILD_ROOT/usr/share/zsh/vendor-completions
   143  install -d $RPM_BUILD_ROOT/usr/share/fish/completions
   144  install -p -m 644 contrib/completion/bash/docker $RPM_BUILD_ROOT/usr/share/bash-completion/completions/docker
   145  install -p -m 644 contrib/completion/zsh/_docker $RPM_BUILD_ROOT/usr/share/zsh/vendor-completions/_docker
   146  install -p -m 644 contrib/completion/fish/docker.fish $RPM_BUILD_ROOT/usr/share/fish/completions/docker.fish
   147  
   148  # install manpages
   149  install -d %{buildroot}%{_mandir}/man1
   150  install -p -m 644 man/man1/*.1 $RPM_BUILD_ROOT/%{_mandir}/man1
   151  install -d %{buildroot}%{_mandir}/man5
   152  install -p -m 644 man/man5/*.5 $RPM_BUILD_ROOT/%{_mandir}/man5
   153  
   154  # add vimfiles
   155  install -d $RPM_BUILD_ROOT/usr/share/vim/vimfiles/doc
   156  install -d $RPM_BUILD_ROOT/usr/share/vim/vimfiles/ftdetect
   157  install -d $RPM_BUILD_ROOT/usr/share/vim/vimfiles/syntax
   158  install -p -m 644 contrib/syntax/vim/doc/dockerfile.txt $RPM_BUILD_ROOT/usr/share/vim/vimfiles/doc/dockerfile.txt
   159  install -p -m 644 contrib/syntax/vim/ftdetect/dockerfile.vim $RPM_BUILD_ROOT/usr/share/vim/vimfiles/ftdetect/dockerfile.vim
   160  install -p -m 644 contrib/syntax/vim/syntax/dockerfile.vim $RPM_BUILD_ROOT/usr/share/vim/vimfiles/syntax/dockerfile.vim
   161  
   162  # add nano
   163  install -d $RPM_BUILD_ROOT/usr/share/nano
   164  install -p -m 644 contrib/syntax/nano/Dockerfile.nanorc $RPM_BUILD_ROOT/usr/share/nano/Dockerfile.nanorc
   165  
   166  # list files owned by the package here
   167  %files
   168  %doc AUTHORS CHANGELOG.md CONTRIBUTING.md LICENSE MAINTAINERS NOTICE README.md
   169  /%{_bindir}/docker
   170  /%{_libexecdir}/docker/dockerinit
   171  /%{_sysconfdir}/udev/rules.d/80-docker.rules
   172  %if 0%{?is_systemd}
   173  /%{_unitdir}/docker.service
   174  /%{_unitdir}/docker.socket
   175  %else
   176  %config(noreplace,missingok) /etc/sysconfig/docker
   177  /%{_initddir}/docker
   178  %endif
   179  /usr/share/bash-completion/completions/docker
   180  /usr/share/zsh/vendor-completions/_docker
   181  /usr/share/fish/completions/docker.fish
   182  %doc
   183  /%{_mandir}/man1/*
   184  /%{_mandir}/man5/*
   185  /usr/share/vim/vimfiles/doc/dockerfile.txt
   186  /usr/share/vim/vimfiles/ftdetect/dockerfile.vim
   187  /usr/share/vim/vimfiles/syntax/dockerfile.vim
   188  /usr/share/nano/Dockerfile.nanorc
   189  
   190  %post
   191  %if 0%{?is_systemd}
   192  %systemd_post docker
   193  %else
   194  # This adds the proper /etc/rc*.d links for the script
   195  /sbin/chkconfig --add docker
   196  %endif
   197  if ! getent group docker > /dev/null; then
   198      groupadd --system docker
   199  fi
   200  
   201  %preun
   202  %if 0%{?is_systemd}
   203  %systemd_preun docker
   204  %else
   205  if [ $1 -eq 0 ] ; then
   206      /sbin/service docker stop >/dev/null 2>&1
   207      /sbin/chkconfig --del docker
   208  fi
   209  %endif
   210  
   211  %postun
   212  %if 0%{?is_systemd}
   213  %systemd_postun_with_restart docker
   214  %else
   215  if [ "$1" -ge "1" ] ; then
   216      /sbin/service docker condrestart >/dev/null 2>&1 || :
   217  fi
   218  %endif
   219  
   220  %changelog