Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

h3xx
Copy link

@h3xx h3xx commented Nov 27, 2023

  • 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

- 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'
@h3xx
Copy link
Author

h3xx commented Nov 27, 2023

Oh, and if you prefer I fix the SVN support rather than remove it, I can do that too.


if [ x$DIR = "x" ]
then
Copy link

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)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why removed {}?

Copy link
Author

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.

Copy link

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')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants