recipe 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. # Build recipe for shadow.
  2. #
  3. # Copyright (c) 2016-2018 Matias Fonzo, <selk@dragora.org>.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. program=shadow
  17. version=4.6
  18. release=1
  19. # Set 'outdir' for a nice and well-organized output directory
  20. outdir="${outdir}/${arch}/tools"
  21. tarname=${program}-${version}.tar.gz
  22. # Remote source(s)
  23. fetch=http://github.com/shadow-maint/shadow/releases/download/${version}/$tarname
  24. description="
  25. The shadow tool suite.
  26. The shadow package contains programs for handling
  27. passwords in a secure way.
  28. "
  29. homepage=http://pkg-shadow.alioth.debian.org
  30. license=BSD
  31. # Source documentation
  32. docs="COPYING NEWS README TODO"
  33. docsdir="${docdir}/${pkgname}"
  34. build()
  35. {
  36. set -e
  37. unpack "${tardir}/$tarname"
  38. cd "$srcdir"
  39. # Set sane permissions
  40. chmod -R u+w,go-w,a+rX-s .
  41. # Apply patches
  42. # Disable the installation of the groups program and its man pages,
  43. # as coreutils provides a better version. Also prevent the
  44. # installation of manual pages that were already installed by the
  45. # man pages package (thanks to "Linux From Scratch")
  46. patch -Np0 -i "${worktree}/patches/shadow/shadow-manpages"
  47. # ruserok(3) is missing from musl
  48. patch -Np0 -i "${worktree}/patches/shadow/shadow-no_rlogin"
  49. # Apply to use our custom definitions
  50. patch -Np0 -i "${worktree}/patches/shadow/shadow-login.defs.diff"
  51. ./configure CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
  52. $configure_args \
  53. --infodir=$infodir \
  54. --mandir=$mandir \
  55. --docdir=$docsdir \
  56. --enable-shadowgrp \
  57. --disable-shared \
  58. --with-sha-crypt \
  59. --with-group-name-max-length=32 \
  60. --without-libcrack \
  61. --without-nscd \
  62. --build="$(cc -dumpmachine)"
  63. make -j${jobs}
  64. make -j${jobs} check
  65. make -j${jobs} DESTDIR="$destdir" install
  66. # Include Dragora version of "shadowconfig.sh"
  67. cp -p "${worktree}/archive/shadow/usr/sbin/shadowconfig" \
  68. "${destdir}/usr/sbin/"
  69. chmod 755 "${destdir}/usr/sbin/shadowconfig"
  70. # Make the default useradd consistent with our /etc/group file
  71. sed -i 's/1000/100/' "${destdir}/etc/default/useradd"
  72. # Set mksh(1) as the default shell
  73. sed -i 's@SHELL=/bin/bash@SHELL=/bin/mksh@' \
  74. "${destdir}/etc/default/useradd"
  75. # To handle config file(s)
  76. touch "${destdir}/etc/.graft-config" "${destdir}/etc/default/.graft-config"
  77. # Compress info documents deleting index file for the package
  78. if test -d "${destdir}/$infodir"
  79. then
  80. rm -f "${destdir}/${infodir}/dir"
  81. lzip -9 "${destdir}/${infodir}"/*
  82. fi
  83. # Compress and link man pages (if needed)
  84. if test -d "${destdir}/$mandir"
  85. then
  86. (
  87. cd "${destdir}/$mandir"
  88. find . -type f -exec lzip -9 '{}' +
  89. find . -type l | while read -r file
  90. do
  91. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  92. rm -- "$file"
  93. done
  94. )
  95. fi
  96. # Copy documentation
  97. mkdir -p "${destdir}${docsdir}"
  98. for file in $docs
  99. do
  100. cp -p $file "${destdir}${docsdir}"
  101. done
  102. }