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
Improve, simplify shell script #2592
base: master
Are you sure you want to change the base?
Conversation
- Fix unbound shell variable warning from 'set -u' about GITHUB_SHA being unbound. Seen when running build locally. - Remove obsolete SVN support - This section had a bug in it anyway -- $REVISION could never be empty since it starts out with REVISION="_r$(...)" - it would always start with '_r' regardless of what the subshell echoed, so yeah, never empty. - svn.aircrack-ng.org's DNS record is also no longer up - Fix various quoting issues reported by shellcheck. - Avoid pedantic variable checking by just using defaults (${VAR:-'default value'}) - Change else-if chain to 'case'
Oh, and if you prefer I fix the SVN support rather than remove it, I can do that too. |
|
||
if [ x$DIR = "x" ] | ||
then |
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.
why we could remove this?
|
||
VERSION=$(cat ${DIR}/AC_VERSION 2>/dev/null) | ||
VERSION=$(cat "$DIR/AC_VERSION" 2>/dev/null) |
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.
why removed {}?
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.
I removed it because, despite what shellcheck may tell you, the {} is not necessary, it's just extra characters in the line.
I have a hypothesis that whoever wrote this originally thought that ${VAR}
was the same thing as "$VAR"
for the purposes of quoting. It's an easy mistake to make.
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.
echo $REVISION | ||
fi | ||
case $CMD in | ||
'scm') |
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.
awesome!
set -u
aboutGITHUB_SHA
being unbound. Seen when running build locally.$REVISION
could never be empty since it starts out withREVISION="_r$(...)"
- it would always start with_r
regardless of what the subshell echoed, so yeah, never empty.svn.aircrack-ng.org
's DNS record is also no longer up${VAR:-'default value'}
)case