#!/bin/bash
echo "Please enter the name of the package you wish to move, capitalization matters"
read name1
name=${name1}
echo Looking for ${name}

##
whereat=`find  ~/Repo/veclinux-7.0/packages/ -name "$name-*t?z"`
echo "testing results"
if [ -n "${whereat}" ]; then
echo Found ${name} at ${whereat}
intesting=`echo ${whereat} | sed 's,packages,testing,g'`
# echo ${intesting}
path=`echo ${intesting} | sed 's,'"${name}"'.*,,g'`
cp ~/Upload/vectorcontrib/build-thrower/veclinux-7.0/x86/${name}-*t?z ${path}
echo "${name} moved to  ${path}"
whereat=""
else
echo "Previous version not found in packages, exiting"
fi

echo Looking for ${name} in 64bit repo

whereat=`find  ~/Repo/VL64-7.0/packages/ -name "$name-*t?z"`
echo "testing results"
if [ -n "${whereat}" ]; then
echo Found ${name} at ${whereat}
intesting=`echo ${whereat} | sed 's,packages,testing,g'`
#echo ${intesting}
path=`echo ${intesting} | sed 's,'"${name}"'.*,,g'`
cp ~/Upload/vectorcontrib/build-thrower/veclinux-7.0/x86_64/${name}-*t?z ${path}
echo "${name} moved to  ${path}"
exit
else
echo "Previous version not found in packages, exiting"
fi





whereat=`find  ~/Repo/veclinux-7.0/extra/ -name "$name-*t?z"`
echo "testing results"
if [ -n "${whereat}" ]; then
echo Found ${name} at ${whereat}
intesting=`echo ${whereat} | sed 's,extra,testing,g'`
# echo ${intesting}
path=`echo ${intesting} | sed 's,'"${name}"'.*,,g'`
cp ~/Upload/vectorcontrib/build-thrower/veclinux-7.0/x86/${name}-*t?z ${path}
echo "${name} moved to  ${path}"
else
echo "Previous version not found in extra or packaging.  Where would you like to move this."
echo "a ap d games kde kdei kde-old kdexap l mate n xap xfce" 
read location
cp ~/Upload/vectorcontrib/build-thrower/veclinux-7.0/x86/${name}-*t?z ~/Repo/veclinux-7.0/testing/$location/ 


fi

echo Looking for ${name} in 64bit repo

whereat=`find  ~/Repo/VL64-7.0/extra/ -name "$name-*t?z"`
echo "testing results"
if [ -n "${whereat}" ]; then
echo Found ${name} at ${whereat}
intesting=`echo ${whereat} | sed 's,extra,testing,g'`
#echo ${intesting}
path=`echo ${intesting} | sed 's,'"${name}"'.*,,g'`
cp ~/Upload/vectorcontrib/build-thrower/veclinux-7.0/x86_64/${name}-*t?z ${path}
echo "${name} moved to  ${path}"
else
echo "Previous version not found in extra or packaging.  Where would you like to move this."
echo "a ap d games kde kdei kde-old kdexap l mate n xap xfce"
echo "MOVING TO $location in 64bit repo"
cp ~/Upload/vectorcontrib/build-thrower/veclinux-7.0/x86_64/${name}-*t?z ~/Repo/VL64-7.0/testing/$location

fi


