tools/centos-mirror-tools/dl_other_from_centos_repo.sh
Dean Troyer 62bd0253f0 Add build tools
This includes Docker containers to perform the StarlingX build
and a set of scripts to maintain a local mirror of binary CentOS
and other packages required to populate the final ISO file.

Change-Id: I8140fd8fa2d00e7aa98c895a8e4962ab3748669d
2018-06-08 17:01:43 -05:00

53 lines
1.4 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
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!"