mirror of https://github.com/zulip/zulip.git
test-install: Upgrade CLI parsing, with getopt.
This will let us add more options without the CLI collapsing under its own weight.
This commit is contained in:
parent
7d8cd37035
commit
de7abd8f78
|
@ -1,13 +1,32 @@
|
|||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
usage() {
|
||||
echo "usage: install -r RELEASE TARBALL" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
args="$(getopt -o +r: --long help,release: -- "$@")"
|
||||
eval "set -- $args"
|
||||
while true; do
|
||||
case "$1" in
|
||||
--help) usage;;
|
||||
-r|--release) RELEASE="$2"; shift; shift;;
|
||||
--) shift; break;;
|
||||
*) usage;;
|
||||
esac
|
||||
done
|
||||
INSTALLER="$1"; shift
|
||||
|
||||
if [ -z "$RELEASE" ] || [ -z "$INSTALLER" ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo "error: this script must be run as root" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RELEASE="$1"
|
||||
INSTALLER="$2"
|
||||
set -ex
|
||||
|
||||
THIS_DIR="$(dirname "$(readlink -f "$0")")"
|
||||
|
||||
|
|
Loading…
Reference in New Issue