]>
Commit | Line | Data |
---|---|---|
e472c1b1 MM |
1 | #!/bin/sh |
2 | ||
3 | . ~/pld-ftp-admin/scripts/functions | |
4 | ||
68655ed6 MM |
5 | case "$1" in |
6 | -o | --older ) | |
7 | shift | |
8 | REMOVEOLDER=yes | |
9 | ;; | |
10 | esac | |
e472c1b1 MM |
11 | |
12 | if [ "$#" -lt "2" ]; then | |
13 | echo "Not enough parameters given" | |
68655ed6 MM |
14 | echo "remove.sh [option] tree package1 [package2...]" |
15 | echo " " | |
16 | echo "Valid options:" | |
110cd009 | 17 | echo " -o, --older - Also remove older packages" |
e472c1b1 MM |
18 | exit |
19 | fi | |
20 | ||
21 | if [ ! -d "$FTP_DIR/$1" ]; then | |
22 | echo "$FTP_DIR/$1 does not exit" | |
23 | exit | |
24 | fi | |
25 | ||
26 | # we set $tree and $files | |
27 | tree=$1 | |
28 | files="" | |
29 | ||
30 | waserror=0 | |
31 | shift 1 | |
32 | while test "$#" -gt "0" | |
33 | do | |
34 | file=`echo $1|sed -e 's,.src.rpm$,,'` | |
35 | if [ ! -f "$FTP_DIR/$tree/SRPMS/.metadata/$file.src.rpm.info" ]; then | |
36 | waserror=$(($waserror+1)) | |
37 | echo "$file was not found in source tree" | |
38 | fi | |
39 | files="$files $file" | |
40 | shift | |
41 | done | |
42 | ||
43 | if [ "$waserror" != "0" ]; then | |
44 | echo "$waserror error(s) encountered... aborting" | |
45 | exit | |
46 | fi | |
47 | ||
68655ed6 MM |
48 | if [ "$REMOVEOLDER" == "yes" ]; then |
49 | # Remove packages older than the ones we're removing | |
50 | olderpkgs=`find_older_pkgs "$tree" "$files"` | |
51 | remove_pkgs "$tree" "$olderpkgs" | |
52 | fi | |
e472c1b1 MM |
53 | |
54 | # Remove given packages | |
55 | remove_pkgs "$tree" "$files" | |
56 |