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/baselayout/
Date: Mon, 10 Feb 2020 04:31:48
Message-Id: 1581309091.63ef2e4f68dd4b6978641f4fbcd2d04af400d65c.williamh@gentoo
1 commit: 63ef2e4f68dd4b6978641f4fbcd2d04af400d65c
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Mon Feb 10 04:31:31 2020 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 10 04:31:31 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=63ef2e4f
7
8 sys-apps/baselayout: 2.7 bump
9
10 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
11
12 sys-apps/baselayout/Manifest | 1 +
13 sys-apps/baselayout/baselayout-2.7.ebuild | 308 ++++++++++++++++++++++++++++++
14 2 files changed, 309 insertions(+)
15
16 diff --git a/sys-apps/baselayout/Manifest b/sys-apps/baselayout/Manifest
17 index b9d9da5be83..293c93ad739 100644
18 --- a/sys-apps/baselayout/Manifest
19 +++ b/sys-apps/baselayout/Manifest
20 @@ -1,2 +1,3 @@
21 DIST baselayout-2.4.1.tar.bz2 31307 BLAKE2B da26f7fbeefa5efecb6e5d9ded6c2bf3148cd1fcfc6ebb86535f5a9c086c4bb55f6a8420a3c0d0f7008251637f3e4653db875ec427745d039f753008d2f21be2 SHA512 e505ad81834aafb574ffee9bc1fce216c1c8c7fa11b0095580f87a37e4b9efb057ee78db7cd5affc64f05d5dd0592c671304414c119b37d86dfaa1e7b84ce7c1
22 DIST baselayout-2.6.tar.bz2 31871 BLAKE2B 4a51d173dc5a2837f78cd1247b5eadd89e7d0b5f2dbc72e75f027b0c23a5db9a386c53e756e80240f36ad4d63e3fe421bf9510c18321d7a31fda140ad47b2860 SHA512 5cad5faf56871ae951120643e29db0c39fea6dc845b4755382bd469eca32639ec6cd0cd046d3c439a7cc607b18770036f9c256260d35beaffb094e23cb13740b
23 +DIST baselayout-2.7.tar.bz2 30317 BLAKE2B 7b7c284b7d0a9608a0d03dbde0d62d793829b61d5361f5062fdeb8880a2f792c142e20acf7fa92e713e2ebb0bd1609ca65bc8a4191f2bf2c5df4f474eaeef1ee SHA512 8b28d2dc20fd5887db5c0e6b67a4217c4d0730529023fc57fb1ee95a431e1f492fb21e3e66980bef766819e9f542dc7e4ad3ae25465390194bbf970c3653c88e
24
25 diff --git a/sys-apps/baselayout/baselayout-2.7.ebuild b/sys-apps/baselayout/baselayout-2.7.ebuild
26 new file mode 100644
27 index 00000000000..a4b8ca535ac
28 --- /dev/null
29 +++ b/sys-apps/baselayout/baselayout-2.7.ebuild
30 @@ -0,0 +1,308 @@
31 +# Copyright 1999-2020 Gentoo Authors
32 +# Distributed under the terms of the GNU General Public License v2
33 +
34 +EAPI=6
35 +
36 +inherit multilib versionator prefix
37 +
38 +DESCRIPTION="Filesystem baselayout and init scripts"
39 +HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"
40 +if [[ ${PV} = 9999 ]]; then
41 + EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/${PN}.git"
42 + inherit git-r3
43 +else
44 + SRC_URI="https://gitweb.gentoo.org/proj/${PN}.git/snapshot/${P}.tar.bz2"
45 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
46 +fi
47 +
48 +LICENSE="GPL-2"
49 +SLOT="0"
50 +IUSE="build kernel_FreeBSD kernel_linux +split-usr"
51 +
52 +pkg_setup() {
53 + multilib_layout
54 +}
55 +
56 +# Create our multilib dirs - the Makefile has no knowledge of this
57 +multilib_layout() {
58 + local dir def_libdir libdir libdirs
59 + local prefix prefix_lst
60 + def_libdir=$(get_abi_LIBDIR $DEFAULT_ABI)
61 + libdirs=$(get_all_libdirs)
62 + : ${libdirs:=lib} # it isn't that we don't trust multilib.eclass...
63 +
64 + if [[ -z "${SYMLINK_LIB}" || ${SYMLINK_LIB} = no ]] ; then
65 + prefix_lst=( "${EROOT}"{,usr/,usr/local/} )
66 + for prefix in ${prefix_lst[@]}; do
67 + for libdir in ${libdirs}; do
68 + dir="${prefix}${libdir}"
69 + if [[ -e "${dir}" ]]; then
70 + [[ ! -d "${dir}" ]] &&
71 + die "${dir} exists but is not a directory"
72 + continue
73 + fi
74 + if ! use split-usr && [[ ${prefix} = ${EROOT} ]]; then
75 + einfo "symlinking ${dir} to usr/${libdir}"
76 + ln -s usr/${libdir} ${dir} ||
77 + die " Unable to make ${dir} symlink"
78 + else
79 + einfo "creating directory ${dir}"
80 + mkdir -p "${dir}" ||
81 + die "Unable to create ${dir} directory"
82 + fi
83 + done
84 + done
85 + return 0
86 + fi
87 +
88 + [ -z "${def_libdir}" ] &&
89 + die "your DEFAULT_ABI=$DEFAULT_ABI appears to be invalid"
90 +
91 + # figure out which paths should be symlinks and which should be directories
92 + local dirs syms exp d
93 + for libdir in ${libdirs} ; do
94 + if use split-usr ; then
95 + exp=( {,usr/,usr/local/}${libdir} )
96 + else
97 + exp=( {usr/,usr/local/}${libdir} )
98 + fi
99 + for d in "${exp[@]}" ; do
100 + # most things should be dirs
101 + if [ "${SYMLINK_LIB}" = "yes" ] && [ "${libdir}" = "lib" ] ; then
102 + [ ! -h "${d}" ] && [ -e "${d}" ] && dirs+=" ${d}"
103 + else
104 + [ -h "${d}" ] && syms+=" ${d}"
105 + fi
106 + done
107 + done
108 + if [ -n "${syms}${dirs}" ] ; then
109 + ewarn "Your system profile has SYMLINK_LIB=${SYMLINK_LIB:-no}, so that means you need to"
110 + ewarn "have these paths configured as follows:"
111 + [ -n "${dirs}" ] && ewarn "symlinks to '${def_libdir}':${dirs}"
112 + [ -n "${syms}" ] && ewarn "directories:${syms}"
113 + ewarn "The ebuild will attempt to fix these, but only for trivial conversions."
114 + ewarn "If things fail, you will need to manually create/move the directories."
115 + echo
116 + fi
117 +
118 + # setup symlinks and dirs where we expect them to be; do not migrate
119 + # data ... just fall over in that case.
120 + if use split-usr ; then
121 + prefix_lst=( "${EROOT}"{,usr/,usr/local/} )
122 + else
123 + prefix_lst=( "${EROOT}"{usr/,usr/local/} )
124 + fi
125 + for prefix in "${prefix_lst[@]}"; do
126 + if [ "${SYMLINK_LIB}" = yes ] ; then
127 + # we need to make sure "lib" points to the native libdir
128 + if [ -h "${prefix}lib" ] ; then
129 + # it's already a symlink! assume it's pointing to right place ...
130 + continue
131 + elif [ -d "${prefix}lib" ] ; then
132 + # "lib" is a dir, so need to convert to a symlink
133 + ewarn "Converting ${prefix}lib from a dir to a symlink"
134 + rm -f "${prefix}lib"/.keep
135 + if rmdir "${prefix}lib" 2>/dev/null ; then
136 + ln -s ${def_libdir} "${prefix}lib" || die
137 + else
138 + die "non-empty dir found where we needed a symlink: ${prefix}lib"
139 + fi
140 + else
141 + # nothing exists, so just set it up sanely
142 + ewarn "Initializing ${prefix}lib as a symlink"
143 + mkdir -p "${prefix}" || die
144 + rm -f "${prefix}lib" || die
145 + ln -s ${def_libdir} "${prefix}lib" || die
146 + mkdir -p "${prefix}${def_libdir}" #423571
147 + fi
148 + else
149 + # we need to make sure "lib" is a dir
150 + if [ -h "${prefix}lib" ] ; then
151 + # "lib" is a symlink, so need to convert to a dir
152 + ewarn "Converting ${prefix}lib from a symlink to a dir"
153 + rm -f "${prefix}lib" || die
154 + if [ -d "${prefix}lib32" ] ; then
155 + ewarn "Migrating ${prefix}lib32 to ${prefix}lib"
156 + mv "${prefix}lib32" "${prefix}lib" || die
157 + else
158 + mkdir -p "${prefix}lib" || die
159 + fi
160 + elif [ -d "${prefix}lib" ] && ! has lib32 ${libdirs} ; then
161 + # make sure the old "lib" ABI location does not exist; we
162 + # only symlinked the lib dir on systems where we moved it
163 + # to "lib32" ...
164 + case ${CHOST} in
165 + *-gentoo-freebsd*) ;; # We want it the other way on fbsd.
166 + i?86*|x86_64*|powerpc*|sparc*|s390*)
167 + if [[ -d ${prefix}lib32 && ! -h ${prefix}lib32 ]] ; then
168 + rm -f "${prefix}lib32"/.keep
169 + if ! rmdir "${prefix}lib32" 2>/dev/null ; then
170 + ewarn "You need to merge ${prefix}lib32 into ${prefix}lib"
171 + die "non-empty dir found where there should be none: ${prefix}lib32"
172 + fi
173 + fi
174 + ;;
175 + esac
176 + else
177 + # nothing exists, so just set it up sanely
178 + ewarn "Initializing ${prefix}lib as a dir"
179 + mkdir -p "${prefix}lib" || die
180 + fi
181 + fi
182 + done
183 + if ! use split-usr ; then
184 + for libdir in ${libdirs}; do
185 + if [[ ! -e "${EROOT}${libdir}" ]]; then
186 + ln -s usr/"${libdir}" "${EROOT}${libdir}"
187 + fi
188 + done
189 + fi
190 +}
191 +
192 +pkg_preinst() {
193 + # This is written in src_install (so it's in CONTENTS), but punt all
194 + # pending updates to avoid user having to do etc-update (and make the
195 + # pkg_postinst logic simpler).
196 + rm -f "${EROOT}"/etc/._cfg????_gentoo-release
197 +
198 + # We need to install directories and maybe some dev nodes when building
199 + # stages, but they cannot be in CONTENTS.
200 + # Also, we cannot reference $S as binpkg will break so we do this.
201 + multilib_layout
202 + if use build ; then
203 + if use split-usr ; then
204 + emake -C "${ED}/usr/share/${PN}" DESTDIR="${EROOT}" layout
205 + else
206 + emake -C "${ED}/usr/share/${PN}" DESTDIR="${EROOT}" layout-usrmerge
207 + fi
208 + fi
209 + rm -f "${ED}"/usr/share/${PN}/Makefile
210 +}
211 +
212 +src_prepare() {
213 + default
214 + if use prefix; then
215 + hprefixify -e "/EUID/s,0,${EUID}," -q '"' etc/profile
216 + hprefixify etc/{env.d/50baselayout,shells} share.Linux/passwd
217 + echo PATH=/usr/bin:/bin >> etc/env.d/99host
218 + echo ROOTPATH=/usr/sbin:/sbin:/usr/bin:/bin >> etc/env.d/99host
219 + fi
220 +
221 + # don't want symlinked directories in PATH on systems with usr-merge
222 + if ! use split-usr; then
223 + sed \
224 + -e 's|/usr/local/sbin:||g' \
225 + -e 's|:/usr/sbin:|:|g' \
226 + -e 's|:/sbin:|:|g' \
227 + -e 's|:/bin:|:|g' \
228 + -i etc/env.d/50baselayout || die
229 + fi
230 +
231 + # handle multilib paths. do it here because we want this behavior
232 + # regardless of the C library that you're using. we do explicitly
233 + # list paths which the native ldconfig searches, but this isn't
234 + # problematic as it doesn't change the resulting ld.so.cache or
235 + # take longer to generate. similarly, listing both the native
236 + # path and the symlinked path doesn't change the resulting cache.
237 + local libdir ldpaths
238 + for libdir in $(get_all_libdirs) ; do
239 + use split-usr && ldpaths+=":${EPREFIX}/${libdir}"
240 + ldpaths+=":${EPREFIX}/usr/${libdir}"
241 + ldpaths+=":${EPREFIX}/usr/local/${libdir}"
242 + done
243 + echo "LDPATH='${ldpaths#:}'" >> etc/env.d/50baselayout
244 +
245 + # rc-scripts version for testing of features that *should* be present
246 + echo "Gentoo Base System release ${PV}" > etc/gentoo-release
247 +}
248 +
249 +src_install() {
250 + emake \
251 + OS=$(usex kernel_FreeBSD BSD Linux) \
252 + DESTDIR="${ED}" \
253 + install
254 + dodoc ChangeLog
255 +
256 + # need the makefile in pkg_preinst
257 + insinto /usr/share/${PN}
258 + doins Makefile
259 +}
260 +
261 +pkg_postinst() {
262 + local x
263 +
264 + # We installed some files to /usr/share/baselayout instead of /etc to stop
265 + # (1) overwriting the user's settings
266 + # (2) screwing things up when attempting to merge files
267 + # (3) accidentally packaging up personal files with quickpkg
268 + # If they don't exist then we install them
269 + for x in master.passwd passwd shadow group fstab ; do
270 + [ -e "${EROOT}etc/${x}" ] && continue
271 + [ -e "${EROOT}usr/share/baselayout/${x}" ] || continue
272 + cp -p "${EROOT}usr/share/baselayout/${x}" "${EROOT}"etc
273 + done
274 +
275 + # Force shadow permissions to not be world-readable #260993
276 + for x in shadow ; do
277 + [ -e "${EROOT}etc/${x}" ] && chmod o-rwx "${EROOT}etc/${x}"
278 + done
279 +
280 + # Take care of the etc-update for the user
281 + if [ -e "${EROOT}"etc/._cfg0000_gentoo-release ] ; then
282 + mv "${EROOT}"etc/._cfg0000_gentoo-release "${EROOT}"etc/gentoo-release
283 + fi
284 +
285 + # whine about users that lack passwords #193541
286 + if [[ -e "${EROOT}"etc/shadow ]] ; then
287 + local bad_users=$(sed -n '/^[^:]*::/s|^\([^:]*\)::.*|\1|p' "${EROOT}"/etc/shadow)
288 + if [[ -n ${bad_users} ]] ; then
289 + echo
290 + ewarn "The following users lack passwords!"
291 + ewarn ${bad_users}
292 + fi
293 + fi
294 +
295 + # whine about users with invalid shells #215698
296 + if [[ -e "${EROOT}"etc/passwd ]] ; then
297 + local bad_shells=$(awk -F: 'system("test -e " $7) { print $1 " - " $7}' "${EROOT}"etc/passwd | sort)
298 + if [[ -n ${bad_shells} ]] ; then
299 + echo
300 + ewarn "The following users have non-existent shells!"
301 + ewarn "${bad_shells}"
302 + fi
303 + fi
304 +
305 + # https://bugs.gentoo.org/361349
306 + if use kernel_linux; then
307 + mkdir -p "${EROOT}"run
308 +
309 + local found fstype mountpoint
310 + while read -r _ mountpoint fstype _; do
311 + [[ ${mountpoint} = /run ]] && [[ ${fstype} = tmpfs ]] && found=1
312 + done < "${ROOT}"proc/mounts
313 + [[ -z ${found} ]] &&
314 + ewarn "You should reboot now to get /run mounted with tmpfs!"
315 + fi
316 +
317 + for x in ${REPLACING_VERSIONS}; do
318 + if ! version_is_at_least 2.4 ${x}; then
319 + ewarn "After updating ${EROOT}etc/profile, please run"
320 + ewarn "env-update && . /etc/profile"
321 + fi
322 +
323 + if ! version_is_at_least 2.6 ${x}; then
324 + ewarn "Please run env-update then log out and back in to"
325 + ewarn "update your path."
326 + fi
327 + # clean up after 2.5 typos
328 + # https://bugs.gentoo.org/show_bug.cgi?id=656380
329 + if [[ ${x} == 2.5 ]]; then
330 + rm -fr "${EROOT}{,usr"
331 + fi
332 + done
333 +
334 + if [[ -e "${EROOT}"etc/env.d/00basic ]]; then
335 + ewarn "${EROOT}etc/env.d/00basic is now ${EROOT}etc/env.d/50baselayout"
336 + ewarn "Please migrate your changes."
337 + fi
338 +}