37 lines
1.1 KiB
Bash
37 lines
1.1 KiB
Bash
|
#!/bin/bash
|
||
|
# -*- mode: sh; fill-column: 75; tab-width: 8; coding: utf-8-unix -*-
|
||
|
|
||
|
[ -z "$prog" ] && prog=`basename $0 .bash`
|
||
|
[ -z "$USER" ] && USER=$( id -un )
|
||
|
[ -f /usr/local/bin/usr_local_tput.bash ] && \
|
||
|
. /usr/local/bin/usr_local_tput.bash
|
||
|
|
||
|
## box_gentoo_emerge
|
||
|
box_gentoo_emerge () {
|
||
|
[ "$#" -lt 1 ] && return 0
|
||
|
local elt
|
||
|
declare -a ARGS
|
||
|
for elt in "$@" ; do
|
||
|
[ -z "$elt" ] && continue
|
||
|
grep -q "^$elt$" /var/lib/portage/world && continue
|
||
|
ls /var/db/pkg/"$elt"-[0-9]* 2>/dev/null >/dev/null && continue
|
||
|
qlist -IsS "$elt" | grep -q "^$elt" && continue
|
||
|
equery l -f "^$elt$" | grep '^.I' && continue
|
||
|
ARGS+=($elt)
|
||
|
done
|
||
|
[ "${#ARGS[@]}" -eq 0 ] && exit 0
|
||
|
INFO "${ARGS[@]}"
|
||
|
/usr/local/sbin/box_gentoo_emerge.bash "${ARGS[@]}" || return $?
|
||
|
return 0
|
||
|
}
|
||
|
|
||
|
base=usr_local_base
|
||
|
# DBUG 0=$0
|
||
|
if [ -x /usr/bin/basename ] && [ $( /usr/bin/basename -- $0 ) = $base'.bash' -o $( basename -- $0 ) = $base'.sh' ] ; then
|
||
|
[ "$#" -eq 0 ] && exit 0
|
||
|
[ "$#" -eq 1 ] && [ "$1" = '-h' -o "$1" = '--help' ] && \
|
||
|
echo USAGE: $0 && grep '^[a-z].*()\|^## ' $0 | sed -e 's/().*//'|sort && exit 0
|
||
|
eval "$@"
|
||
|
exit $?
|
||
|
fi
|