]> git.pld-linux.org Git - projects/pld-ftp-admin.git/blob - bin/remove.sh
- cosmetics
[projects/pld-ftp-admin.git] / bin / remove.sh
1 #!/bin/sh
2
3 . ~/pld-ftp-admin/scripts/functions
4
5 case "$1" in
6         -o | --older )
7         shift
8         REMOVEOLDER=yes
9         ;;
10 esac    
11
12 if [ "$#" -lt "2" ]; then
13         echo "Not enough parameters given"
14         echo "remove.sh [option] tree package1 [package2...]"
15         echo " "
16         echo "Valid options:"
17         echo "    -o, --older         - Also remove older packages"
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 $pkglist
27 tree=$1
28 pkglist=""
29
30 waserror=0
31 shift 1
32 while test "$#" -gt "0"
33 do
34         pkg=`echo $1|sed -e 's,.src.rpm$,,'`
35         if [ ! -f "$FTP_DIR/$tree/SRPMS/.metadata/$pkg.src.rpm.info" ]; then
36                 waserror=$(($waserror+1))
37                 echo "$pkg was not found in source tree"
38         fi
39         pkglist="$pkglist $pkg"
40         shift
41 done
42
43 if [ "$waserror" != "0" ]; then
44         echo "$waserror error(s) encountered... aborting"
45         exit
46 fi
47
48 if [ "$REMOVEOLDER" == "yes" ]; then
49         # Remove packages older than the ones we're removing
50         olderpkgs=`find_older_pkgs "$tree" "$pkglist"`
51         remove_pkgs "$tree" "$olderpkgs"
52 fi
53
54 # Remove given packages
55 remove_pkgs "$tree" "$pkglist"
56
This page took 0.032391 seconds and 3 git commands to generate.