Commit b752a4f1 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm-simulate: rewrite check yum result with store_output

parent 569173ea
......@@ -31,9 +31,22 @@ __use_yum_assumeno()
a= yum --help 2>&1 | grep -q -- "--assumeno"
}
__check_yum_result()
{
grep "^No package" $1 && return 1
grep "^Complete!" $1 && return 0
grep "^Exiting on user Command" $1 && return 0
grep "^Exiting on user command" $1 && return 0
# return default result by default
return $2
}
_epm_do_simulate()
{
local CMD
local RES=0
local filenames="$*"
case $PMTYPE in
......@@ -42,20 +55,15 @@ _epm_do_simulate()
;;
yum-rpm)
if __use_yum_assumeno ; then
LC_ALL=C sudocmd yum --assumeno install $filenames
# FIXME: check only error output
LC_ALL=C sudocmd yum --assumeno install $filenames 2>&1 | grep "^No package" && return 1
LC_ALL=C sudocmd yum --assumeno install $filenames 2>&1 | grep "^Complete!" && return 0
LC_ALL=C sudocmd yum --assumeno install $filenames 2>&1 | grep "^Exiting on user Command" && return 0
LC_ALL=C sudocmd yum --assumeno install $filenames >/dev/null 2>&1 || return
LC_ALL=C store_output sudocmd yum --assumeno install $filenames
__check_yum_result $RC_STDOUT $?
else
LC_ALL=C echo n | sudocmd yum install $filenames
# FIXME: check only error output
LC_ALL=C echo n | sudocmd yum install $filenames 2>&1 | grep "^No package" && return 1
LC_ALL=C echo n | sudocmd yum install $filenames 2>&1 | grep "^Complete!" && return 0
LC_ALL=C echo n | sudocmd yum install $filenames >/dev/null 2>&1 || return
LC_ALL=C echo n | store_output sudocmd yum install $filenames
__check_yum_result $RC_STDOUT $?
fi
return 0 ;;
RES=$?
clean_store_output
return $RES ;;
urpm-rpm)
CMD="urpmi --test --auto"
;;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment