]> git.pld-linux.org Git - projects/pld-ftp-admin.git/blame - bin/remove.sh
- cosmetics :)
[projects/pld-ftp-admin.git] / bin / remove.sh
CommitLineData
e472c1b1
MM
1#!/bin/sh
2
3. ~/pld-ftp-admin/scripts/functions
4
68655ed6
MM
5case "$1" in
6 -o | --older )
7 shift
8 REMOVEOLDER=yes
9 ;;
10esac
e472c1b1
MM
11
12if [ "$#" -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
19fi
20
21if [ ! -d "$FTP_DIR/$1" ]; then
22 echo "$FTP_DIR/$1 does not exit"
23 exit
24fi
25
26# we set $tree and $files
27tree=$1
28files=""
29
30waserror=0
31shift 1
32while test "$#" -gt "0"
33do
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
41done
42
43if [ "$waserror" != "0" ]; then
44 echo "$waserror error(s) encountered... aborting"
45 exit
46fi
47
68655ed6
MM
48if [ "$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"
52fi
e472c1b1
MM
53
54# Remove given packages
55remove_pkgs "$tree" "$files"
56
This page took 0.031627 seconds and 4 git commands to generate.