Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/shadow/
Date: Fri, 15 Nov 2019 21:04:08
Message-Id: 1573851797.f6a87dc1d98b5f3deaeb5b43818f20e17afa79c4.williamh@gentoo
1 commit: f6a87dc1d98b5f3deaeb5b43818f20e17afa79c4
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Fri Nov 15 21:01:07 2019 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Fri Nov 15 21:03:17 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f6a87dc1
7
8 sys-apps/shadow: 4.7-r1: create /etc/sub{g,u}id, remove split-usr
9
10 Bug: https://bugs.gentoo.org/700062
11 Package-Manager: Portage-2.3.76, Repoman-2.3.16
12 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
13
14 sys-apps/shadow/shadow-4.7-r1.ebuild | 212 +++++++++++++++++++++++++++++++++++
15 1 file changed, 212 insertions(+)
16
17 diff --git a/sys-apps/shadow/shadow-4.7-r1.ebuild b/sys-apps/shadow/shadow-4.7-r1.ebuild
18 new file mode 100644
19 index 00000000000..c0735c920ae
20 --- /dev/null
21 +++ b/sys-apps/shadow/shadow-4.7-r1.ebuild
22 @@ -0,0 +1,212 @@
23 +# Copyright 1999-2019 Gentoo Authors
24 +# Distributed under the terms of the GNU General Public License v2
25 +
26 +EAPI=7
27 +
28 +inherit libtool pam
29 +
30 +DESCRIPTION="Utilities to deal with user accounts"
31 +HOMEPAGE="https://github.com/shadow-maint/shadow"
32 +SRC_URI="https://github.com/shadow-maint/shadow/releases/download/${PV}/${P}.tar.gz"
33 +
34 +LICENSE="BSD GPL-2"
35 +SLOT="0"
36 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
37 +IUSE="acl audit +cracklib nls pam selinux skey xattr"
38 +# Taken from the man/Makefile.am file.
39 +LANGS=( cs da de es fi fr hu id it ja ko pl pt_BR ru sv tr zh_CN zh_TW )
40 +
41 +DEPEND="acl? ( sys-apps/acl:0= )
42 + audit? ( >=sys-process/audit-2.6:0= )
43 + cracklib? ( >=sys-libs/cracklib-2.7-r3:0= )
44 + pam? ( sys-libs/pam:0= )
45 + skey? ( sys-auth/skey:0= )
46 + selinux? (
47 + >=sys-libs/libselinux-1.28:0=
48 + sys-libs/libsemanage:0=
49 + )
50 + nls? ( virtual/libintl )
51 + xattr? ( sys-apps/attr:0= )"
52 +BDEPEND="
53 + app-arch/xz-utils
54 + nls? ( sys-devel/gettext )"
55 +RDEPEND="${DEPEND}
56 + pam? ( >=sys-auth/pambase-20150213 )"
57 +
58 +PATCHES=(
59 + "${FILESDIR}/${PN}-4.1.3-dots-in-usernames.patch"
60 +)
61 +
62 +src_prepare() {
63 + default
64 + #eautoreconf
65 + elibtoolize
66 +}
67 +
68 +src_configure() {
69 + local myeconfargs=(
70 + --without-group-name-max-length
71 + --without-tcb
72 + --enable-shared=no
73 + --enable-static=yes
74 + $(use_with acl)
75 + $(use_with audit)
76 + $(use_with cracklib libcrack)
77 + $(use_with pam libpam)
78 + $(use_with skey)
79 + $(use_with selinux)
80 + $(use_enable nls)
81 + $(use_with elibc_glibc nscd)
82 + $(use_with xattr attr)
83 + )
84 + econf "${myeconfargs[@]}"
85 +
86 + has_version 'sys-libs/uclibc[-rpc]' && sed -i '/RLOGIN/d' config.h #425052
87 +
88 + if use nls ; then
89 + local l langs="po" # These are the pot files.
90 + for l in ${LANGS[*]} ; do
91 + has ${l} ${LINGUAS-${l}} && langs+=" ${l}"
92 + done
93 + sed -i "/^SUBDIRS = /s:=.*:= ${langs}:" man/Makefile || die
94 + fi
95 +}
96 +
97 +set_login_opt() {
98 + local comment="" opt=$1 val=$2
99 + if [[ -z ${val} ]]; then
100 + comment="#"
101 + sed -i \
102 + -e "/^${opt}\>/s:^:#:" \
103 + "${ED}"/etc/login.defs || die
104 + else
105 + sed -i -r \
106 + -e "/^#?${opt}\>/s:.*:${opt} ${val}:" \
107 + "${ED}"/etc/login.defs
108 + fi
109 + local res=$(grep "^${comment}${opt}\>" "${ED}"/etc/login.defs)
110 + einfo "${res:-Unable to find ${opt} in /etc/login.defs}"
111 +}
112 +
113 +src_install() {
114 + emake DESTDIR="${D}" suidperms=4711 install
115 +
116 + # Remove libshadow and libmisc; see bug 37725 and the following
117 + # comment from shadow's README.linux:
118 + # Currently, libshadow.a is for internal use only, so if you see
119 + # -lshadow in a Makefile of some other package, it is safe to
120 + # remove it.
121 + rm -f "${ED}"/{,usr/}$(get_libdir)/lib{misc,shadow}.{a,la}
122 +
123 + insinto /etc
124 + if ! use pam ; then
125 + insopts -m0600
126 + doins etc/login.access etc/limits
127 + fi
128 +
129 + # needed for 'useradd -D'
130 + insinto /etc/default
131 + insopts -m0600
132 + doins "${FILESDIR}"/default/useradd
133 +
134 + cd "${S}" || die
135 + insinto /etc
136 + insopts -m0644
137 + newins etc/login.defs login.defs
138 +
139 + set_login_opt CREATE_HOME yes
140 + if ! use pam ; then
141 + set_login_opt MAIL_CHECK_ENAB no
142 + set_login_opt SU_WHEEL_ONLY yes
143 + set_login_opt CRACKLIB_DICTPATH /usr/$(get_libdir)/cracklib_dict
144 + set_login_opt LOGIN_RETRIES 3
145 + set_login_opt ENCRYPT_METHOD SHA512
146 + set_login_opt CONSOLE
147 + else
148 + dopamd "${FILESDIR}"/pam.d-include/shadow
149 +
150 + for x in chpasswd chgpasswd newusers; do
151 + newpamd "${FILESDIR}"/pam.d-include/passwd ${x}
152 + done
153 +
154 + for x in chage chsh chfn \
155 + user{add,del,mod} group{add,del,mod} ; do
156 + newpamd "${FILESDIR}"/pam.d-include/shadow ${x}
157 + done
158 +
159 + # comment out login.defs options that pam hates
160 + local opt sed_args=()
161 + for opt in \
162 + CHFN_AUTH \
163 + CONSOLE \
164 + CRACKLIB_DICTPATH \
165 + ENV_HZ \
166 + ENVIRON_FILE \
167 + FAILLOG_ENAB \
168 + FTMP_FILE \
169 + LASTLOG_ENAB \
170 + MAIL_CHECK_ENAB \
171 + MOTD_FILE \
172 + NOLOGINS_FILE \
173 + OBSCURE_CHECKS_ENAB \
174 + PASS_ALWAYS_WARN \
175 + PASS_CHANGE_TRIES \
176 + PASS_MIN_LEN \
177 + PORTTIME_CHECKS_ENAB \
178 + QUOTAS_ENAB \
179 + SU_WHEEL_ONLY
180 + do
181 + set_login_opt ${opt}
182 + sed_args+=( -e "/^#${opt}\>/b pamnote" )
183 + done
184 + sed -i "${sed_args[@]}" \
185 + -e 'b exit' \
186 + -e ': pamnote; i# NOTE: This setting should be configured via /etc/pam.d/ and not in this file.' \
187 + -e ': exit' \
188 + "${ED}"/etc/login.defs || die
189 +
190 + # remove manpages that pam will install for us
191 + # and/or don't apply when using pam
192 + find "${ED}"/usr/share/man \
193 + '(' -name 'limits.5*' -o -name 'suauth.5*' ')' \
194 + -delete
195 +
196 + # Remove pam.d files provided by pambase.
197 + rm "${ED}"/etc/pam.d/{login,passwd,su} || die
198 + fi
199 +
200 + # Remove manpages that are handled by other packages
201 + find "${ED}"/usr/share/man \
202 + '(' -name id.1 -o -name passwd.5 -o -name getspnam.3 ')' \
203 + -delete
204 +
205 + cd "${S}" || die
206 + dodoc ChangeLog NEWS TODO
207 + newdoc README README.download
208 + cd doc || die
209 + dodoc HOWTO README* WISHLIST *.txt
210 +}
211 +
212 +pkg_preinst() {
213 + rm -f "${EROOT}"/etc/pam.d/system-auth.new \
214 + "${EROOT}/etc/login.defs.new"
215 +}
216 +
217 +pkg_postinst() {
218 + # Enable shadow groups.
219 + if [ ! -f "${EROOT}"/etc/gshadow ] ; then
220 + if grpck -r -R "${EROOT}" 2>/dev/null ; then
221 + grpconv -R "${EROOT}"
222 + else
223 + ewarn "Running 'grpck' returned errors. Please run it by hand, and then"
224 + ewarn "run 'grpconv' afterwards!"
225 + fi
226 + fi
227 +
228 + [[ ! -f "${EROOT}"/etc/subgid ]] &&
229 + touch "${EROOT}"/etc/subgid
230 + [[ ! -f "${EROOT}"/etc/subuid ]] &&
231 + touch "${EROOT}"/etc/subuid
232 +
233 + einfo "The 'adduser' symlink to 'useradd' has been dropped."
234 +}