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: Thu, 01 Sep 2016 21:44:56
Message-Id: 1472766265.78f20d7454dfae84fb38f8d53f1366b3c47fcf59.williamh@gentoo
1 commit: 78f20d7454dfae84fb38f8d53f1366b3c47fcf59
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Thu Sep 1 21:44:00 2016 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 1 21:44:25 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=78f20d74
7
8 sys-apps/baselayout: 2.3 version bump
9
10 Package-Manager: portage-2.2.28
11
12 sys-apps/baselayout/Manifest | 1 +
13 sys-apps/baselayout/baselayout-2.3.ebuild | 244 ++++++++++++++++++++++++++++++
14 2 files changed, 245 insertions(+)
15
16 diff --git a/sys-apps/baselayout/Manifest b/sys-apps/baselayout/Manifest
17 index 1951dcd..93b99ea 100644
18 --- a/sys-apps/baselayout/Manifest
19 +++ b/sys-apps/baselayout/Manifest
20 @@ -1 +1,2 @@
21 DIST baselayout-2.2.tar.bz2 40744 SHA256 11d4a223b06da545c3e59e07c9195570f334b5b1be05d995df0ebc8ea2203e98 SHA512 a5199c42e835d9f2683cc94f3c4c47ecdc392316c24e0932845736e2e90479b0c5c8ad72ead8e0537f097405b7d7548d00b87b7ff8c9e3651486e3c5c0970b36 WHIRLPOOL 60cc4f7f76c5a45c15303e526decffb3bad2b50ac659b1dd072d2ed4b0eb0b31929a1a733ddb03a31ee5882b889a4efb87206f63ffaa2b11e26d36afd0933a95
22 +DIST baselayout-2.3.tar.bz2 32266 SHA256 e7bbd7d71ede6820a37738fd2e9010d54545fbd73c16ee686663dee2075c5d4c SHA512 cf9636c7d5c1fb4abf63dd931dc8ceaa30cf871f5e576a53dcc207abd54b8eec7778a1ef29766e2e8f5c0a098b9b3d07361717ae190027d1e102aceb4a07cacb WHIRLPOOL 92e88f5ff0eddd56698977bb6578ee53f62755bfdd9023fc7151415fce4a87952b539e0da3a7056a0f90c668a5a1c4fe2b43af0359fe9c40b4dc7b50568711d7
23
24 diff --git a/sys-apps/baselayout/baselayout-2.3.ebuild b/sys-apps/baselayout/baselayout-2.3.ebuild
25 new file mode 100644
26 index 00000000..5c4e7c1
27 --- /dev/null
28 +++ b/sys-apps/baselayout/baselayout-2.3.ebuild
29 @@ -0,0 +1,244 @@
30 +# Copyright 1999-2016 Gentoo Foundation
31 +# Distributed under the terms of the GNU General Public License v2
32 +# $Id$
33 +
34 +EAPI=5
35 +
36 +inherit eutils multilib
37 +
38 +DESCRIPTION="Filesystem baselayout and init scripts"
39 +HOMEPAGE="https://www.gentoo.org/"
40 +SRC_URI="https://dev.gentoo.org/~williamh/dist/${P}.tar.bz2"
41 +
42 +LICENSE="GPL-2"
43 +SLOT="0"
44 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
45 +IUSE="build kernel_linux"
46 +
47 +pkg_setup() {
48 + multilib_layout
49 +}
50 +
51 +# Create our multilib dirs - the Makefile has no knowledge of this
52 +multilib_layout() {
53 + local libdir libdirs=$(get_all_libdirs) def_libdir=$(get_abi_LIBDIR $DEFAULT_ABI)
54 + : ${libdirs:=lib} # it isn't that we don't trust multilib.eclass...
55 +
56 + [ -z "${def_libdir}" ] && die "your DEFAULT_ABI=$DEFAULT_ABI appears to be invalid"
57 +
58 + # figure out which paths should be symlinks and which should be directories
59 + local dirs syms exp d
60 + for libdir in ${libdirs} ; do
61 + exp=( {,usr/,usr/local/}${libdir} )
62 + for d in "${exp[@]}" ; do
63 + # most things should be dirs
64 + if [ "${SYMLINK_LIB}" = "yes" ] && [ "${libdir}" = "lib" ] ; then
65 + [ ! -h "${d}" ] && [ -e "${d}" ] && dirs+=" ${d}"
66 + else
67 + [ -h "${d}" ] && syms+=" ${d}"
68 + fi
69 + done
70 + done
71 + if [ -n "${syms}${dirs}" ] ; then
72 + ewarn "Your system profile has SYMLINK_LIB=${SYMLINK_LIB:-no}, so that means you need to"
73 + ewarn "have these paths configured as follows:"
74 + [ -n "${dirs}" ] && ewarn "symlinks to '${def_libdir}':${dirs}"
75 + [ -n "${syms}" ] && ewarn "directories:${syms}"
76 + ewarn "The ebuild will attempt to fix these, but only for trivial conversions."
77 + ewarn "If things fail, you will need to manually create/move the directories."
78 + echo
79 + fi
80 +
81 + # setup symlinks and dirs where we expect them to be; do not migrate
82 + # data ... just fall over in that case.
83 + local prefix
84 + for prefix in "${EROOT}"{,usr/,usr/local/} ; do
85 + if [ "${SYMLINK_LIB}" = yes ] ; then
86 + # we need to make sure "lib" points to the native libdir
87 + if [ -h "${prefix}lib" ] ; then
88 + # it's already a symlink! assume it's pointing to right place ...
89 + continue
90 + elif [ -d "${prefix}lib" ] ; then
91 + # "lib" is a dir, so need to convert to a symlink
92 + ewarn "Converting ${prefix}lib from a dir to a symlink"
93 + rm -f "${prefix}lib"/.keep
94 + if rmdir "${prefix}lib" 2>/dev/null ; then
95 + ln -s ${def_libdir} "${prefix}lib" || die
96 + else
97 + die "non-empty dir found where we needed a symlink: ${prefix}lib"
98 + fi
99 + else
100 + # nothing exists, so just set it up sanely
101 + ewarn "Initializing ${prefix}lib as a symlink"
102 + mkdir -p "${prefix}" || die
103 + rm -f "${prefix}lib" || die
104 + ln -s ${def_libdir} "${prefix}lib" || die
105 + mkdir -p "${prefix}${def_libdir}" #423571
106 + fi
107 + else
108 + # we need to make sure "lib" is a dir
109 + if [ -h "${prefix}lib" ] ; then
110 + # "lib" is a symlink, so need to convert to a dir
111 + ewarn "Converting ${prefix}lib from a symlink to a dir"
112 + rm -f "${prefix}lib" || die
113 + if [ -d "${prefix}lib32" ] ; then
114 + ewarn "Migrating ${prefix}lib32 to ${prefix}lib"
115 + mv "${prefix}lib32" "${prefix}lib" || die
116 + else
117 + mkdir -p "${prefix}lib" || die
118 + fi
119 + elif [ -d "${prefix}lib" ] ; then
120 + # make sure the old "lib" ABI location does not exist; we
121 + # only symlinked the lib dir on systems where we moved it
122 + # to "lib32" ...
123 + case ${CHOST} in
124 + *-gentoo-freebsd*) ;; # We want it the other way on fbsd.
125 + i?86*|x86_64*|powerpc*|sparc*|s390*)
126 + if [ -d "${prefix}lib32" ] ; then
127 + rm -f "${prefix}lib32"/.keep
128 + if ! rmdir "${prefix}lib32" 2>/dev/null ; then
129 + ewarn "You need to merge ${prefix}lib32 into ${prefix}lib"
130 + die "non-empty dir found where there should be none: ${prefix}lib32"
131 + fi
132 + fi
133 + ;;
134 + esac
135 + else
136 + # nothing exists, so just set it up sanely
137 + ewarn "Initializing ${prefix}lib as a dir"
138 + mkdir -p "${prefix}" || die
139 + rm -f "${prefix}lib" || die
140 + ln -s ${def_libdir} "${prefix}lib" || die
141 + fi
142 + fi
143 + done
144 +}
145 +
146 +pkg_preinst() {
147 + # Bug #217848 - Since the remap_dns_vars() called by pkg_preinst() of
148 + # the baselayout-1.x ebuild copies all the real configs from the user's
149 + # /etc/conf.d into ${D}, it makes them all appear to be the default
150 + # versions. In order to protect them from being unmerged after this
151 + # upgrade, modify their timestamps.
152 + touch "${EROOT}"/etc/conf.d/* 2>/dev/null
153 +
154 + # This is written in src_install (so it's in CONTENTS), but punt all
155 + # pending updates to avoid user having to do etc-update (and make the
156 + # pkg_postinst logic simpler).
157 + rm -f "${EROOT}"/etc/._cfg????_gentoo-release
158 +
159 + # We need to install directories and maybe some dev nodes when building
160 + # stages, but they cannot be in CONTENTS.
161 + # Also, we cannot reference $S as binpkg will break so we do this.
162 + multilib_layout
163 + if use build ; then
164 + emake -C "${ED}/usr/share/${PN}" DESTDIR="${EROOT}" layout || die
165 + fi
166 + rm -f "${ED}"/usr/share/${PN}/Makefile
167 +}
168 +
169 +src_prepare() {
170 + if use prefix; then
171 + sed -i -r\
172 + -e "/PATH=/!s:/(etc|usr/bin|bin):\"${EPREFIX}\"/\1:g" \
173 + -e "/PATH=/s|([:\"])/|\1${EPREFIX}/|g" \
174 + -e "/PATH=.*\/sbin/s|\"$|:/usr/sbin:/sbin\"|" \
175 + -e "/PATH=.*\/bin/s|\"$|:/usr/bin:/bin\"|" \
176 + etc/profile || die
177 + sed -i -r \
178 + -e "s:/(etc/env.d|opt|usr):${EPREFIX}/\1:g" \
179 + -e "/^PATH=/s|\"$|:${EPREFIX}/usr/sbin:${EPREFIX}/sbin\"|" \
180 + etc/env.d/00basic || die
181 + sed -i "s:/bin:${EPREFIX}/bin:" etc/shells || die
182 + sed -i -r \
183 + -e "s,:/(root|bin|sbin|var|),:${EPREFIX}/\1,g" \
184 + share.Linux/passwd || die
185 + fi
186 +
187 + # handle multilib paths. do it here because we want this behavior
188 + # regardless of the C library that you're using. we do explicitly
189 + # list paths which the native ldconfig searches, but this isn't
190 + # problematic as it doesn't change the resulting ld.so.cache or
191 + # take longer to generate. similarly, listing both the native
192 + # path and the symlinked path doesn't change the resulting cache.
193 + local libdir ldpaths
194 + for libdir in $(get_all_libdirs) ; do
195 + ldpaths+=":${EPREFIX}/${libdir}:${EPREFIX}/usr/${libdir}"
196 + ldpaths+=":${EPREFIX}/usr/local/${libdir}"
197 + done
198 + echo "LDPATH='${ldpaths#:}'" >> etc/env.d/00basic
199 +
200 + # rc-scripts version for testing of features that *should* be present
201 + echo "Gentoo Base System release ${PV}" > etc/gentoo-release
202 +}
203 +
204 +src_install() {
205 + emake \
206 + OS=$(usex kernel_FreeBSD BSD Linux) \
207 + DESTDIR="${ED}" \
208 + install
209 + dodoc ChangeLog
210 +
211 + # need the makefile in pkg_preinst
212 + insinto /usr/share/${PN}
213 + doins Makefile
214 +}
215 +
216 +pkg_postinst() {
217 + local x
218 +
219 + # We installed some files to /usr/share/baselayout instead of /etc to stop
220 + # (1) overwriting the user's settings
221 + # (2) screwing things up when attempting to merge files
222 + # (3) accidentally packaging up personal files with quickpkg
223 + # If they don't exist then we install them
224 + for x in master.passwd passwd shadow group fstab ; do
225 + [ -e "${EROOT}etc/${x}" ] && continue
226 + [ -e "${EROOT}usr/share/baselayout/${x}" ] || continue
227 + cp -p "${EROOT}usr/share/baselayout/${x}" "${EROOT}"etc
228 + done
229 +
230 + # Force shadow permissions to not be world-readable #260993
231 + for x in shadow ; do
232 + [ -e "${EROOT}etc/${x}" ] && chmod o-rwx "${EROOT}etc/${x}"
233 + done
234 +
235 + # Take care of the etc-update for the user
236 + if [ -e "${EROOT}"etc/._cfg0000_gentoo-release ] ; then
237 + mv "${EROOT}"etc/._cfg0000_gentoo-release "${EROOT}"etc/gentoo-release
238 + fi
239 +
240 + # whine about users that lack passwords #193541
241 + if [[ -e "${EROOT}"etc/shadow ]] ; then
242 + local bad_users=$(sed -n '/^[^:]*::/s|^\([^:]*\)::.*|\1|p' "${EROOT}"/etc/shadow)
243 + if [[ -n ${bad_users} ]] ; then
244 + echo
245 + ewarn "The following users lack passwords!"
246 + ewarn ${bad_users}
247 + fi
248 + fi
249 +
250 + # baselayout leaves behind a lot of .keep files, so let's clean them up
251 + find "${EROOT}"lib*/rcscripts/ -name .keep -exec rm -f {} + 2>/dev/null
252 + find "${EROOT}"lib*/rcscripts/ -depth -type d -exec rmdir {} + 2>/dev/null
253 +
254 + # whine about users with invalid shells #215698
255 + if [[ -e "${EROOT}"etc/passwd ]] ; then
256 + local bad_shells=$(awk -F: 'system("test -e " $7) { print $1 " - " $7}' "${EROOT}"etc/passwd | sort)
257 + if [[ -n ${bad_shells} ]] ; then
258 + echo
259 + ewarn "The following users have non-existent shells!"
260 + ewarn "${bad_shells}"
261 + fi
262 + fi
263 +
264 + # https://bugs.gentoo.org/361349
265 + if use kernel_linux; then
266 + mkdir -p "${EROOT}"run
267 +
268 + if ! grep -qs "^tmpfs.*/run " "${ROOT}"proc/mounts ; then
269 + echo
270 + ewarn "You should reboot the system now to get /run mounted with tmpfs!"
271 + fi
272 + fi
273 +}