/[gentoo-x86]/sys-apps/baselayout/baselayout-2.1-r1.ebuild
Gentoo

Contents of /sys-apps/baselayout/baselayout-2.1-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (show annotations) (download)
Mon Oct 14 19:16:47 2013 UTC (8 months, 3 weeks ago) by williamh
Branch: MAIN
CVS Tags: HEAD
Changes since 1.11: +1 -1 lines
FILE REMOVED
remove old version

(Portage version: 2.2.1/cvs/Linux i686, signed Manifest commit with key 0x30C46538)

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

  ViewVC Help
Powered by ViewVC 1.1.20