From a481b17a789bb58d2b233bf75a2127c88141937d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Wed, 25 Aug 2021 13:06:47 +0200 Subject: [PATCH] Update checkLabels.sh --- utils/checkLabels.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/utils/checkLabels.sh b/utils/checkLabels.sh index bee2ffd..db412a2 100755 --- a/utils/checkLabels.sh +++ b/utils/checkLabels.sh @@ -14,13 +14,16 @@ # MARK: Constants -SELF=$(basename $0) -SELFLOCATION=$(dirname $0) -pathToLabels=../"fragments/labels" +pathToLabels="fragments/labels" -#echo "Script: $SELFLOCATION/$SELF\n" +if [[ ! -d ${pathToLabels} ]]; then + echo "This script should be called from Installomator directory as working directory with this command:" + echo "utils/checkLabels.sh" + echo + exit 99 +fi -# MARK: check minimal macOS requirement +# MARK: Check minimal macOS requirement if [[ $(sw_vers -buildVersion ) < "18" ]]; then echo "Installomator requires at least macOS 10.14 Mojave." exit 98 @@ -77,7 +80,7 @@ xpath() { fi } -# Handling architecture, so I can verify both architectures +# Handling architecture, so I can verify both i386 and arm64 architectures arch () { echo $fixedArch } @@ -91,11 +94,11 @@ BLUE='\033[1;34m' NC='\033[0m' # No Color # Labels with the $(arch) call for different versions for Intel and Apple Silicon should be listed here: -archLabels=( $(grep "\$(arch)" "${pathToLabels}"/* | awk '{print $1}' | sed -E 's/.*\/([a-z0-9\_-]*)\..*/\1/g'| uniq ) ) +archLabels=( $(grep "\$(arch)" ${pathToLabels}/* | awk '{print $1}' | sed -E 's/.*\/([a-z0-9\_-]*)\..*/\1/g'| uniq ) ) echo "${BLUE}Labels with \"\$(arch)\" call:${NC}\n${archLabels}\n" if [[ $# -eq 0 ]]; then - allLabels=( $(ls "${pathToLabels}"/*.sh | sed -E 's/.*\/([a-z0-9\_-]*)\..*/\1/g') ) + allLabels=( $(ls ${pathToLabels}/*.sh | sed -E 's/.*\/([a-z0-9\_-]*)\..*/\1/g') ) else allLabels=( ${=@} ) fi