I have an rpm and I want to stop if the hostname doesn't contain a specific string.

I put this one in the spec file in the pre phase but it just gives me back the error but it still installs it.

%pre -p /bin/sh

hostname|egrep -i "matchinstring"
computenode=$(echo $?)

if [ $computenode -ne "0" ]; then
    echo 'This machine is not a compute node, we do not have standalone package for this!'
    exit 0

I want this one somehow. Where I have to put this to stop it?

0 Answers