Lines 184-261
Link Here
|
184 |
unset INSTALLTOD |
184 |
unset INSTALLTOD |
185 |
fi |
185 |
fi |
186 |
|
186 |
|
187 |
# dumps perms to stdout. if error, no perms dumped. |
187 |
local file="${T}/find-portage-log" |
188 |
function stat_perms() { |
188 |
local count=$(find "${D}"/ -user portage | wc -l) |
189 |
local f |
189 |
if [[ ${count} -gt 0 ]] ; then |
190 |
# only define do_stat if it hasn't been already |
190 |
ewarn "${count} files were installed with user portage!" |
191 |
if ! type -p do_stat &> /dev/null; then |
191 |
find "${D}"/ -xtype l -user portage -print0 > "${file}" |
192 |
if ! type -p stat &>/dev/null; then |
192 |
[[ -s ${file} ]] && cat "${file}" | xargs -0 chown -h ${PORTAGE_INST_UID:-0} |
193 |
do_stat() { |
193 |
find "${D}"/ -user portage -print0 > "${file}" |
194 |
# Generic version -- Octal result |
194 |
[[ -s ${file} ]] && cat "${file}" | xargs -0 chown ${PORTAGE_INST_UID:-0} |
195 |
python -c "import os,stat; print '%o' % os.stat('$1')[stat.ST_MODE]" |
195 |
rm -f "${file}" |
196 |
} |
196 |
fi |
197 |
else |
|
|
198 |
if [ "${USERLAND}" == "BSD" ] || [ "${USERLAND}" == "Darwin" ]; then |
199 |
do_stat() { |
200 |
# BSD version -- Octal result |
201 |
$(type -p stat) -f '%p' "$1" |
202 |
} |
203 |
else |
204 |
do_stat() { |
205 |
# Linux version -- Hex result converted to Octal |
206 |
f=$($(type -p stat) -c '%f' "$1") || return $? |
207 |
printf '%o' "0x$f" |
208 |
} |
209 |
fi |
210 |
fi |
211 |
fi |
212 |
|
197 |
|
213 |
f=$(do_stat "$@") || return |
198 |
count=$(find "${D}"/ -group portage | wc -l) |
214 |
f="${f:2:4}" |
199 |
if [[ ${count} -gt 0 ]] ; then |
215 |
echo $f |
200 |
ewarn "${count} files were installed with group portage!" |
216 |
} |
|
|
217 |
|
201 |
|
218 |
local file s |
202 |
find "${D}"/ -xtype l -group portage -print0 > "${file}" |
219 |
local count=0 |
203 |
[[ -s ${file} ]] && cat "${file}" | xargs -0 chgrp -h ${PORTAGE_INST_GID:-0} |
220 |
find "${D}/" -user portage | while read file; do |
204 |
find "${D}"/ -group portage -print0 > "${file}" |
221 |
count=$(( $count + 1 )) |
205 |
[[ -s ${file} ]] && cat "${file}" | xargs -0 chgrp ${PORTAGE_INST_GID:-0} |
222 |
if [ -L "${file}" ]; then |
206 |
rm -f "${file}" |
223 |
lchown ${PORTAGE_INST_UID:-0} "${file}" |
|
|
224 |
else |
225 |
s=$(stat_perms "$file") |
226 |
if [ -z "${s}" ]; then |
227 |
ewarn "failed stat_perm'ing $file. User intervention during install isn't wise..." |
228 |
continue |
229 |
fi |
230 |
chown ${PORTAGE_INST_UID:-0} "$file" |
231 |
chmod "$s" "$file" |
232 |
fi |
233 |
done |
234 |
if (( $count > 0 )); then |
235 |
ewarn "$count files were installed with user portage!" |
236 |
fi |
207 |
fi |
237 |
|
208 |
|
238 |
count=0 |
|
|
239 |
find "${D}/" -group portage | while read file; do |
240 |
count=$(( $count + 1 )) |
241 |
if [ -L "${file}" ]; then |
242 |
lchgrp ${PORTAGE_INST_GID:-0} "${file}" |
243 |
else |
244 |
s=$(stat_perms "$file") |
245 |
if [ -z "${s}" ]; then |
246 |
echo "failed stat_perm'ing '$file' . User intervention during install isn't wise..." |
247 |
continue |
248 |
fi |
249 |
chgrp ${PORTAGE_INST_GID:-0} "$file" |
250 |
chmod "$s" "$file" |
251 |
fi |
252 |
done |
253 |
if (( $count > 0 )); then |
254 |
ewarn "$count files were installed with group portage!" |
255 |
fi |
256 |
|
257 |
unset -f stat_perms |
258 |
|
259 |
# Portage regenerates this on the installed system. |
209 |
# Portage regenerates this on the installed system. |
260 |
if [ -f "${D}/usr/share/info/dir.gz" ]; then |
210 |
if [ -f "${D}/usr/share/info/dir.gz" ]; then |
261 |
rm -f "${D}/usr/share/info/dir.gz" |
211 |
rm -f "${D}/usr/share/info/dir.gz" |