recipes: Rename 'pkghashtag' variable to 'pkgcategory'
[dragora.git] / recipes / tools / shadow / recipe
blob4100c8a059f96c1c86382c6528080bd80f9e2fdd
1 # Build recipe for shadow.
3 # Copyright (c) 2016-2019 Matias Fonzo, <selk@dragora.org>.
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
9 #    http://www.apache.org/licenses/LICENSE-2.0
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.
17 program=shadow
18 version=4.7
19 release=1
21 # Define a category for the output of the package name
22 pkgcategory=tools
24 tarname=${program}-${version}.tar.gz
26 # Remote source(s)
27 fetch=http://github.com/shadow-maint/shadow/releases/download/${version}/$tarname
29 description="
30 The shadow tool suite.
32 The shadow package contains programs for handling
33 passwords in a secure way.
36 homepage=http://pkg-shadow.alioth.debian.org
37 license=BSD
39 # Source documentation
40 docs="COPYING NEWS README TODO"
41 docsdir="${docdir}/${pkgname}"
43 build()
45     set -e
47     unpack "${tardir}/$tarname"
49     cd "$srcdir"
51     # Set sane permissions
52     chmod -R u+w,go-w,a+rX-s .
54     # Apply patches
56     # Disable the installation of the groups program and its man pages,
57     # as coreutils provides a better version.  Also prevent the
58     # installation of manual pages that were already installed by the
59     # man pages package (thanks to "Linux From Scratch")
60     patch -Np0 -i "${worktree}/patches/shadow/shadow-manpages"
62     # ruserok(3) is missing from musl
63     patch -Np0 -i "${worktree}/patches/shadow/shadow-no_rlogin"
65     # Apply to use our custom definitions
66     patch -Np0 -i "${worktree}/patches/shadow/shadow-login.defs.diff"
68     ./configure CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
69      $configure_args \
70      --infodir=$infodir \
71      --mandir=$mandir \
72      --docdir=$docsdir \
73      --enable-shadowgrp \
74      --disable-shared \
75      --with-sha-crypt \
76      --with-group-name-max-length=32 \
77      --without-libcrack \
78      --without-nscd \
79      --build="$(cc -dumpmachine)"
81     make -j${jobs}
82     make -j${jobs} check
83     make -j${jobs} DESTDIR="$destdir" install
85     # Include Dragora version of "shadowconfig.sh"
86     cp -p "${worktree}/archive/shadow/usr/sbin/shadowconfig" \
87           "${destdir}/usr/sbin/"
88     chmod 755 "${destdir}/usr/sbin/shadowconfig"
90     # Make the default useradd consistent with our /etc/group file
91     sed -i 's/1000/100/' "${destdir}/etc/default/useradd"
93     # Set mksh(1) as the default shell
94     sed -i 's@SHELL=/bin/bash@SHELL=/bin/mksh@' \
95      "${destdir}/etc/default/useradd"
97     # To handle config file(s)
98     touch "${destdir}/etc/.graft-config" "${destdir}/etc/default/.graft-config"
100     # Compress info documents deleting index file for the package
101     if test -d "${destdir}/$infodir"
102     then
103         rm -f "${destdir}/${infodir}/dir"
104         lzip -9 "${destdir}/${infodir}"/*
105     fi
107     # Compress and link man pages (if needed)
108     if test -d "${destdir}/$mandir"
109     then
110         (
111             cd "${destdir}/$mandir"
112             find . -type f -exec lzip -9 '{}' +
113             find . -type l | while read -r file
114             do
115                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
116                 rm -- "$file"
117             done
118         )
119     fi
121     # Copy documentation
122     mkdir -p "${destdir}${docsdir}"
124     for file in $docs
125     do
126         cp -p $file "${destdir}${docsdir}"
127     done