RPM-Build -How to print error message at rpm install at client

10,846

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
Share:
10,846
meet patel
Author by

meet patel

Andriod/Java Develoepr/linux rpm develoepr/chef-puppet developer/Automation linux system developer.

Updated on June 14, 2022

Comments

  • meet patel
    meet patel almost 2 years

    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.

    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.


    yes that is not my concern --test i have give just example.my excet requirement is below spec file content are.

    #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
    

    then i try to uninstall the rpm using command

    rpm -ev xyz
    

    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?