Skip to content

Commit

Permalink
Rename command argument
Browse files Browse the repository at this point in the history
--at is a better name than --version, as --version conventionally means
"print program version and exit".
  • Loading branch information
skalee committed Nov 7, 2018
1 parent 51a89ee commit 4cfc566
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 47 deletions.
10 changes: 5 additions & 5 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Builds and installs a specific component of GPG.
Three options are mandatory:

* `--component`, which specifies a component name
* `--version`, which specifies component version (can be `latest`)
* `--at`, which specifies component version (can be `latest`)
* `--build-dir`, which specifies a directory that the source code should be
fetched into, and where compilation should happen.

Expand All @@ -39,20 +39,20 @@ of Pinentry:
----
./install_gpg_component.sh \
--component pinentry \
--version latest \
--at latest \
--build-dir ./build-gpg
----

Furthermore, script is capable of fetching source from Git repository (instead
of downloading tarballs with stable releases). In such case, a `--git` option
should be supplied, and `--version` should specify the desired Git ref. For
should be supplied, and `--at` should specify the desired Git ref. For
example, following will build the current master of Pinentry component:

[source,bash]
----
./install_gpg_component.sh \
--component pinentry \
--version master \
--at master \
--git \
--build-dir ~/build-gpg
----
Expand Down Expand Up @@ -102,7 +102,7 @@ example:
----
./install_gpg_component.sh \
--component pinentry \
--version latest \
--at latest \
--build-dir ~/build-gpg \
--configure-opts "--enable-pinentry-qt --enable-pinentry-curses"
----
Expand Down
14 changes: 7 additions & 7 deletions examples/components_individually.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ BUILD_DIR="${TRAVIS_BUILD_DIR}/b"
# libgpg-error, and enable it (default) for other components.
# In order to satisfy dependencies, components should be installed
# in a specific order.
./install_gpg_component.sh --component libgpg-error --version latest \
./install_gpg_component.sh --component libgpg-error --at latest \
--build-dir "${BUILD_DIR}" --sudo \
--configure-opts "--disable-doc"
./install_gpg_component.sh --component libgcrypt --version latest \
./install_gpg_component.sh --component libgcrypt --at latest \
--build-dir "${BUILD_DIR}" --sudo
./install_gpg_component.sh --component libassuan --version latest \
./install_gpg_component.sh --component libassuan --at latest \
--build-dir "${BUILD_DIR}" --sudo
./install_gpg_component.sh --component libksba --version latest \
./install_gpg_component.sh --component libksba --at latest \
--build-dir "${BUILD_DIR}" --sudo
./install_gpg_component.sh --component npth --version latest \
./install_gpg_component.sh --component npth --at latest \
--build-dir "${BUILD_DIR}" --sudo
./install_gpg_component.sh --component pinentry --version 1.1.0 \
./install_gpg_component.sh --component pinentry --at 1.1.0 \
--build-dir "${BUILD_DIR}" --sudo
./install_gpg_component.sh --component gnupg --version 2.2.10 \
./install_gpg_component.sh --component gnupg --at 2.2.10 \
--build-dir "${BUILD_DIR}" --sudo \
--configure-opts "--enable-gpg-sha256 --disable-gpg-sha512 --enable-doc"

Expand Down
56 changes: 28 additions & 28 deletions install_gpg_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,40 +87,40 @@ main() {

case "$GPG_VERSION" in
"2.2")
./install_gpg_component.sh --component libgpg-error --version 1.31 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libgcrypt --version 1.8.2 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libassuan --version 2.5.1 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libksba --version 1.3.5 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component npth --version 1.5 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component pinentry --version 1.1.0 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component gnupg --version 2.2.7 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libgpg-error --at 1.31 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libgcrypt --at 1.8.2 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libassuan --at 2.5.1 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libksba --at 1.3.5 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component npth --at 1.5 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component pinentry --at 1.1.0 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component gnupg --at 2.2.7 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
;;
"2.1")
./install_gpg_component.sh --component libgpg-error --version 1.27 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libgcrypt --version 1.7.6 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libassuan --version 2.4.3 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libksba --version 1.3.5 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component npth --version 1.2 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component pinentry --version 0.9.5 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component gnupg --version 2.1.20 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libgpg-error --at 1.27 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libgcrypt --at 1.7.6 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libassuan --at 2.4.3 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libksba --at 1.3.5 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component npth --at 1.2 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component pinentry --at 0.9.5 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component gnupg --at 2.1.20 --build-dir "$TEMP_BUILD_DIR" "${@:2}"
;;
"latest")
./install_gpg_component.sh --component libgpg-error --version latest --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libgcrypt --version latest --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libassuan --version latest --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libksba --version latest --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component npth --version latest --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component pinentry --version latest --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component gnupg --version latest --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libgpg-error --at latest --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libgcrypt --at latest --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libassuan --at latest --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libksba --at latest --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component npth --at latest --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component pinentry --at latest --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component gnupg --at latest --build-dir "$TEMP_BUILD_DIR" "${@:2}"
;;
"master")
./install_gpg_component.sh --component libgpg-error --version master --git --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libgcrypt --version master --git --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libassuan --version master --git --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libksba --version master --git --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component npth --version master --git --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component pinentry --version master --git --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component gnupg --version master --git --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libgpg-error --at master --git --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libgcrypt --at master --git --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libassuan --at master --git --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component libksba --at master --git --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component npth --at master --git --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component pinentry --at master --git --build-dir "$TEMP_BUILD_DIR" "${@:2}"
./install_gpg_component.sh --component gnupg --at master --git --build-dir "$TEMP_BUILD_DIR" "${@:2}"
;;
esac

Expand Down
14 changes: 7 additions & 7 deletions install_gpg_component.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,30 @@ USAGE
EXAMPLES
# Installing latest version of libgpg-error
install_gpg_component.rb --component libgpg-error --version latest
install_gpg_component.rb --component libgpg-error --at latest
# Installing latest version of libgpg-error with sudo
install_gpg_component.rb --component libgpg-error --version latest --sudo
install_gpg_component.rb --component libgpg-error --at latest --sudo
# Installing latest git revision of libgpg-error
install_gpg_component.rb --component libgpg-error --version master --git
install_gpg_component.rb --component libgpg-error --at master --git
# Passing options to ./configure script
install_gpg_component.rb --component libgpg-error --version latest --configure-opts "--disable-doc --exec-prefix=/my/bin"
install_gpg_component.rb --component libgpg-error --at latest --configure-opts "--disable-doc --exec-prefix=/my/bin"
OPTIONS
--component COMPONENT
Component to install
--version VERSION
--at VERSION
Component version to install (use "latest" for the latest release),
or git ref (branch, tag, commit hash etc.) when used with "--git"
option (typically "master").
--[no-]git
Fetch source code from git repository instead of downloading release,
pass branch or tag name to --version argument. By default it is off.
pass branch or tag name to --at argument. By default it is off.
--[no-]sudo
Whether to do 'sudo make install', or just 'make install', and whether
Expand Down Expand Up @@ -91,7 +91,7 @@ parse_cli_arguments()
shift
shift
;;
--version)
--at)
_arg_version="$2"
shift
shift
Expand Down

0 comments on commit 4cfc566

Please sign in to comment.