recipe 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. # Build recipe for shadow.
  2. #
  3. # Copyright (c) 2016-2019, 2021-2022 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.11.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 to use our custom definitions
  43. patch -Np1 -i "${worktree}/patches/shadow/shadow-login.defs.diff"
  44. # Disable the installation of the groups program and its man pages,
  45. # as Coreutils provides a better version. Also, prevent the
  46. # installation of manual pages that were already installed in the
  47. # man-pages package (Thanks to "Linux From Scratch" :-)
  48. sed -i 's/groups$(EXEEXT) //' src/Makefile.in
  49. find man -type f -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \;
  50. find man -type f -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \;
  51. find man -type f -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \;
  52. ./configure CPPFLAGS="$QICPPFLAGS" \
  53. CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
  54. $configure_args \
  55. --infodir=$infodir \
  56. --mandir=$mandir \
  57. --docdir=$docsdir \
  58. --enable-shadowgrp \
  59. --disable-shared \
  60. --with-sha-crypt \
  61. --with-group-name-max-length=32 \
  62. --with-su \
  63. --without-libcrack \
  64. --build="$(gcc -dumpmachine)"
  65. make -j${jobs} V=1
  66. make -j${jobs} V=1 check
  67. make -j${jobs} DESTDIR="$destdir" install
  68. # Include Dragora version of "shadowconfig.sh"
  69. cp -p "${worktree}/archive/shadow/usr/sbin/shadowconfig" \
  70. "${destdir}/usr/sbin/"
  71. chmod 755 "${destdir}/usr/sbin/shadowconfig"
  72. # Insert our default useradd file for default users definition
  73. mkdir -p "${destdir}/etc/default"
  74. install -p -m 644 "${worktree}/archive/shadow/etc/default/useradd" \
  75. "${destdir}/etc/default/useradd"
  76. # To handle config file(s)
  77. touch "${destdir}/etc/.graft-config" "${destdir}/etc/default/.graft-config"
  78. # Compress info documents deleting index file for the package
  79. if test -d "${destdir}/$infodir"
  80. then
  81. rm -f "${destdir}/${infodir}/dir"
  82. lzip -9 "${destdir}/${infodir}"/*
  83. fi
  84. # Compress and link man pages (if needed)
  85. if test -d "${destdir}/$mandir"
  86. then
  87. (
  88. cd "${destdir}/$mandir"
  89. find . -type f -exec lzip -9 {} +
  90. find . -type l | while read -r file
  91. do
  92. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  93. rm -- "$file"
  94. done
  95. )
  96. fi
  97. # Copy documentation
  98. mkdir -p "${destdir}/$docsdir"
  99. cp -p $docs "${destdir}/$docsdir"
  100. }