All pastes #406987 Raw Edit

steev

public text v1 · immutable
·published 2007-03-22 20:55 UTC
rendered paste body
# Copyright 2006 Gentoo Foundation# Distributed under the terms of the GNU General Public License v2# $Header: $# solar[@]gentoo.oupdate_if_needed() {	local x files orphans needed	for x in scanelf q; do		if ! type -p ${x} 2>&1 > /dev/null; then			return 0		fi	done	pkg=$1	shift	# make sure we have app-portage/portage-utils-0.1.20 or later.	q file -Ch | grep -q -- --orphans	[[ $? != 0 ]] && return 0	files="$(q list -Co $pkg | scanelf -BF%F)"	needed=$(echo "${files}" | scanelf -Bqn -f - -F '%n#F' | tr , '\n' | sort -u | tr '\n' ' ')	[[ $needed == "" ]] && return 0	orphans=$(q file -Co ${needed} | tr '\n' ' ')	[[ $orphans == "" ]] && return 0	pn=$(q atom $pkg | awk '{print $1"/"$2}')	slots=$(q list -ICe $pn|wc -c)	echo '!!! '"ELF DT_NEEDED orphans: $pkg"	for x in ${orphans}; do		echo "!!! $x : "$(echo "${files}" | scanelf -Bq -f - -F '%F#N' -N ${x} | tr '\n' ' ')	done	if [[ $slots == 1 ]]; then	    emerge -1 '>'=$pkg "$@"	else		slot=$(q list -CSve $pkg | awk '{print $2}')		p=$(portageq match / ${pn}:${slot})		[[ "${p}" != "" ]] && pn="=${p}"		emerge -1 $pn "$@"	fi}for x in $(q list -ICv); do	update_if_needed $x "$@"done