tools/centos-mirror-tools/dl_other_from_centos_repo.sh
Scott Little fa995d6981 Use kojipkgs.fedoraproject.org as a backup rpm source.
EPEL7 rpms builds are visible at kojipkgs.fedoraproject.org
and often remain available there long after they age out
of the official repo.

Use kojipkgs.fedoraproject.org as a backup source for
packages when not found in the repo.  Log seperately
so that these dropouts can be identified and corrected
in the lst files.

Also improved the tests for already downloaded packages
in several places to accelerate the test cycle.

Change-Id: Iaaa9fe05ac605a3604acf0048c571c6e88303692
Story: 2003157
Task: 23292
Signed-off-by: Scott Little <scott.little@windriver.com>
2018-08-17 12:57:36 -04:00

58 lines
1.5 KiB
Bash
Executable File

#!/bin/bash -e
# download non-RPM files from http://vault.centos.org/7.4.1708/os/x86_64/
if [ $# -lt 2 ]; then
echo "$0 <other_download_list.ini> <save_path> [<force_update>]"
exit -1
fi
download_list=$1
if [ ! -e $download_list ];then
echo "$download_list does not exist, please have a check!!"
exit -1
fi
save_path=$2
url_prefix="http://vault.centos.org/7.4.1708/os/x86_64/"
echo "NOTE: please assure Internet access to $url_prefix !!"
force_update=$3
i=0
all=`cat $download_list`
for ff in $all; do
## skip commented_out item which starts with '#'
if [[ "$ff" =~ ^'#' ]]; then
echo "skip $ff"
continue
fi
_type=`echo $ff | cut -d":" -f1-1`
_name=`echo $ff | cut -d":" -f2-2`
if [ "$_type" == "folder" ];then
mkdir -p $save_path/$_name
else
if [ -e "$save_path/$_name" ]; then
echo "Already have $save_path/$_name"
continue
fi
echo "remote path: $url_prefix/$_name"
echo "local path: $save_path/$_name"
if wget $url_prefix/$_name; then
file_name=`basename $_name`
sub_path=`dirname $_name`
if [ -e "./$file_name" ]; then
let i+=1
echo "$file_name is downloaded successfully"
mv -f ./$file_name $save_path/$_name
ls -l $save_path/$_name
fi
else
echo "ERROR: failed to download $url_prefix/$_name"
fi
fi
done
echo "totally $i files are downloaded!"