RPM-Build - 如何在客户端 rpm 安装时打印错误消息 [英] RPM-Build -How to print error message at rpm install at client
问题描述
我的要求是,如果 rpm 安装在客户端机器上以任何方式失败,我想在屏幕上打印一些消息.或者在屏幕上显示消息,例如由于任何生成的原因导致 rpm 安装失败.就像其他标准 rpm 给出的一样.
my requirement is that i want to print some message on screen if rpm install fails in any case at client machine.or display message on screen like rpm install fail due to any of the generated reasons.like other standard rpm gives.
而且我没有在我的 .spec 文件中制作任何 c 文件或 make 命令.我在规范文件本身中所做的一切.plz 建议如何使用规范文件在客户端控制台中打印此类内容.
and i am not making any c file or make command in my .spec file . Everything i was doing in spec file itself.plz suggest how to print such type of things in client console using spec file.
是的,这不是我所关心的 --test 我只给出了示例.我的其他要求低于规范文件内容.
#Pre-Uninstall section
%preun
Processes=`ps -Ao"%p:%a" --cols 150 |
egrep "Launcher|rmiregistry" | grep -v grep | cut -d ":" -f1`
if [ -n "$Processes" ]; then
echo 'xyz is running ,first stop it then uninstall.' > /dev/stderr;
exit 1;
else
echo 'xyz service is not running' >/dev/stdout;
fi
然后我尝试使用命令卸载 rpm
then i try to uninstall the rpm using command
rpm -ev xyz
输出:两条消息都是根据服务状态打印的.我希望如果客户端使用选项 -v 卸载,然后它会在屏幕上显示消息,否则不会.我该怎么做?
output : both message are printed according to service status.i want if client uninstall with option -v then and then it display message on screen otherwise not. how can i do this?
推荐答案
打印到 STDERR
将始终显示给客户端.STDOUT
如果它们使用详细选项安装,则会显示.
Printing to STDERR
will always be shown to the client. STDOUT
is shown if they install with verbose options.
echo 'Something may be wrong!' > /dev/stderr
这篇关于RPM-Build - 如何在客户端 rpm 安装时打印错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!