Magellan Linux

Annotation of /trunk/pkgtools/dupe-duplicates.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 610 - (hide annotations) (download) (as text)
Sun Nov 11 23:40:52 2007 UTC (16 years, 11 months ago) by niro
File MIME type: application/x-sh
File size: 845 byte(s)
-added some pkgtools

1 niro 610 #!/bin/bash
2    
3     die()
4     {
5     echo "Error: $@"
6     exit 1
7     }
8    
9     DISTRI="$1"
10     ARCH="$2"
11     PATHTO="$3"
12    
13    
14     [[ -z ${DISTRI} ]] && die "no distribution given."
15     [[ -z ${ARCH} ]] && die "no architecure given."
16     [[ -z ${PATHTO} ]] && PATHTO="/var/www/magellan/magellan-dev/${DISTRI}/packages/${ARCH}"
17    
18     [[ ! -d ${PATHTO} ]] && die "PATHTO does not exist. is your given \$ARCH and \$DISTRI right?"
19    
20     EXTENSION=mpk
21     [[ ${ARCH} = src ]] && EXTENSION=mpks
22    
23     for package in $(find "${PATHTO}" -maxdepth 1 -type f -name '*'.${EXTENSION} -printf "%f\n" | sort)
24     do
25     # echo $package
26     # get pname
27     pname="${package%-*-*-*}"
28     [[ ${ARCH} = src ]] && pname="${package%-*-*}"
29    
30     # compare with old pname
31     if [[ ${pname} = ${oldpname} ]]
32     then
33     echo "dupe: ${pname} -> ${oldpackage}"
34     echo "dupe: ${pname} -> ${package}"
35     fi
36    
37     # save old
38     oldpname="${pname}"
39     oldpackage="${package}"
40     done