How to bypass IncrediBuild console if not installed?

208 views Asked by At

There are some bash scripts running on our build machines where IncrediBuild is installed. The idea of IncrediBuild is to utilize all cores available in the network to speed up the build process.

Example shell script:

...
ib_console cmake --build .

The shell script shall not be changed. I would like to run the script on machines without ib_console. Is there a possibility to somehow simulate it or forward the call to cmake ?

2

There are 2 answers

1
Werner On BEST ANSWER

@alex: the alias works from the shell but not in the shell script above since aliases are not expanded in non interactive shell scripts.

With Why doesn't my Bash script recognize aliases? I could fix it.

if ! [ -f 'whereis ib_console' ]; then
    ib_console()
    {
        echo "ib_console dummy: run '$@'..."
        $@
        echo "ib_console dummy: done"
    }
    export -f ib_console
fi

It is recommended to run 'exec bash' after updating .bashrc

0
ulmer-a On

Place this into your .bashrc file:

if [ ! -f ´whereis ib_console´ ] then
    alias ib_console='$@'
fi

Explanation:

  • -f checks, whether the ib_console binary exists
  • $@ take all arguments into one single string (they are then executed standalone)