PKGBUILD 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. # Maintainer (Arch): Sébastien "Seblu" Luttringer
  2. # Maintainer (Arch): Morten Linderud <foxboron@archlinux.org>
  3. # Maintainer: Parabola Hackers <dev@lists.parabola.nu>
  4. # parabola changes and rationale:
  5. # - Added i686 and armv7h
  6. # - Added prepare() to change the default docker registry from
  7. # docker.io (because it contains nonfree software and no policies
  8. # against that). to localhost:5000. See the postinstall message for
  9. # more details.
  10. # - Added postinstall message to warn about the default repository change.
  11. pkgname=docker
  12. pkgver=20.10.23
  13. pkgrel=1
  14. pkgrel+=.parabola1 # Parabola
  15. epoch=1
  16. pkgdesc='Pack, ship and run any application as a lightweight container'
  17. arch=('aarch64' 'armv7h' 'i686' 'x86_64')
  18. url='https://www.docker.com/'
  19. license=('Apache')
  20. depends=('glibc' 'bridge-utils' 'iproute2' 'device-mapper' 'sqlite' 'systemd-libs'
  21. 'libseccomp' 'libtool' 'runc' 'containerd')
  22. makedepends=('git' 'go' 'btrfs-progs' 'cmake' 'systemd' 'go-md2man' 'sed')
  23. optdepends=('btrfs-progs: btrfs backend support'
  24. 'pigz: parallel gzip compressor support'
  25. 'docker-scan: vulnerability scanner'
  26. 'docker-buildx: extended build capabilities')
  27. # https://github.com/moby/moby/tree/v20.10.0/hack/dockerfile/install
  28. _TINI_COMMIT=de40ad007797e0dcd8b7126f27bb87401d224240
  29. _LIBNETWORK_COMMIT=05b93e0d3a95952f70c113b0bc5bdb538d7afdd7
  30. source=("git+https://github.com/docker/cli.git#tag=v$pkgver"
  31. "git+https://github.com/moby/moby.git#tag=v$pkgver"
  32. "git+https://github.com/docker/libnetwork.git#commit=$_LIBNETWORK_COMMIT"
  33. "git+https://github.com/krallin/tini.git#commit=$_TINI_COMMIT"
  34. "$pkgname.sysusers")
  35. source+=('docker' 'docker.hook') # Parabola
  36. sha256sums=('SKIP'
  37. 'SKIP'
  38. 'SKIP'
  39. 'SKIP'
  40. '541826011a9836d05a2f42293d5f1beadf2ca8d89fb604487d61a013505678eb')
  41. sha256sums+=('SKIP' 'SKIP') # Parabola
  42. # create a fake go path directory and pushd into it
  43. # $1 real directory
  44. # $2 gopath directory
  45. _fake_gopath_pushd() {
  46. mkdir -p "$GOPATH/src/${2%/*}"
  47. rm -f "$GOPATH/src/$2"
  48. ln -rsT "$1" "$GOPATH/src/$2"
  49. pushd "$GOPATH/src/$2" >/dev/null
  50. }
  51. _fake_gopath_popd() {
  52. popd >/dev/null
  53. }
  54. prepare() {
  55. # Remove the default repository (contains nonfree software)
  56. sed 's/Scheme: "https",/Scheme: "http",/' -i \
  57. moby/registry/config.go \
  58. cli/vendor/github.com/docker/docker/registry/config.go \
  59. ${sentinel}
  60. sed 's/registry-1\.docker\.io/localhost/g' -i \
  61. moby/registry/config.go \
  62. cli/vendor/github.com/docker/docker/registry/config.go \
  63. ${sentinel}
  64. # Seems to only use the registry-1.docker.io repository
  65. rm -f moby/contrib/download-frozen-image-v2.sh
  66. # TODO:
  67. # - We currently need to use registry-1.docker.io instead of
  68. # docker.io. For instance:
  69. # sudo docker run -it --rm \
  70. # registry-1.docker.io/pureos/byzantium bash -c "echo hello world"
  71. # This needs to be fixed for keeping the compatibility with docker
  72. #
  73. # - Check if all docker work fine. For instance do DockerFiles still
  74. # refer to the registry-1.docker.io repository? What about other
  75. # parts of Docker?
  76. #
  77. # - Find an FSDG compliant repository and Use another example:
  78. # - moby/vendor/github.com/docker/distribution/registry/api/v2/descriptors.go
  79. # - moby/vendor/github.com/docker/distribution/registry/client/auth/session.go
  80. #
  81. # - Fix Documentation:
  82. # - cli/docs/reference/commandline/tag.md
  83. # - cli/man/src/image/pull.md
  84. # - cli/man/src/image/tag.md
  85. #
  86. }
  87. build() {
  88. ### check my mistakes on commit version
  89. echo 'Checking commit mismatch'
  90. (
  91. local _cfile
  92. for _cfile in tini proxy; do
  93. . "moby/hack/dockerfile/install/$_cfile.installer"
  94. done
  95. local _commit _pkgbuild _dockerfile
  96. err=0
  97. # FIXME: Do not check TINI anymore, use tag instead of commit
  98. for _commit in LIBNETWORK; do
  99. _pkgbuild=_${_commit}_COMMIT
  100. _dockerfile=${_commit}_COMMIT
  101. if [[ ${!_pkgbuild} != ${!_dockerfile} ]]; then
  102. echo "Invalid $_commit commit, should be ${!_dockerfile}" >&2
  103. err=$(($err + 1))
  104. fi
  105. done
  106. return $err
  107. )
  108. ### globals
  109. export GOPATH="$srcdir"
  110. export PATH="$GOPATH/bin:$PATH"
  111. export CGO_CPPFLAGS="${CPPFLAGS}"
  112. export CGO_CFLAGS="${CFLAGS}"
  113. export CGO_CXXFLAGS="${CXXFLAGS}"
  114. export CGO_LDFLAGS="${LDFLAGS}"
  115. export LDFLAGS=''
  116. export GOFLAGS='-buildmode=pie -trimpath -mod=readonly -modcacherw -ldflags=-linkmode=external'
  117. export GO111MODULE=off
  118. export DISABLE_WARN_OUTSIDE_CONTAINER=1
  119. ### cli
  120. echo 'Building cli'
  121. _fake_gopath_pushd cli github.com/docker/cli
  122. make VERSION=$pkgver dynbinary
  123. make manpages
  124. _fake_gopath_popd
  125. ### daemon
  126. echo 'Building daemon'
  127. _fake_gopath_pushd moby github.com/docker/docker
  128. DOCKER_GITCOMMIT=$(cd "$srcdir"/moby && git rev-parse --short HEAD) \
  129. DOCKER_BUILDTAGS='seccomp journald apparmor' \
  130. VERSION=$pkgver \
  131. hack/make.sh dynbinary
  132. _fake_gopath_popd
  133. ### docker proxy
  134. echo 'Building docker-proxy'
  135. _fake_gopath_pushd libnetwork github.com/docker/libnetwork
  136. go build github.com/docker/libnetwork/cmd/proxy
  137. _fake_gopath_popd
  138. ### docker-init
  139. echo 'Building docker-init'
  140. _fake_gopath_pushd tini github.com/krallin/tini
  141. cmake .
  142. # we must use the static binary because it's started in a foreign os
  143. make tini-static
  144. _fake_gopath_popd
  145. }
  146. package() {
  147. ### proxy
  148. install -Dm755 libnetwork/proxy "$pkgdir/usr/bin/docker-proxy"
  149. ### init
  150. install -Dm755 tini/tini-static "$pkgdir/usr/bin/docker-init"
  151. ### dockerd
  152. install -Dm755 moby/bundles/dynbinary-daemon/dockerd "$pkgdir"/usr/bin/dockerd
  153. ### systemd units
  154. cd "$srcdir"/moby/contrib
  155. install -Dm644 'init/systemd/docker.service' "$pkgdir/usr/lib/systemd/system/docker.service"
  156. install -Dm644 'init/systemd/docker.socket' "$pkgdir/usr/lib/systemd/system/docker.socket"
  157. # systemd rules
  158. install -Dm644 'udev/80-docker.rules' "$pkgdir/usr/lib/udev/rules.d/80-docker.rules"
  159. install -Dm644 "$srcdir/$pkgname.sysusers" "$pkgdir/usr/lib/sysusers.d/$pkgname.conf"
  160. ### cli
  161. cd "$srcdir"/cli
  162. # binary
  163. install -Dm755 build/docker "$pkgdir/usr/bin/docker"
  164. # completion
  165. install -Dm644 'contrib/completion/bash/docker' "$pkgdir/usr/share/bash-completion/completions/docker"
  166. install -Dm644 'contrib/completion/zsh/_docker' "$pkgdir/usr/share/zsh/site-functions/_docker"
  167. install -Dm644 'contrib/completion/fish/docker.fish' "$pkgdir/usr/share/fish/vendor_completions.d/docker.fish"
  168. # man
  169. install -dm755 "$pkgdir/usr/share/man"
  170. cp -r man/man* "$pkgdir/usr/share/man"
  171. # START Parabola
  172. cd "${srcdir}"
  173. install -d "${pkgdir}/usr/share/libalpm/hooks/"
  174. install -Dm644 docker.hook -t "${pkgdir}/usr/share/libalpm/hooks/"
  175. install -d "${pkgdir}/usr/share/libalpm/scripts/"
  176. install -Dm755 docker -t "${pkgdir}/usr/share/libalpm/scripts/"
  177. # END Parabola
  178. }
  179. # vim:set ts=2 sw=2 et: