diff --git a/toCOPY/generate-cgcs-centos-repo.sh b/toCOPY/generate-cgcs-centos-repo.sh index bc5587cc..0bd9cf74 100755 --- a/toCOPY/generate-cgcs-centos-repo.sh +++ b/toCOPY/generate-cgcs-centos-repo.sh @@ -22,7 +22,10 @@ fi mirror_dir=$1 dest_dir=$MY_REPO/cgcs-centos-repo timestamp="$(date +%F_%H%M)" -mock_cfg_file=$dest_dir/mock.cfg.proto +mock_cfg_file=$MY_REPO/build-tools/repo_files/mock.cfg.proto +comps_xml_file=$MY_REPO/build-tools/repo_files/comps.xml +mock_cfg_dest_file=$MY_REPO/cgcs-centos-repo/mock.cfg.proto +comps_xml_dest_file=$MY_REPO/cgcs-centos-repo/Binary/comps.xml if [[ ( ! -d $mirror_dir/Binary ) || ( ! -d $mirror_dir/Source ) ]]; then echo "The mirror $mirror_dir doesn't has the Binary and Source" @@ -58,64 +61,27 @@ for t in "Binary" "Source" ; do done done -read -r -d '' MOCK_CFG <<-EOF -config_opts['root'] = 'BUILD_ENV/mock' -config_opts['target_arch'] = 'x86_64' -config_opts['legal_host_arches'] = ('x86_64',) -config_opts['chroot_setup_cmd'] = 'install @buildsys-build' -config_opts['dist'] = 'el7' # only useful for --resultdir variable subst -config_opts['releasever'] = '7' -config_opts['rpmbuild_networking'] = False -config_opts['yum.conf'] = """ -[main] -keepcache=1 -debuglevel=2 -reposdir=/dev/null -logfile=/var/log/yum.log -retries=20 -obsoletes=1 -gpgcheck=0 -assumeyes=1 -syslog_ident=mock -syslog_device= - -# repos -[local-std] -name=local-std -baseurl=LOCAL_BASE/MY_BUILD_DIR/std/rpmbuild/RPMS -enabled=1 -skip_if_unavailable=1 -metadata_expire=0 - -[local-rt] -name=local-rt -baseurl=LOCAL_BASE/MY_BUILD_DIR/rt/rpmbuild/RPMS -enabled=1 -skip_if_unavailable=1 -metadata_expire=0 - -[local-installer] -name=local-installer -baseurl=LOCAL_BASE/MY_BUILD_DIR/installer/rpmbuild/RPMS -enabled=1 -skip_if_unavailable=1 -metadata_expire=0 - -[TisCentos7Distro] -name=Tis-Centos-7-Distro -enabled=1 -baseurl=LOCAL_BASE/MY_REPO_DIR/cgcs-centos-repo/Binary -failovermethod=priority -exclude=kernel-devel libvirt-devel - - -""" -EOF - -if [ -f "$mock_cfg_file" ]; then - mv "$mock_cfg_file" "$mock_cfg_file-backup-$timestamp" +if [ ! -f "$mock_cfg_file" ]; then + echo "Cannot find mock.cfg.proto file!" + exit 1 fi -echo "Creating mock config file" -echo "$MOCK_CFG" >> "$mock_cfg_file" +if [ ! -f "$comps_xml_file" ]; then + echo "Cannot find comps.xml file!" + exit 1 +fi + +echo "Copying mock.cfg.proto and comps.xml files." + +if [ -f "$mock_cfg_dest_file" ]; then + cp "$mock_cfg_dest_file" "$mock_cfg_dest_file-backup-$timestamp" +fi +cp "$mock_cfg_file" "$mock_cfg_dest_file" + +if [ -f "$comps_xml_dest_file" ]; then + cp "$comps_xml_dest_file" "$comps_xml_dest_file-backup-$timestamp" +fi +cp "$comps_xml_file" "$comps_xml_dest_file" + +echo "Done"