Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 532050 | Differences between
and this patch

Collapse All | Expand All

(-)baselayout-2.2.ebuild (-34 / +39 lines)
Lines 2-7 Link Here
2
# Distributed under the terms of the GNU General Public License v2
2
# Distributed under the terms of the GNU General Public License v2
3
# $Header: /var/cvsroot/gentoo-x86/sys-apps/baselayout/baselayout-2.2.ebuild,v 1.17 2014/01/18 09:05:09 vapier Exp $
3
# $Header: /var/cvsroot/gentoo-x86/sys-apps/baselayout/baselayout-2.2.ebuild,v 1.17 2014/01/18 09:05:09 vapier Exp $
4
4
5
EAPI=5
6
5
inherit eutils multilib
7
inherit eutils multilib
6
8
7
DESCRIPTION="Filesystem baselayout and init scripts"
9
DESCRIPTION="Filesystem baselayout and init scripts"
Lines 40-46 multilib_layout() { Link Here
40
	local dirs syms exp d
42
	local dirs syms exp d
41
	for libdir in ${libdirs} ; do
43
	for libdir in ${libdirs} ; do
42
		exp=( {,usr/,usr/local/}${libdir} )
44
		exp=( {,usr/,usr/local/}${libdir} )
43
		for d in "${exp[@]/#/${ROOT}}" ; do
45
		for d in "${exp[@]/#/${EROOT}}" ; do
44
			# most things should be dirs
46
			# most things should be dirs
45
			if [ "${SYMLINK_LIB}" = "yes" ] && [ "${libdir}" = "lib" ] ; then
47
			if [ "${SYMLINK_LIB}" = "yes" ] && [ "${libdir}" = "lib" ] ; then
46
				[ ! -h "${d}" ] && [ -e "${d}" ] && dirs+=" ${d}"
48
				[ ! -h "${d}" ] && [ -e "${d}" ] && dirs+=" ${d}"
Lines 62-68 multilib_layout() { Link Here
62
	# setup symlinks and dirs where we expect them to be; do not migrate
64
	# setup symlinks and dirs where we expect them to be; do not migrate
63
	# data ... just fall over in that case.
65
	# data ... just fall over in that case.
64
	local prefix
66
	local prefix
65
	for prefix in "${ROOT}"{,usr/,usr/local/} ; do
67
	for prefix in "${EROOT}"{,usr/,usr/local/} ; do
66
		if [ "${SYMLINK_LIB}" = yes ] ; then
68
		if [ "${SYMLINK_LIB}" = yes ] ; then
67
			# we need to make sure "lib" points to the native libdir
69
			# we need to make sure "lib" points to the native libdir
68
			if [ -h "${prefix}lib" ] ; then
70
			if [ -h "${prefix}lib" ] ; then
Lines 130-163 pkg_preinst() { Link Here
130
	# /etc/conf.d into ${D}, it makes them all appear to be the default
132
	# /etc/conf.d into ${D}, it makes them all appear to be the default
131
	# versions. In order to protect them from being unmerged after this
133
	# versions. In order to protect them from being unmerged after this
132
	# upgrade, modify their timestamps.
134
	# upgrade, modify their timestamps.
133
	touch "${ROOT}"/etc/conf.d/* 2>/dev/null
135
	touch "${EROOT}"/etc/conf.d/* 2>/dev/null
134
136
135
	# This is written in src_install (so it's in CONTENTS), but punt all
137
	# This is written in src_install (so it's in CONTENTS), but punt all
136
	# pending updates to avoid user having to do etc-update (and make the
138
	# pending updates to avoid user having to do etc-update (and make the
137
	# pkg_postinst logic simpler).
139
	# pkg_postinst logic simpler).
138
	rm -f "${ROOT}"/etc/._cfg????_gentoo-release
140
	rm -f "${EROOT}"/etc/._cfg????_gentoo-release
139
141
140
	# We need to install directories and maybe some dev nodes when building
142
	# We need to install directories and maybe some dev nodes when building
141
	# stages, but they cannot be in CONTENTS.
143
	# stages, but they cannot be in CONTENTS.
142
	# Also, we cannot reference $S as binpkg will break so we do this.
144
	# Also, we cannot reference $S as binpkg will break so we do this.
143
	multilib_layout
145
	multilib_layout
144
	if use build ; then
146
	if use build ; then
145
		emake -C "${D}/usr/share/${PN}" DESTDIR="${ROOT}" layout || die
147
		emake -C "${ED}/usr/share/${PN}" DESTDIR="${EROOT}" layout || die
146
	fi
148
	fi
147
	rm -f "${D}"/usr/share/${PN}/Makefile
149
	rm -f "${ED}"/usr/share/${PN}/Makefile
148
}
150
}
149
151
150
src_install() {
152
src_prepare() {
151
	emake \
152
		OS=$(usex kernel_FreeBSD BSD Linux) \
153
		DESTDIR="${D}" \
154
		install || die
155
	dodoc ChangeLog.svn
156
157
	# need the makefile in pkg_preinst
158
	insinto /usr/share/${PN}
159
	doins Makefile || die
160
161
	# handle multilib paths.  do it here because we want this behavior
153
	# handle multilib paths.  do it here because we want this behavior
162
	# regardless of the C library that you're using.  we do explicitly
154
	# regardless of the C library that you're using.  we do explicitly
163
	# list paths which the native ldconfig searches, but this isn't
155
	# list paths which the native ldconfig searches, but this isn't
Lines 166-177 src_install() { Link Here
166
	# path and the symlinked path doesn't change the resulting cache.
158
	# path and the symlinked path doesn't change the resulting cache.
167
	local libdir ldpaths
159
	local libdir ldpaths
168
	for libdir in $(get_all_libdirs) ; do
160
	for libdir in $(get_all_libdirs) ; do
169
		ldpaths+=":/${libdir}:/usr/${libdir}:/usr/local/${libdir}"
161
		ldpaths+=":${EPREFIX}/${libdir}:${EPREFIX}/usr/${libdir}"
162
		ldpaths+=":${EPREFIX}/usr/local/${libdir}"
170
	done
163
	done
171
	echo "LDPATH='${ldpaths#:}'" >> "${D}"/etc/env.d/00basic
164
	echo "LDPATH='${ldpaths#:}'" >> etc/env.d/00basic
172
165
173
	# rc-scripts version for testing of features that *should* be present
166
	# rc-scripts version for testing of features that *should* be present
174
	echo "Gentoo Base System release ${PV}" > "${D}"/etc/gentoo-release
167
	echo "Gentoo Base System release ${PV}" > etc/gentoo-release
168
}
169
170
src_install() {
171
	emake \
172
		OS=$(usex kernel_FreeBSD BSD Linux) \
173
		DESTDIR="${ED}" \
174
		install
175
	dodoc ChangeLog.svn
176
177
	# need the makefile in pkg_preinst
178
	insinto /usr/share/${PN}
179
	doins Makefile
175
}
180
}
176
181
177
pkg_postinst() {
182
pkg_postinst() {
Lines 183-206 pkg_postinst() { Link Here
183
	# (3) accidentally packaging up personal files with quickpkg
188
	# (3) accidentally packaging up personal files with quickpkg
184
	# If they don't exist then we install them
189
	# If they don't exist then we install them
185
	for x in master.passwd passwd shadow group fstab ; do
190
	for x in master.passwd passwd shadow group fstab ; do
186
		[ -e "${ROOT}etc/${x}" ] && continue
191
		[ -e "${EROOT}etc/${x}" ] && continue
187
		[ -e "${ROOT}usr/share/baselayout/${x}" ] || continue
192
		[ -e "${EROOT}usr/share/baselayout/${x}" ] || continue
188
		cp -p "${ROOT}usr/share/baselayout/${x}" "${ROOT}"etc
193
		cp -p "${EROOT}usr/share/baselayout/${x}" "${EROOT}"etc
189
	done
194
	done
190
195
191
	# Force shadow permissions to not be world-readable #260993
196
	# Force shadow permissions to not be world-readable #260993
192
	for x in shadow ; do
197
	for x in shadow ; do
193
		[ -e "${ROOT}etc/${x}" ] && chmod o-rwx "${ROOT}etc/${x}"
198
		[ -e "${EROOT}etc/${x}" ] && chmod o-rwx "${EROOT}etc/${x}"
194
	done
199
	done
195
200
196
	# Take care of the etc-update for the user
201
	# Take care of the etc-update for the user
197
	if [ -e "${ROOT}"/etc/._cfg0000_gentoo-release ] ; then
202
	if [ -e "${EROOT}"etc/._cfg0000_gentoo-release ] ; then
198
		mv "${ROOT}"/etc/._cfg0000_gentoo-release "${ROOT}"/etc/gentoo-release
203
		mv "${EROOT}"etc/._cfg0000_gentoo-release "${EROOT}"etc/gentoo-release
199
	fi
204
	fi
200
205
201
	# whine about users that lack passwords #193541
206
	# whine about users that lack passwords #193541
202
	if [[ -e ${ROOT}/etc/shadow ]] ; then
207
	if [[ -e "${EROOT}"etc/shadow ]] ; then
203
		local bad_users=$(sed -n '/^[^:]*::/s|^\([^:]*\)::.*|\1|p' "${ROOT}"/etc/shadow)
208
		local bad_users=$(sed -n '/^[^:]*::/s|^\([^:]*\)::.*|\1|p' "${EROOT}"/etc/shadow)
204
		if [[ -n ${bad_users} ]] ; then
209
		if [[ -n ${bad_users} ]] ; then
205
			echo
210
			echo
206
			ewarn "The following users lack passwords!"
211
			ewarn "The following users lack passwords!"
Lines 209-220 pkg_postinst() { Link Here
209
	fi
214
	fi
210
215
211
	# baselayout leaves behind a lot of .keep files, so let's clean them up
216
	# baselayout leaves behind a lot of .keep files, so let's clean them up
212
	find "${ROOT}"/lib*/rcscripts/ -name .keep -exec rm -f {} + 2>/dev/null
217
	find "${EROOT}"lib*/rcscripts/ -name .keep -exec rm -f {} + 2>/dev/null
213
	find "${ROOT}"/lib*/rcscripts/ -depth -type d -exec rmdir {} + 2>/dev/null
218
	find "${EROOT}"lib*/rcscripts/ -depth -type d -exec rmdir {} + 2>/dev/null
214
219
215
	# whine about users with invalid shells #215698
220
	# whine about users with invalid shells #215698
216
	if [[ -e ${ROOT}/etc/passwd ]] ; then
221
	if [[ -e "${EROOT}"etc/passwd ]] ; then
217
		local bad_shells=$(awk -F: 'system("test -e " $7) { print $1 " - " $7}' /etc/passwd | sort)
222
		local bad_shells=$(awk -F: 'system("test -e " $7) { print $1 " - " $7}' "${EROOT}"etc/passwd | sort)
218
		if [[ -n ${bad_shells} ]] ; then
223
		if [[ -n ${bad_shells} ]] ; then
219
			echo
224
			echo
220
			ewarn "The following users have non-existent shells!"
225
			ewarn "The following users have non-existent shells!"
Lines 224-232 pkg_postinst() { Link Here
224
229
225
	# http://bugs.gentoo.org/361349
230
	# http://bugs.gentoo.org/361349
226
	if use kernel_linux; then
231
	if use kernel_linux; then
227
		mkdir -p "${ROOT}"/run
232
		mkdir -p "${EROOT}"run
228
233
229
		if ! grep -qs "^tmpfs.*/run " "${ROOT}"/proc/mounts ; then
234
		if ! grep -qs "^tmpfs.*/run " "${ROOT}"proc/mounts ; then
230
			echo
235
			echo
231
			ewarn "You should reboot the system now to get /run mounted with tmpfs!"
236
			ewarn "You should reboot the system now to get /run mounted with tmpfs!"
232
		fi
237
		fi

Return to bug 532050