I was trying to exercise with Bazel by packaging a deb package from a collection of scripts I'm writing to automate a few tasks at work. Right now, I keep them either in /usr/local/bin or \~/.local/bin, so that I have them in my PATH, but with packaging I wanted to also provide autocompletion and similar.
Exploring sh_binary, it seems that to call another script with bazel run //:<my-script> I need to use the rlocation function, along with the boilerplate at the start of the script (and for some reason, also explicitly give a name to the module, but that's another thing). I was wondering: when deploying, I know that the scripts will go to /usr/bin or /usr/libexec, so having the boilerplate at the start of the script is wasted CPU cycles, iiuc?
Is there a better way to write scripts so that if we are running them from Bazel, it uses rlocation, and if it is a "normal" POSIX environment, it leverages it? Thanks!