]> Pileus Git - ~andy/sunrise/blob - scripts/portdupe
add missing die
[~andy/sunrise] / scripts / portdupe
1 #!/bin/bash
2 #
3 # Copyright 2006 David Shakaryan <omp@gentoo.org>
4 # Distributed under the terms of the GNU General Public License v2
5
6 PORTDIR="$(portageq envvar PORTDIR)"
7
8 # If an argument is present, use it as the overlay directory.
9 if [ $1 ]; then
10         cd ${1}
11 fi
12
13 # Checking, displaying, etc.
14 for PACKAGE in */*; do
15         if [[ -d ${PORTDIR}/${PACKAGE} ]] && [[ $(basename ${PACKAGE}) != "CVS" ]] && grep -q $(dirname ${PACKAGE}) ${PORTDIR}/profiles/categories; then
16                 # Reset versions from last package checked.
17                 PORTPACK_VERS=""
18                 OVERPACK_VERS=""
19                 # Find just package name excluding category.
20                 PACKAGE_BASE="`basename ${PACKAGE}`"
21                 # Find versions of package in portage.
22                 for PORTPACK in `ls ${PORTDIR}/${PACKAGE}/*.ebuild | sed -e 's/.ebuild//'`; do
23                         PORTPACK_VER="`basename ${PORTPACK} | sed s/${PACKAGE_BASE}-//`"
24                         PORTPACK_VERS="${PORTPACK_VERS} ${PORTPACK_VER}"
25                 done
26                 # Find versions of package in overlay.
27                 for OVERPACK in `ls ${PACKAGE}/*.ebuild | sed -e 's/.ebuild//'`; do
28                         OVERPACK_VER="`basename ${OVERPACK} | sed s/${PACKAGE_BASE}-//`"
29                         OVERPACK_VERS="${OVERPACK_VERS} ${OVERPACK_VER}"
30                 done
31                 # Output info with colors.
32                 echo -e "\e[1;33m${PACKAGE}\e[0m"
33                 echo -e "  \e[1;35mPortage:\e[0m${PORTPACK_VERS}"
34                 echo -e "  \e[1;35mOverlay:\e[0m${OVERPACK_VERS}"
35         fi
36 done