-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to POSIX sh for deployment scripts. #5
base: latest
Are you sure you want to change the base?
Conversation
This option is unsupported in POSIX sh.
POSIX sh does not maintain the EUID variable.
This is not as robust as BASH_SOURCE but should work for our needs.
The suffix option to mktemp is a GNU extension to the standard. The main advantage of the suffix is the syntax highlighting when reviewing the script. We could drop it altogether.
These are not available in POSIX sh.
|
||
# Create a tempfile so the user has the opportunity to review the omnitruck script. | ||
omnitruck_script="$(mktemp --suffix=.bash)" | ||
omnitruck_script="$(mktemp)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omnitruck_script="$(mktemp)" | |
omnitruck_script="$(mktemp XXXXXXXXXX.bash)" |
and you can probably remove the line below. If you have interest into keeping the bash file into the current directory:
omnitruck_script="$(mktemp -p . XXXXXXXXXX.bash)"
but I think that for cleanness we can keep it the temp directory.
@@ -43,11 +45,12 @@ freshen_chef_repo() { | |||
if [ ! -d chef_repo ]; then | |||
git clone "$CHEF_REPO" -b "$CHEF_BRANCH" --recurse-submodules --remote-submodules chef_repo | |||
else | |||
pushd chef_repo | |||
CURDIR="$(pwd)" | |||
cd chef_repo | |||
git fetch origin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, git -C chef_repo <rest-of-the-command>
should work here to save some code lines, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments, non of them important enough to block.
There's got to be something in here about chickens coming home to roost. I generally write things in POSIX sh in order to make sure they continue to function correctly, but doing so in a bash world is a challenge and when we were first preparing this repository I decided I could relax this constraint and use bash in order to make contributing more accessible (also there's nothing as robust as the
BASH_SOURCE
environment variable in POSIX sh).However, trying to use these scripts for the OSRF build farm's mac deployments reminded me that bash (and GNU userland utils) is still far from universal.