Update checkLabels.sh

This commit is contained in:
Søren Theilgaard
2021-08-25 13:06:47 +02:00
parent 30bd4797ae
commit a481b17a78

View File

@@ -14,13 +14,16 @@
# MARK: Constants # MARK: Constants
SELF=$(basename $0) pathToLabels="fragments/labels"
SELFLOCATION=$(dirname $0)
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 if [[ $(sw_vers -buildVersion ) < "18" ]]; then
echo "Installomator requires at least macOS 10.14 Mojave." echo "Installomator requires at least macOS 10.14 Mojave."
exit 98 exit 98
@@ -77,7 +80,7 @@ xpath() {
fi fi
} }
# Handling architecture, so I can verify both architectures # Handling architecture, so I can verify both i386 and arm64 architectures
arch () { arch () {
echo $fixedArch echo $fixedArch
} }
@@ -91,11 +94,11 @@ BLUE='\033[1;34m'
NC='\033[0m' # No Color NC='\033[0m' # No Color
# Labels with the $(arch) call for different versions for Intel and Apple Silicon should be listed here: # 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" echo "${BLUE}Labels with \"\$(arch)\" call:${NC}\n${archLabels}\n"
if [[ $# -eq 0 ]]; then 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 else
allLabels=( ${=@} ) allLabels=( ${=@} )
fi fi