From 21f02c73f87d5b53fb9ba5704002ab2daed64bbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Thu, 19 Apr 2018 10:35:39 +0200 Subject: [PATCH] build_proton.sh: Fix command line parsing --- build_proton.sh | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/build_proton.sh b/build_proton.sh index 7e16e04b..712b6409 100755 --- a/build_proton.sh +++ b/build_proton.sh @@ -2,7 +2,7 @@ usage() { - echo "$1: [component ... ] [--release] [--package]" + echo "$1: [--build component] [--release] [--package]" echo "Build the Proton Steam Tool" echo "Component can be one or more of:" echo " wine, wine32, wine64" @@ -203,35 +203,33 @@ else STRIP='strip' fi -BUILD_COMPONENTS='all' -if [ "$#" -ge 2 ]; then - for (( i=1; i <= $# - 1; i++)); do - if [ "${!i}" == "--build" ]; then - j=$((i+1)) - BUILD_COMPONENTS="${!j}" - break - fi - done -fi - PACKAGE=false -if [ "$BUILD_COMPONENTS" == "all" ]; then - PACKAGE=true -fi - +BUILD_COMPONENTS='all' INSTALL_PROGRAM_FLAGS='' -for param in "$@"; do +for (( i=1; i <= $#; i++)); do + param="${!i}" if [ "$param" == "--release" ]; then RELEASE_BUILD=1 INSTALL_PROGRAM_FLAGS='-s' elif [ "$param" == "--package" ]; then PACKAGE=true + elif [ "$param" == "--build" ]; then + i=$((i+1)) + if [ "$i" -gt "$#" ]; then + usage `basename $0` + exit 1 + fi + BUILD_COMPONENTS="${!i}" else usage `basename $0` exit 1 fi done +if [ "$BUILD_COMPONENTS" == "all" ]; then + PACKAGE=true +fi + TOP="$PWD" MAKE=make if [ x"$RELEASE_BUILD" == x ]; then