Add need_file function to download_mirror.sh
I added the need_file function and used it to verify the existence of files needed by download_mirror.sh (lists and bash scripts). Change-Id: Iea2ca7776ed1c30a2fec7e8e00bf7acb5ca46c90 Signed-off-by: Marcela Rosales <marcela.a.rosales.jimenez@intel.com>
This commit is contained in:
parent
9d67352043
commit
2c023c7772
@ -6,18 +6,25 @@ echo "so please make sure your network working properly!!"
|
|||||||
|
|
||||||
mkdir -p ./logs
|
mkdir -p ./logs
|
||||||
|
|
||||||
rpm_downloader="./dl_rpms.sh"
|
need_file(){
|
||||||
if [ ! -e $rpm_downloader ];then
|
for f in $*; do
|
||||||
echo "ERROR: $rpm_downloader does NOT exist!!"
|
if [ ! -e $f ]; then
|
||||||
exit -1
|
echo "ERROR: $f does not exist."
|
||||||
fi
|
exit -1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check extistence of prerequisites files
|
||||||
|
need_file dl_rpms.sh dl_other_from_centos_repo.sh tarball-dl.sh
|
||||||
|
need_file rpms_from_3rd_parties.lst
|
||||||
|
need_file rpms_from_centos_3rd_parties.lst
|
||||||
|
need_file rpms_from_centos_repo.lst
|
||||||
|
need_file other_downloads.lst
|
||||||
|
need_file tarball-dl.lst mvn-artifacts.lst
|
||||||
|
|
||||||
#download RPMs/SRPMs from 3rd_party websites (not CentOS repos) by "wget"
|
#download RPMs/SRPMs from 3rd_party websites (not CentOS repos) by "wget"
|
||||||
echo "step #1: start downloading RPMs/SRPMs from 3rd-party websites..."
|
echo "step #1: start downloading RPMs/SRPMs from 3rd-party websites..."
|
||||||
if [ ! -e ./rpms_from_3rd_parties.lst ];then
|
|
||||||
echo "ERROR: ./rpms_from_3rd_parties.lst does NOT exist!!"
|
|
||||||
exit -1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Restore StarlingX_3rd repos from backup
|
# Restore StarlingX_3rd repos from backup
|
||||||
REPO_SOURCE_DIR=/localdisk/yum.repos.d
|
REPO_SOURCE_DIR=/localdisk/yum.repos.d
|
||||||
@ -26,6 +33,7 @@ if [ -d $REPO_SOURCE_DIR ] && [ -d $REPO_DIR ]; then
|
|||||||
\cp -f $REPO_SOURCE_DIR/*.repo $REPO_DIR/
|
\cp -f $REPO_SOURCE_DIR/*.repo $REPO_DIR/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rpm_downloader="./dl_rpms.sh"
|
||||||
$rpm_downloader ./rpms_from_3rd_parties.lst L1 3rd | tee ./logs/log_download_rpms_from_3rd_party.txt
|
$rpm_downloader ./rpms_from_3rd_parties.lst L1 3rd | tee ./logs/log_download_rpms_from_3rd_party.txt
|
||||||
if [ $? != 0 ];then
|
if [ $? != 0 ];then
|
||||||
echo "ERROR: something wrong with downloading, please check the log!!"
|
echo "ERROR: something wrong with downloading, please check the log!!"
|
||||||
@ -39,12 +47,9 @@ $rpm_downloader ./rpms_from_centos_3rd_parties.lst L1 3rd-centos | tee ./logs/lo
|
|||||||
|
|
||||||
echo "step #2: start 1st round of downloading RPMs and SRPMs with L1 match criteria..."
|
echo "step #2: start 1st round of downloading RPMs and SRPMs with L1 match criteria..."
|
||||||
#download RPMs/SRPMs from CentOS repos by "yumdownloader"
|
#download RPMs/SRPMs from CentOS repos by "yumdownloader"
|
||||||
if [ ! -e ./rpms_from_centos_repo.lst ];then
|
|
||||||
echo "ERROR: ./rpms_from_centos_repo.lst does NOT exist!!"
|
|
||||||
exit -1
|
|
||||||
fi
|
|
||||||
|
|
||||||
$rpm_downloader ./rpms_from_centos_repo.lst L1 centos | tee ./logs/log_download_rpms_from_centos_L1.txt
|
$rpm_downloader ./rpms_from_centos_repo.lst L1 centos | tee ./logs/log_download_rpms_from_centos_L1.txt
|
||||||
|
|
||||||
if [ $? == 0 ]; then
|
if [ $? == 0 ]; then
|
||||||
echo "finish 1st round of RPM downloading successfully!"
|
echo "finish 1st round of RPM downloading successfully!"
|
||||||
if [ -e "./output/centos_rpms_missing_L1.txt" ]; then
|
if [ -e "./output/centos_rpms_missing_L1.txt" ]; then
|
||||||
@ -101,14 +106,10 @@ fi
|
|||||||
# change "./output" and sub-folders to 751 (cgcs) group
|
# change "./output" and sub-folders to 751 (cgcs) group
|
||||||
chown 751:751 -R ./output
|
chown 751:751 -R ./output
|
||||||
|
|
||||||
|
|
||||||
|
echo "step #3: start downloading other files ..."
|
||||||
|
|
||||||
other_downloader="./dl_other_from_centos_repo.sh"
|
other_downloader="./dl_other_from_centos_repo.sh"
|
||||||
|
|
||||||
if [ ! -e ./other_downloads.lst ];then
|
|
||||||
echo "ERROR: ./other_downloads.lst does not exist!"
|
|
||||||
exit -1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "step #3: start downloading other files ..."
|
|
||||||
$other_downloader ./other_downloads.lst ./output/stx-r1/CentOS/pike/Binary/ | tee ./logs/log_download_other_files_centos.txt
|
$other_downloader ./other_downloads.lst ./output/stx-r1/CentOS/pike/Binary/ | tee ./logs/log_download_other_files_centos.txt
|
||||||
if [ $? == 0 ];then
|
if [ $? == 0 ];then
|
||||||
echo "step #3: done successfully"
|
echo "step #3: done successfully"
|
||||||
|
Loading…
Reference in New Issue
Block a user