recipe 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. # Build recipe for shadow.
  2. #
  3. # Copyright (c) 2016-2019, 2021 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. # Exit immediately on any error
  17. set -e
  18. program=shadow
  19. version=4.8.1
  20. release=1
  21. # Define a category for the output of the package name
  22. pkgcategory=tools
  23. tarname=${program}-${version}.tar.gz
  24. # Remote source(s)
  25. fetch=https://github.com/shadow-maint/shadow/releases/download/${version}/$tarname
  26. description="
  27. The shadow tool suite.
  28. The shadow package contains programs for handling
  29. passwords in a secure way.
  30. "
  31. homepage=https://pkg-shadow.alioth.debian.org
  32. license=BSD
  33. # Source documentation
  34. docs="COPYING NEWS README TODO"
  35. docsdir="${docdir}/${pkgname}"
  36. build()
  37. {
  38. unpack "${tardir}/$tarname"
  39. cd "$srcdir"
  40. # Set sane permissions
  41. chmod -R u+w,go-w,a+rX-s .
  42. # Apply patches
  43. # ruserok(3) is missing from musl
  44. patch -Np0 -i "${worktree}/patches/shadow/shadow-no_rlogin"
  45. # Apply to use our custom definitions
  46. patch -Np0 -i "${worktree}/patches/shadow/shadow-login.defs.diff"
  47. # Disable the installation of the groups program and its man pages,
  48. # as Coreutils provides a better version. Also, prevent the
  49. # installation of manual pages that were already installed in the
  50. # man-pages package (Thanks to "Linux From Scratch" :-)
  51. sed -i 's/groups$(EXEEXT) //' src/Makefile.in
  52. find man -type f -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \;
  53. find man -type f -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \;
  54. find man -type f -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \;
  55. ./configure CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
  56. $configure_args \
  57. --infodir=$infodir \
  58. --mandir=$mandir \
  59. --docdir=$docsdir \
  60. --enable-shadowgrp \
  61. --disable-shared \
  62. --with-sha-crypt \
  63. --with-group-name-max-length=32 \
  64. --without-libcrack \
  65. --without-nscd \
  66. --build="$(gcc -dumpmachine)"
  67. make -j${jobs} V=1
  68. make -j${jobs} V=1 check
  69. make -j${jobs} DESTDIR="$destdir" install
  70. # Include Dragora version of "shadowconfig.sh"
  71. cp -p "${worktree}/archive/shadow/usr/sbin/shadowconfig" \
  72. "${destdir}/usr/sbin/"
  73. chmod 755 "${destdir}/usr/sbin/shadowconfig"
  74. # Make the default useradd consistent with our /etc/group file
  75. sed -i 's/1000/100/' "${destdir}/etc/default/useradd"
  76. # Set mksh(1) as the default shell
  77. sed -i 's@SHELL=/bin/bash@SHELL=/bin/mksh@' \
  78. "${destdir}/etc/default/useradd"
  79. # To handle config file(s)
  80. touch "${destdir}/etc/.graft-config" "${destdir}/etc/default/.graft-config"
  81. # Compress info documents deleting index file for the package
  82. if test -d "${destdir}/$infodir"
  83. then
  84. rm -f "${destdir}/${infodir}/dir"
  85. lzip -9 "${destdir}/${infodir}"/*
  86. fi
  87. # Compress and link man pages (if needed)
  88. if test -d "${destdir}/$mandir"
  89. then
  90. (
  91. cd "${destdir}/$mandir"
  92. find . -type f -exec lzip -9 {} +
  93. find . -type l | while read -r file
  94. do
  95. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  96. rm -- "$file"
  97. done
  98. )
  99. fi
  100. # Copy documentation
  101. mkdir -p "${destdir}${docsdir}"
  102. cp -p $docs "${destdir}${docsdir}"
  103. }