Merge "read releasever from yum.conf iff -c yum.conf is set"
This commit is contained in:
commit
f5048fd3c7
@ -40,6 +40,7 @@ get_from() {
|
|||||||
# By default, we use "sudo" and we don't use a local yum.conf. These can
|
# By default, we use "sudo" and we don't use a local yum.conf. These can
|
||||||
# be overridden via flags.
|
# be overridden via flags.
|
||||||
SUDOCMD="sudo -E"
|
SUDOCMD="sudo -E"
|
||||||
|
RELEASEVER="--releasever=7"
|
||||||
YUMCONFOPT=""
|
YUMCONFOPT=""
|
||||||
|
|
||||||
CLEAN_LOGS_ONLY=0
|
CLEAN_LOGS_ONLY=0
|
||||||
@ -59,6 +60,7 @@ while getopts "c:nxh" o; do
|
|||||||
c)
|
c)
|
||||||
# Use an alternate yum.conf
|
# Use an alternate yum.conf
|
||||||
YUMCONFOPT="-c $OPTARG"
|
YUMCONFOPT="-c $OPTARG"
|
||||||
|
RELEASEVER="--$(grep releasever= ${OPTARG})"
|
||||||
;;
|
;;
|
||||||
h)
|
h)
|
||||||
# Help
|
# Help
|
||||||
@ -215,11 +217,11 @@ download () {
|
|||||||
echo " ------ using $SFILE to search $rpm_name ------"
|
echo " ------ using $SFILE to search $rpm_name ------"
|
||||||
# Yumdownloader with the appropriate flag for src, noarch or x86_64
|
# Yumdownloader with the appropriate flag for src, noarch or x86_64
|
||||||
if [ "$_type" == "src" ];then
|
if [ "$_type" == "src" ];then
|
||||||
download_cmd="${SUDOCMD} yumdownloader -q ${YUMCONFOPT} -C --source $SFILE"
|
download_cmd="${SUDOCMD} yumdownloader -q ${YUMCONFOPT} ${RELEASEVER} -C --source $SFILE"
|
||||||
download_url_cmd="${SUDOCMD} yumdownloader --urls -q ${YUMCONFOPT}-C --source $SFILE"
|
download_url_cmd="${SUDOCMD} yumdownloader --urls -q ${YUMCONFOPT} ${RELEASEVER} -C --source $SFILE"
|
||||||
else
|
else
|
||||||
download_cmd="${SUDOCMD} yumdownloader -q -C ${YUMCONFOPT} $SFILE --archlist=noarch,x86_64"
|
download_cmd="${SUDOCMD} yumdownloader -q -C ${YUMCONFOPT} ${RELEASEVER} $SFILE --arcgglist=noarch,x86_64"
|
||||||
download_url_cmd="${SUDOCMD} yumdownloader --urls -q -C ${YUMCONFOPT} $SFILE --archlist=noarch,x86_64"
|
download_url_cmd="${SUDOCMD} yumdownloader --urls -q -C ${YUMCONFOPT} ${RELEASEVER} $SFILE --archlist=noarch,x86_64"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -296,7 +298,7 @@ download () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Prime the cache
|
# Prime the cache
|
||||||
${SUDOCMD} yum ${YUMCONFOPT} makecache
|
${SUDOCMD} yum ${YUMCONFOPT} ${RELEASEVER} makecache
|
||||||
|
|
||||||
# Download files
|
# Download files
|
||||||
if [ -s "$rpms_list" ];then
|
if [ -s "$rpms_list" ];then
|
||||||
|
@ -39,6 +39,7 @@ truncate -s 0 $ERROR_LOG_FILE
|
|||||||
retcode=0
|
retcode=0
|
||||||
extra_opts=""
|
extra_opts=""
|
||||||
|
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "$0 [-c <yum.conf>]"
|
echo "$0 [-c <yum.conf>]"
|
||||||
echo ""
|
echo ""
|
||||||
@ -76,7 +77,7 @@ get_repoquery_info() {
|
|||||||
else
|
else
|
||||||
repoquery_opts=
|
repoquery_opts=
|
||||||
fi
|
fi
|
||||||
repoquery $extra_opts -C --qf '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}' \
|
repoquery $extra_opts ${RELEASEVER} -C --qf '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}' \
|
||||||
$repoquery_opts "$_package_name"
|
$repoquery_opts "$_package_name"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,6 +115,7 @@ while getopts "c:" opt; do
|
|||||||
case $opt in
|
case $opt in
|
||||||
c)
|
c)
|
||||||
extra_opts="-c ${OPTARG}"
|
extra_opts="-c ${OPTARG}"
|
||||||
|
RELEASEVER="--$(grep releasever= ${OPTARG})"
|
||||||
;;
|
;;
|
||||||
\?)
|
\?)
|
||||||
echo "Invalid option: -$OPTARG" >&2
|
echo "Invalid option: -$OPTARG" >&2
|
||||||
@ -124,7 +126,7 @@ while getopts "c:" opt; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
info "Getting yum cache"
|
info "Getting yum cache"
|
||||||
if ! yum $extra_opts makecache; then
|
if ! yum $extra_opts ${RELEASEVER} makecache; then
|
||||||
error "There was a problem getting yum cache"
|
error "There was a problem getting yum cache"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user