comparison security/shadow/shadow.sh @ 388:d200ec45c513

security/shadow: rename from core/shadow
author David Demelier <markand@malikania.fr>
date Mon, 01 Apr 2019 20:28:00 +0200
parents core/shadow/shadow.sh@81a30cce56ef
children 515778c3a417
comparison
equal deleted inserted replaced
387:81a30cce56ef 388:d200ec45c513
1 #!/bin/sh
2 #
3 # Copyright (c) 2019 David Demelier <markand@malikania.fr>
4 #
5 # Permission to use, copy, modify, and/or distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
8 #
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 #
17
18 PKGNAME=shadow
19 PKGVERSION=4.6
20 PKGREVISION=1
21 PKGLICENSE="BSD"
22 PKGSUMMARY="password and account management"
23 PKGDOWNLOAD="https://github.com/shadow-maint/shadow/releases/download/$PKGVERSION/$PKGNAME-$PKGVERSION.tar.xz"
24 PKGOPTIONS="ACL ATTR NLS PAM SELINUX"
25 PKGPROTECT="etc/login.defs"
26
27 : ${CHOST:=$(uname -m)-linux-musl}
28 : ${CBUILD:=$(uname -m)-linux-musl}
29 : ${CC:=gcc}
30 : ${CFLAGS:=-O2}
31 : ${LDFLAGS:=}
32 : ${LIBS:=}
33 : ${ACL:=yes}
34 : ${ATTR:=yes}
35 : ${NLS:=yes}
36 : ${PAM:=yes}
37 : ${SELINUX:=no}
38
39 if [ "$ACL" = "yes" ]; then
40 PKGDEPENDS="core/acl $PKGDEPENDS"
41 with_acl="--with-acl"
42 else
43 with_acl="--without-acl"
44 fi
45
46 if [ "$ATTR" = "yes" ]; then
47 PKGDEPENDS="core/acl $PKGDEPENDS"
48 with_attr="--with-attr"
49 else
50 with_attr="--without-attr"
51 fi
52
53 if [ "$NLS" = "yes" ]; then
54 PKGDEPENDS="core/gettext $PKGDEPENDS"
55 with_nls="--enable-nls"
56 else
57 with_nls="--disable-nls"
58 fi
59
60 if [ "$PAM" = "yes" ]; then
61 PKGDEPENDS="security/pam $PKGDEPENDS"
62 with_pam="--with-pam"
63 else
64 with_pam="--without-pam"
65 fi
66
67 if [ "$SELINUX" = "yes" ]; then
68 with_selinux="--enable-selinux"
69 else
70 with_selinux="--disable-selinux"
71 fi
72
73 build()
74 {
75 rm -rf $PKGNAME-$PKGVERSION
76 tar xvaf $PKGNAME-$PKGVERSION.tar.xz
77 pushd $PKGNAME-$PKGVERSION
78
79 # disable groups, it's provided by coreutils and documentation by man-pages.
80 sed -i 's/groups$(EXEEXT) //' src/Makefile.in
81 find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \;
82 find man -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \;
83 find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \;
84
85 CC="$CC" \
86 CFLAGS="$CFLAGS" \
87 LDFLAGS="$LDFLAGS" \
88 LIBS="$LIBS" \
89 ./configure \
90 --build=$CBUILD \
91 --host=$CHOST \
92 --prefix=/usr \
93 --bindir=/usr/bin \
94 --sbindir=/usr/sbin \
95 --sysconfdir=/etc \
96 --without-audit \
97 --without-tcb \
98 --without-libcrack \
99 --disable-static \
100 --enable-shared \
101 $with_acl \
102 $with_attr \
103 $with_nls \
104 $with_pam \
105 $with_selinux
106 make
107 make install DESTDIR=$DESTDIR
108
109 # --disable-selinux does not update pam.d files
110 if [ "$SELINUX" = "no" ]; then
111 sed -i -e "/pam_selinux.so/d" $DESTDIR/etc/pam.d/{login,su}
112 fi
113
114 # pam_console.so isn't shipped with linux-pam.
115 sed -i -e "/pam_console.so/d" $DESTDIR/etc/pam.d/login
116
117 popd
118 rm -rf $PKGNAME-$PKGVERSION
119 }