control-repo/scripts/config_version.sh
Romain Tartière ffc1769d2e Improve portability
- Fix shebang: `bash` is not always in `/bin/`, and since the script
  does not have bashism, rely on `sh` which is always in `/bin/`;
- Use `/opt/puppetlabs/puppet/bin/ruby` if this file exist and is
  executable, otherwise use `ruby` from $PATH;
- Use `code_manager_config_version.rb` if `.r10k-deploy.json` is found,
  and `config_version.rb` in all other cases.
2018-05-11 22:25:27 +02:00

15 lines
286 B
Bash
Executable File

#!/bin/sh
ruby=ruby
script="$1/$2/scripts/config_version.rb"
if [ -x /opt/puppetlabs/puppet/bin/ruby ]; then
ruby=/opt/puppetlabs/puppet/bin/ruby
fi
if [ -e $1/$2/.r10k-deploy.json ]; then
script="$1/$2/scripts/code_manager_config_version.rb"
fi
"${ruby}" "${script}" "$1" "$2"