3 . ~/pld-ftp-admin/scripts/functions
5 if [ "$#" -lt "3" ]; then
6 echo "Not enough parameters given"
7 echo "move.sh from-tree to-tree package1 [package2...]"
11 if [ ! -d "$FTP_DIR/$1" ]; then
12 echo "$FTP_DIR/$1 does not exit"
16 if [ ! -d "$FTP_DIR/$2" ]; then
17 echo "$FTP_DIR/$2 does not exit"
22 # we set $from, $to and $files
29 while test "$#" -gt "0"
31 file=`echo $1|sed -e 's,.src.rpm$,,'`
32 if [ ! -f "$FTP_DIR/$from/SRPMS/.metadata/$file.src.rpm.info" ]; then
33 waserror=$(($waserror+1))
34 echo "$file was not found in source tree"
36 if [ -f "$FTP_DIR/$to/SRPMS/.metadata/$file.src.rpm.info" ]; then
37 waserror=$(($waserror+1))
38 echo "$file is already present in destination tree"
44 if [ "$waserror" != "0" ]; then
45 echo "$waserror error(s) encountered... aborting"
50 cd "$FTP_DIR/$to/SRPMS/.metadata/"
51 for srcfile in $files; do
52 basename=`echo $srcfile|sed -e 's,-[^-]*-[^-]*$,,'`
53 for oldinfofile in $basename*; do
54 if [ "$oldinfofile" == "$basename*" ]; then
58 # Remove all files connected to the old src.rpm (+ the src.rpm itself)
59 for i in `cat $oldinfofile|grep '^file:'`; do
60 arch=`echo $i|cut -d: -f 2`
61 file=`echo $i|cut -d: -f 3`
62 rm "$FTP_DIR/$to/$arch/RPMS/$file"
64 # And finally remove the .info file
69 # Move the new packages
70 cd "$FTP_DIR/$from/SRPMS/.metadata/"
71 for srcfile in $files; do
73 for i in `cat "$srcfile.src.rpm.info"|grep '^file:'`; do
74 arch=`echo $i|cut -d: -f 2`
75 file=`echo $i|cut -d: -f 3`
76 mv "$FTP_DIR/$from/$arch/RPMS/$file" "$FTP_DIR/$to/$arch/RPMS/"
78 # And move the .info file
79 mv "$srcfile.src.rpm.info" "$FTP_DIR/$to/SRPMS/.metadata/"