Lines 1185-1262
Link Here
|
1185 |
unset INSTALLTOD |
1185 |
unset INSTALLTOD |
1186 |
fi |
1186 |
fi |
1187 |
|
1187 |
|
1188 |
# dumps perms to stdout. if error, no perms dumped. |
1188 |
local file="${T}/find-portage-log" |
1189 |
function stat_perms() { |
1189 |
local count=$(find "${D}"/ -user portage | wc -l) |
1190 |
local f |
1190 |
if [[ ${count} -gt 0 ]] ; then |
1191 |
# only define do_stat if it hasn't been already |
1191 |
ewarn "${count} files were installed with user portage!" |
1192 |
if ! type -p do_stat &> /dev/null; then |
|
|
1193 |
if ! type -p stat &>/dev/null; then |
1194 |
do_stat() { |
1195 |
# Generic version -- Octal result |
1196 |
python -c "import os,stat; print '%o' % os.stat('$1')[stat.ST_MODE]" |
1197 |
} |
1198 |
else |
1199 |
if [ "${USERLAND}" == "BSD" ] || [ "${USERLAND}" == "Darwin" ]; then |
1200 |
do_stat() { |
1201 |
# BSD version -- Octal result |
1202 |
$(type -p stat) -f '%p' "$1" |
1203 |
} |
1204 |
else |
1205 |
do_stat() { |
1206 |
# Linux version -- Hex result converted to Octal |
1207 |
f=$($(type -p stat) -c '%f' "$1") || return $? |
1208 |
printf '%o' "0x$f" |
1209 |
} |
1210 |
fi |
1211 |
fi |
1212 |
fi |
1213 |
|
1192 |
|
1214 |
f=$(do_stat "$@") || return |
1193 |
find "${D}"/ -xtype l -user portage -print0 > "${file}" |
1215 |
f="${f:2:4}" |
1194 |
[[ -s ${file} ]] && xargs -a "${file}" -0 chown -h ${PORTAGE_INST_UID} |
1216 |
echo $f |
1195 |
find "${D}"/ -user portage -print0 > "${file}" |
1217 |
} |
1196 |
[[ -s ${file} ]] && xargs -a "${file}" -0 chown ${PORTAGE_INST_UID} |
1218 |
|
1197 |
rm -f "${file}" |
1219 |
local file s |
|
|
1220 |
local count=0 |
1221 |
find "${D}/" -user portage | while read file; do |
1222 |
count=$(( $count + 1 )) |
1223 |
if [ -L "${file}" ]; then |
1224 |
lchown ${PORTAGE_INST_UID} "${file}" |
1225 |
else |
1226 |
s=$(stat_perms "$file") |
1227 |
if [ -z "${s}" ]; then |
1228 |
ewarn "failed stat_perm'ing $file. User intervention during install isn't wise..." |
1229 |
continue |
1230 |
fi |
1231 |
chown ${PORTAGE_INST_UID} "$file" |
1232 |
chmod "$s" "$file" |
1233 |
fi |
1234 |
done |
1235 |
if (( $count > 0 )); then |
1236 |
ewarn "$count files were installed with user portage!" |
1237 |
fi |
1198 |
fi |
1238 |
|
1199 |
|
1239 |
count=0 |
1200 |
count=$(find "${D}"/ -group portage | wc -l) |
1240 |
find "${D}/" -group portage | while read file; do |
1201 |
if [[ ${count} -gt 0 ]] ; then |
1241 |
count=$(( $count + 1 )) |
1202 |
ewarn "${count} files were installed with group portage!" |
1242 |
if [ -L "${file}" ]; then |
1203 |
|
1243 |
lchgrp ${PORTAGE_INST_GID} "${file}" |
1204 |
find "${D}"/ -xtype l -group portage -print0 > "${file}" |
1244 |
else |
1205 |
[[ -s ${file} ]] && xargs -a "${file}" -0 chgrp -h ${PORTAGE_INST_GID} |
1245 |
s=$(stat_perms "$file") |
1206 |
find "${D}"/ -group portage -print0 > "${file}" |
1246 |
if [ -z "${s}" ]; then |
1207 |
[[ -s ${file} ]] && xargs -a "${file}" -0 chgrp ${PORTAGE_INST_GID} |
1247 |
echo "failed stat_perm'ing '$file' . User intervention during install isn't wise..." |
1208 |
rm -f "${file}" |
1248 |
continue |
|
|
1249 |
fi |
1250 |
chgrp ${PORTAGE_INST_GID} "$file" |
1251 |
chmod "$s" "$file" |
1252 |
fi |
1253 |
done |
1254 |
if (( $count > 0 )); then |
1255 |
ewarn "$count files were installed with group portage!" |
1256 |
fi |
1209 |
fi |
1257 |
|
1210 |
|
1258 |
unset -f stat_perms |
|
|
1259 |
|
1260 |
# Portage regenerates this on the installed system. |
1211 |
# Portage regenerates this on the installed system. |
1261 |
if [ -f "${D}/usr/share/info/dir.gz" ]; then |
1212 |
if [ -f "${D}/usr/share/info/dir.gz" ]; then |
1262 |
rm -f "${D}/usr/share/info/dir.gz" |
1213 |
rm -f "${D}/usr/share/info/dir.gz" |