Lines 7-13
inherit multilib prefix
Link Here
|
7 |
|
7 |
|
8 |
DESCRIPTION="Filesystem baselayout and init scripts" |
8 |
DESCRIPTION="Filesystem baselayout and init scripts" |
9 |
HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage" |
9 |
HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage" |
10 |
if [[ ${PV} = 9999 ]]; then |
10 |
if [[ ${PV} = 9999 ]] ; then |
11 |
EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/${PN}.git" |
11 |
EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/${PN}.git" |
12 |
inherit git-r3 |
12 |
inherit git-r3 |
13 |
else |
13 |
else |
Lines 30-46
multilib_layout() {
Link Here
|
30 |
def_libdir=$(get_abi_LIBDIR $DEFAULT_ABI) |
30 |
def_libdir=$(get_abi_LIBDIR $DEFAULT_ABI) |
31 |
libdirs=$(get_all_libdirs) |
31 |
libdirs=$(get_all_libdirs) |
32 |
|
32 |
|
33 |
if [[ -z "${SYMLINK_LIB}" || ${SYMLINK_LIB} = no ]] ; then |
33 |
if [[ -z ${SYMLINK_LIB} || ${SYMLINK_LIB} = no ]] ; then |
34 |
prefix_lst=( "${EROOT}"/{,usr/,usr/local/} ) |
34 |
prefix_lst=( "${EROOT}"/{,usr/,usr/local/} ) |
35 |
for prefix in "${prefix_lst[@]}"; do |
35 |
for prefix in "${prefix_lst[@]}" ; do |
36 |
for libdir in ${libdirs}; do |
36 |
for libdir in ${libdirs} ; do |
37 |
dir="${prefix}${libdir}" |
37 |
dir="${prefix}${libdir}" |
38 |
if [[ -e "${dir}" ]]; then |
38 |
if [[ -e ${dir} ]] ; then |
39 |
[[ ! -d "${dir}" ]] && |
39 |
[[ ! -d ${dir} ]] && |
40 |
die "${dir} exists but is not a directory" |
40 |
die "${dir} exists but is not a directory" |
41 |
continue |
41 |
continue |
42 |
fi |
42 |
fi |
43 |
if ! use split-usr && [[ ${prefix} = ${EROOT}/ ]]; then |
43 |
if ! use split-usr && [[ ${prefix} = ${EROOT}/ ]] ; then |
44 |
libdir="${libdir%%/*}" |
44 |
libdir="${libdir%%/*}" |
45 |
dir="${prefix}${libdir}" |
45 |
dir="${prefix}${libdir}" |
46 |
einfo "symlinking ${dir} to usr/${libdir}" |
46 |
einfo "symlinking ${dir} to usr/${libdir}" |
Lines 56-62
multilib_layout() {
Link Here
|
56 |
return 0 |
56 |
return 0 |
57 |
fi |
57 |
fi |
58 |
|
58 |
|
59 |
[ -z "${def_libdir}" ] && |
59 |
[[ -z ${def_libdir} ]] && |
60 |
die "your DEFAULT_ABI=$DEFAULT_ABI appears to be invalid" |
60 |
die "your DEFAULT_ABI=$DEFAULT_ABI appears to be invalid" |
61 |
|
61 |
|
62 |
# figure out which paths should be symlinks and which should be directories |
62 |
# figure out which paths should be symlinks and which should be directories |
Lines 69-86
multilib_layout() {
Link Here
|
69 |
fi |
69 |
fi |
70 |
for d in "${exp[@]}" ; do |
70 |
for d in "${exp[@]}" ; do |
71 |
# most things should be dirs |
71 |
# most things should be dirs |
72 |
if [ "${SYMLINK_LIB}" = "yes" ] && [ "${libdir}" = "lib" ] ; then |
72 |
if [[ ${SYMLINK_LIB} = yes && ${libdir} = lib ]] ; then |
73 |
[ ! -h "${d}" ] && [ -e "${d}" ] && dirs+=" ${d}" |
73 |
[[ ! -h ${d} && -e ${d} ]] && dirs+=" ${d}" |
74 |
else |
74 |
else |
75 |
[ -h "${d}" ] && syms+=" ${d}" |
75 |
[[ -h ${d} ]] && syms+=" ${d}" |
76 |
fi |
76 |
fi |
77 |
done |
77 |
done |
78 |
done |
78 |
done |
79 |
if [ -n "${syms}${dirs}" ] ; then |
79 |
if [[ -n ${syms}${dirs} ]] ; then |
80 |
ewarn "Your system profile has SYMLINK_LIB=${SYMLINK_LIB:-no}, so that means you need to" |
80 |
ewarn "Your system profile has SYMLINK_LIB=${SYMLINK_LIB:-no}, so that means you need to" |
81 |
ewarn "have these paths configured as follows:" |
81 |
ewarn "have these paths configured as follows:" |
82 |
[ -n "${dirs}" ] && ewarn "symlinks to '${def_libdir}':${dirs}" |
82 |
[[ -n ${dirs} ]] && ewarn "symlinks to '${def_libdir}':${dirs}" |
83 |
[ -n "${syms}" ] && ewarn "directories:${syms}" |
83 |
[[ -n ${syms} ]] && ewarn "directories:${syms}" |
84 |
ewarn "The ebuild will attempt to fix these, but only for trivial conversions." |
84 |
ewarn "The ebuild will attempt to fix these, but only for trivial conversions." |
85 |
ewarn "If things fail, you will need to manually create/move the directories." |
85 |
ewarn "If things fail, you will need to manually create/move the directories." |
86 |
echo |
86 |
echo |
Lines 93-105
multilib_layout() {
Link Here
|
93 |
else |
93 |
else |
94 |
prefix_lst=( "${EROOT}"/{usr/,usr/local/} ) |
94 |
prefix_lst=( "${EROOT}"/{usr/,usr/local/} ) |
95 |
fi |
95 |
fi |
96 |
for prefix in "${prefix_lst[@]}"; do |
96 |
for prefix in "${prefix_lst[@]}" ; do |
97 |
if [ "${SYMLINK_LIB}" = yes ] ; then |
97 |
if [[ ${SYMLINK_LIB} = yes ]] ; then |
98 |
# we need to make sure "lib" points to the native libdir |
98 |
# we need to make sure "lib" points to the native libdir |
99 |
if [ -h "${prefix}lib" ] ; then |
99 |
if [[ -h ${prefix}lib ]] ; then |
100 |
# it's already a symlink! assume it's pointing to right place ... |
100 |
# it's already a symlink! assume it's pointing to right place ... |
101 |
continue |
101 |
continue |
102 |
elif [ -d "${prefix}lib" ] ; then |
102 |
elif [[ -d ${prefix}lib ]] ; then |
103 |
# "lib" is a dir, so need to convert to a symlink |
103 |
# "lib" is a dir, so need to convert to a symlink |
104 |
ewarn "Converting ${prefix}lib from a dir to a symlink" |
104 |
ewarn "Converting ${prefix}lib from a dir to a symlink" |
105 |
rm -f "${prefix}lib"/.keep || die |
105 |
rm -f "${prefix}lib"/.keep || die |
Lines 118-134
multilib_layout() {
Link Here
|
118 |
fi |
118 |
fi |
119 |
else |
119 |
else |
120 |
# we need to make sure "lib" is a dir |
120 |
# we need to make sure "lib" is a dir |
121 |
if [ -h "${prefix}lib" ] ; then |
121 |
if [[ -h ${prefix}lib ]] ; then |
122 |
# "lib" is a symlink, so need to convert to a dir |
122 |
# "lib" is a symlink, so need to convert to a dir |
123 |
ewarn "Converting ${prefix}lib from a symlink to a dir" |
123 |
ewarn "Converting ${prefix}lib from a symlink to a dir" |
124 |
rm -f "${prefix}lib" || die |
124 |
rm -f "${prefix}lib" || die |
125 |
if [ -d "${prefix}lib32" ] ; then |
125 |
if [[ -d ${prefix}lib32 ]] ; then |
126 |
ewarn "Migrating ${prefix}lib32 to ${prefix}lib" |
126 |
ewarn "Migrating ${prefix}lib32 to ${prefix}lib" |
127 |
mv "${prefix}lib32" "${prefix}lib" || die |
127 |
mv "${prefix}lib32" "${prefix}lib" || die |
128 |
else |
128 |
else |
129 |
mkdir -p "${prefix}lib" || die |
129 |
mkdir -p "${prefix}lib" || die |
130 |
fi |
130 |
fi |
131 |
elif [ -d "${prefix}lib" ] && ! has lib32 ${libdirs} ; then |
131 |
elif [[ -d ${prefix}lib ]] && ! has lib32 ${libdirs} ; then |
132 |
# make sure the old "lib" ABI location does not exist; we |
132 |
# make sure the old "lib" ABI location does not exist; we |
133 |
# only symlinked the lib dir on systems where we moved it |
133 |
# only symlinked the lib dir on systems where we moved it |
134 |
# to "lib32" ... |
134 |
# to "lib32" ... |
Lines 152-159
multilib_layout() {
Link Here
|
152 |
fi |
152 |
fi |
153 |
done |
153 |
done |
154 |
if ! use split-usr ; then |
154 |
if ! use split-usr ; then |
155 |
for libdir in ${libdirs}; do |
155 |
for libdir in ${libdirs} ; do |
156 |
if [[ ! -e "${EROOT}${libdir}" ]]; then |
156 |
if [[ ! -e ${EROOT}${libdir} ]] ; then |
157 |
ln -s usr/"${libdir}" "${EROOT}${libdir}" || |
157 |
ln -s usr/"${libdir}" "${EROOT}${libdir}" || |
158 |
die "Unable to make ${EROOT}${libdir} symlink" |
158 |
die "Unable to make ${EROOT}${libdir} symlink" |
159 |
fi |
159 |
fi |
Lines 183-189
pkg_preinst() {
Link Here
|
183 |
|
183 |
|
184 |
src_prepare() { |
184 |
src_prepare() { |
185 |
default |
185 |
default |
186 |
if use prefix; then |
186 |
if use prefix ; then |
187 |
hprefixify -e "/EUID/s,0,${EUID}," -q '"' etc/profile |
187 |
hprefixify -e "/EUID/s,0,${EUID}," -q '"' etc/profile |
188 |
hprefixify etc/{env.d/50baselayout,shells} share.Linux/passwd |
188 |
hprefixify etc/{env.d/50baselayout,shells} share.Linux/passwd |
189 |
echo PATH=/usr/bin:/bin >> etc/env.d/99host |
189 |
echo PATH=/usr/bin:/bin >> etc/env.d/99host |
Lines 191-197
src_prepare() {
Link Here
|
191 |
fi |
191 |
fi |
192 |
|
192 |
|
193 |
# don't want symlinked directories in PATH on systems with usr-merge |
193 |
# don't want symlinked directories in PATH on systems with usr-merge |
194 |
if ! use split-usr; then |
194 |
if ! use split-usr ; then |
195 |
sed \ |
195 |
sed \ |
196 |
-e 's|/usr/local/sbin:||g' \ |
196 |
-e 's|/usr/local/sbin:||g' \ |
197 |
-e 's|:/usr/sbin:|:|g' \ |
197 |
-e 's|:/usr/sbin:|:|g' \ |
Lines 245-269
pkg_postinst() {
Link Here
|
245 |
# (3) accidentally packaging up personal files with quickpkg |
245 |
# (3) accidentally packaging up personal files with quickpkg |
246 |
# If they don't exist then we install them |
246 |
# If they don't exist then we install them |
247 |
for x in master.passwd passwd shadow group fstab ; do |
247 |
for x in master.passwd passwd shadow group fstab ; do |
248 |
[ -e "${EROOT}/etc/${x}" ] && continue |
248 |
[[ -e ${EROOT}/etc/${x} ]] && continue |
249 |
[ -e "${EROOT}/usr/share/baselayout/${x}" ] || continue |
249 |
[[ -e ${EROOT}/usr/share/baselayout/${x} ]] || continue |
250 |
cp -p "${EROOT}/usr/share/baselayout/${x}" "${EROOT}"/etc || die |
250 |
cp -p "${EROOT}/usr/share/baselayout/${x}" "${EROOT}"/etc || die |
251 |
done |
251 |
done |
252 |
|
252 |
|
253 |
# Force shadow permissions to not be world-readable #260993 |
253 |
# Force shadow permissions to not be world-readable #260993 |
254 |
for x in shadow ; do |
254 |
for x in shadow ; do |
255 |
if [ -e "${EROOT}/etc/${x}" ] ; then |
255 |
if [[ -e ${EROOT}/etc/${x} ]] ; then |
256 |
chmod o-rwx "${EROOT}/etc/${x}" || die |
256 |
chmod o-rwx "${EROOT}/etc/${x}" || die |
257 |
fi |
257 |
fi |
258 |
done |
258 |
done |
259 |
|
259 |
|
260 |
# Take care of the etc-update for the user |
260 |
# Take care of the etc-update for the user |
261 |
if [ -e "${EROOT}"/etc/._cfg0000_gentoo-release ] ; then |
261 |
if [[ -e ${EROOT}/etc/._cfg0000_gentoo-release ]] ; then |
262 |
mv "${EROOT}"/etc/._cfg0000_gentoo-release "${EROOT}"/etc/gentoo-release || die |
262 |
mv "${EROOT}"/etc/._cfg0000_gentoo-release "${EROOT}"/etc/gentoo-release || die |
263 |
fi |
263 |
fi |
264 |
|
264 |
|
265 |
# whine about users that lack passwords #193541 |
265 |
# whine about users that lack passwords #193541 |
266 |
if [[ -e "${EROOT}"/etc/shadow ]] ; then |
266 |
if [[ -e ${EROOT}/etc/shadow ]] ; then |
267 |
local bad_users=$(sed -n '/^[^:]*::/s|^\([^:]*\)::.*|\1|p' "${EROOT}"/etc/shadow) |
267 |
local bad_users=$(sed -n '/^[^:]*::/s|^\([^:]*\)::.*|\1|p' "${EROOT}"/etc/shadow) |
268 |
if [[ -n ${bad_users} ]] ; then |
268 |
if [[ -n ${bad_users} ]] ; then |
269 |
echo |
269 |
echo |
Lines 273-279
pkg_postinst() {
Link Here
|
273 |
fi |
273 |
fi |
274 |
|
274 |
|
275 |
# whine about users with invalid shells #215698 |
275 |
# whine about users with invalid shells #215698 |
276 |
if [[ -e "${EROOT}"/etc/passwd ]] ; then |
276 |
if [[ -e ${EROOT}/etc/passwd ]] ; then |
277 |
local bad_shells=$(awk -F: 'system("test -e ${ROOT}" $7) { print $1 " - " $7}' "${EROOT}"/etc/passwd | sort) |
277 |
local bad_shells=$(awk -F: 'system("test -e ${ROOT}" $7) { print $1 " - " $7}' "${EROOT}"/etc/passwd | sort) |
278 |
if [[ -n ${bad_shells} ]] ; then |
278 |
if [[ -n ${bad_shells} ]] ; then |
279 |
echo |
279 |
echo |
Lines 283-317
pkg_postinst() {
Link Here
|
283 |
fi |
283 |
fi |
284 |
|
284 |
|
285 |
# https://bugs.gentoo.org/361349 |
285 |
# https://bugs.gentoo.org/361349 |
286 |
if use kernel_linux; then |
286 |
if use kernel_linux ; then |
287 |
mkdir -p "${EROOT}"/run || die |
287 |
mkdir -p "${EROOT}"/run || die |
288 |
|
288 |
|
289 |
local found fstype mountpoint |
289 |
local found fstype mountpoint |
290 |
while read -r _ mountpoint fstype _; do |
290 |
while read -r _ mountpoint fstype _ ; do |
291 |
[[ ${mountpoint} = /run ]] && [[ ${fstype} = tmpfs ]] && found=1 |
291 |
[[ ${mountpoint} = /run ]] && [[ ${fstype} = tmpfs ]] && found=1 |
292 |
done < "${ROOT}"/proc/mounts |
292 |
done < "${ROOT}"/proc/mounts |
293 |
[[ -z ${found} ]] && |
293 |
[[ -z ${found} ]] && |
294 |
ewarn "You should reboot now to get /run mounted with tmpfs!" |
294 |
ewarn "You should reboot now to get /run mounted with tmpfs!" |
295 |
fi |
295 |
fi |
296 |
|
296 |
|
297 |
for x in ${REPLACING_VERSIONS}; do |
297 |
for x in ${REPLACING_VERSIONS} ; do |
298 |
if ver_test 2.4 -lt ${x}; then |
298 |
if ver_test 2.4 -lt ${x} ; then |
299 |
ewarn "After updating ${EROOT}/etc/profile, please run" |
299 |
ewarn "After updating ${EROOT}/etc/profile, please run" |
300 |
ewarn "env-update && . /etc/profile" |
300 |
ewarn "env-update && . /etc/profile" |
301 |
fi |
301 |
fi |
302 |
|
302 |
|
303 |
if ver_test 2.6 -lt ${x}; then |
303 |
if ver_test 2.6 -lt ${x} ; then |
304 |
ewarn "Please run env-update then log out and back in to" |
304 |
ewarn "Please run env-update then log out and back in to" |
305 |
ewarn "update your path." |
305 |
ewarn "update your path." |
306 |
fi |
306 |
fi |
307 |
# clean up after 2.5 typos |
307 |
# clean up after 2.5 typos |
308 |
# https://bugs.gentoo.org/show_bug.cgi?id=656380 |
308 |
# https://bugs.gentoo.org/show_bug.cgi?id=656380 |
309 |
if [[ ${x} == 2.5 ]]; then |
309 |
if [[ ${x} == 2.5 ]] ; then |
310 |
rm -fr "${EROOT}/{,usr" || die |
310 |
rm -fr "${EROOT}/{,usr" || die |
311 |
fi |
311 |
fi |
312 |
done |
312 |
done |
313 |
|
313 |
|
314 |
if [[ -e "${EROOT}"/etc/env.d/00basic ]]; then |
314 |
if [[ -e ${EROOT}/etc/env.d/00basic ]] ; then |
315 |
ewarn "${EROOT}/etc/env.d/00basic is now ${EROOT}/etc/env.d/50baselayout" |
315 |
ewarn "${EROOT}/etc/env.d/00basic is now ${EROOT}/etc/env.d/50baselayout" |
316 |
ewarn "Please migrate your changes." |
316 |
ewarn "Please migrate your changes." |
317 |
fi |
317 |
fi |
318 |
- |
|
|