diff options
author | Peter Cai | 2020-02-02 16:43:43 +0800 |
---|---|---|
committer | Peter Cai | 2020-02-02 16:43:43 +0800 |
commit | 5b78159e706c1f65d16887180506b14c7a89fc42 (patch) | |
tree | 965483db65afba15f1e4286c1368f0dc3c4d27b2 /Unciv.sh | |
download | aur-5b78159e706c1f65d16887180506b14c7a89fc42.tar.gz |
initial commit
Diffstat (limited to 'Unciv.sh')
-rw-r--r-- | Unciv.sh | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Unciv.sh b/Unciv.sh new file mode 100644 index 000000000000..22e51b2b99bb --- /dev/null +++ b/Unciv.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +export PATH=/usr/lib/jvm/java-8-openjdk/jre/bin/:$PATH +CONFIG_DIR="$HOME/.local/share/Unciv" + +USAGE="Unciv [--help | -h | --config-dir PATH] + +Run the Unciv game. + +With '--help' or '-h', show this help info and exit. + +With '--config-dir PATH', use/make configuration files in PATH instead +of the default of '$CONFIG_DIR'. + +" + +usage() { + echo "$USAGE" + exit 0 +} + +fail() { + echo "Error: $1" + usage + exit 1 +} + +if [ "$#" -gt "0" ]; then + case "$1" in + --help|-h) + shift + usage + ;; + --config-dir) + CONFIG_DIR="$2" + shift 2 + ;; + esac + shift +fi +if ! [ "$#" -eq "0" ]; then + fail "Unknown argument(s): $*" +fi + +mkdir -p "$CONFIG_DIR" +cd "$CONFIG_DIR" || fail "Could not 'cd' to '$CONFIG_DIR'" +java -jar /usr/share/Unciv/Unciv.jar |