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

added support for BSD based systems (specifically, OS X with homebrew getopt #19

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion gpgit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,13 @@ unset FORCE NEW_SIGNINGKEY
declare -A GITHUB_ASSET
declare -a HASH COMPRESSION

# Parse input params an ovrwrite possible default or config loaded options
# BSD getopt works completely different from gnu-getopt, so check if have an
# alternative getopt install
if [ -x /usr/local/opt/gnu-getopt/bin/getopt ]; then
export PATH=/usr/local/opt/gnu-getopt/bin/:$PATH
fi

# Parse input params an overwrite possible default or config loaded options
GETOPT_ARGS=$(getopt -o "hm:C:k:u:s:S:o:O:pnfdi" \
-l "help,message:,directory:,signingkey:,local-user:,gpg-sign:,output:,pre-release,no-github,force,interactive,token:,compression:,hash:,keyserver:,githubrepo:,project:,debug,color:"\
-n "gpgit" -- "${@}") || die "${USAGE_SHORT}"
Expand Down Expand Up @@ -274,6 +280,12 @@ if [[ "$#" -lt 1 ]]; then
die "${USAGE_SHORT}"
fi
TAG="${1}"

# Sanity check. If we're using the BSD getopt this will be broken:
if [ 'hm:C:k:u:s:S:o:O:pnfdi' = "$TAG" ]; then
die "gpgit requires GNU getopt to function"
fi

shift
COMMIT="${1:-"HEAD"}"

Expand Down