cocoapods: don't run `pod install` if Podfile.lock hasn't changed

This required some refactoring of the `if` command to allow for "raw
conditionals" (i.e. conditionals that don't use [[ ]]), since we want to
check the return code of `cmp`.