From 4e8db91ff07dea888773ca427db296d1517e076e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Fri, 12 Nov 2021 15:58:36 +0100 Subject: [PATCH 1/4] Update buildLabel.sh --- utils/buildLabel.sh | 173 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 134 insertions(+), 39 deletions(-) diff --git a/utils/buildLabel.sh b/utils/buildLabel.sh index d58df9f..bb4c12e 100755 --- a/utils/buildLabel.sh +++ b/utils/buildLabel.sh @@ -10,6 +10,80 @@ downloadURL=${1?:"need to provide a download URL."} # Usage # ./buildLabel.sh +# Mark: Functions + +xpath() { + # the xpath tool changes in Big Sur and now requires the `-e` option + if [[ $(sw_vers -buildVersion) > "20A" ]]; then + /usr/bin/xpath -e $@ + # alternative: switch to xmllint (which is not perl) + #xmllint --xpath $@ - + else + /usr/bin/xpath $@ + fi +} +# will get the latest release download from a github repo +downloadURLFromGit() { # $1 git user name, $2 git repo name + gitusername=${1?:"no git user name"} + gitreponame=${2?:"no git repo name"} + + if [[ $type == "pkgInDmg" ]]; then + filetype="dmg" + elif [[ $type == "pkgInZip" ]]; then + filetype="zip" + else + filetype=$type + fi + + if [ -n "$archiveDestinationName" ]; then + downloadURL=$(curl -sf "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | awk -F '"' "/browser_download_url/ && /$archiveName\"/ { print \$4; exit }") + else + downloadURL=$(curl -sf "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | awk -F '"' "/browser_download_url/ && /$filetype\"/ { print \$4; exit }") + fi + + echo "$downloadURL" + return 0 +} +versionFromGit() { + # $1 git user name, $2 git repo name + gitusername=${1?:"no git user name"} + gitreponame=${2?:"no git repo name"} + + appNewVersion=$(curl --silent --fail "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | grep tag_name | cut -d '"' -f 4 | sed 's/[^0-9\.]//g') + if [ -z "$appNewVersion" ]; then + printlog "could not retrieve version number for $gitusername/$gitreponame" + appNewVersion="" + else + echo "$appNewVersion" + return 0 + fi +} + +pkgInvestigation() { + echo "Package found" + teamID=$(spctl -a -vv -t install "$archiveName" 2>&1 | awk '/origin=/ {print $NF }' | tr -d '()' ) + echo "For PKGs it's advised to find packageID for version checking" + + pkgutil --expand "$pkgPath" "$archiveName"_pkg + cat "$archiveName"_pkg/Distribution | xpath '//installer-gui-script/pkg-ref[@id][@version]' 2>/dev/null + packageID="$(cat "$archiveName"_pkg/Distribution | xpath '//installer-gui-script/pkg-ref[@id][@version]' 2>/dev/null | tr ' ' '\n' | grep -i "id" | cut -d \" -f 2)" + rm -r "$archiveName"_pkg + echo "$packageID" + echo "Above is the possible packageIDs that can be used, and the correct one is probably one of those with a version number. More investigation might be needed to figure out correct packageID if several are displayed." +} +appInvestigation() { + appName=${appPath##*/} + name=${appName%.*} + + # verify with spctl + echo "Verifying: $appPath" + if ! teamID=$(spctl -a -vv "$appPath" 2>&1 | awk '/origin=/ {print $NF }' | tr -d '()' ); then + echo "Error verifying $appPath" + exit 4 + fi +} + +# Mark: Code # Use working directory as download folder tmpDir="$(pwd)/$(date "+%Y-%m-%d-%H-%M-%S")" # Create a n almost unique folder name @@ -48,40 +122,6 @@ if ! downloadOut="$(curl -fL "$downloadURL" --remote-header-name --remote-name - fi fi -xpath() { - # the xpath tool changes in Big Sur and now requires the `-e` option - if [[ $(sw_vers -buildVersion) > "20A" ]]; then - /usr/bin/xpath -e $@ - # alternative: switch to xmllint (which is not perl) - #xmllint --xpath $@ - - else - /usr/bin/xpath $@ - fi -} - -pkgInvestigation() { - echo "Package found" - teamID=$(spctl -a -vv -t install "$archiveName" 2>&1 | awk '/origin=/ {print $NF }' | tr -d '()' ) - echo "For PKGs it's advised to find packageID for version checking" - - pkgutil --expand "$pkgPath" "$archiveName"_pkg - cat "$archiveName"_pkg/Distribution | xpath '//installer-gui-script/pkg-ref[@id][@version]' 2>/dev/null - packageID="$(cat "$archiveName"_pkg/Distribution | xpath '//installer-gui-script/pkg-ref[@id][@version]' 2>/dev/null | tr ' ' '\n' | grep -i "id" | cut -d \" -f 2)" - rm -r "$archiveName"_pkg - echo "$packageID" - echo "Above is the possible packageIDs that can be used, and the correct one is probably one of those with a version number. More investigation might be needed to figure out correct packageID if several are displayed." -} -appInvestigation() { - appName=${appPath##*/} - - # verify with spctl - echo "Verifying: $appPath" - if ! teamID=$(spctl -a -vv "$appPath" 2>&1 | awk '/origin=/ {print $NF }' | tr -d '()' ); then - echo "Error verifying $appPath" - exit 4 - fi -} - #echo "downloadOut:\n${downloadOut}" archiveTempName=$( echo "${downloadOut}" | head -1 ) echo "archiveTempName: $archiveTempName" @@ -106,6 +146,7 @@ mv $archiveTempName $archiveName name=${archiveName%.*} echo "name: $name" archiveExt=${archiveName##*.} +type=$archiveExt echo "archiveExt: $archiveExt" identifier=${name:l} identifier=${identifier//\%[0-9a-fA-F][0-9a-fA-F]} @@ -155,6 +196,60 @@ elif [ "$archiveExt" = "zip" ] || [ "$archiveExt" = "tbz" ]; then fi +if echo "$downloadURL" | grep -i "github.com.*releases/download"; then + echo "\n**********\n\nFound GitHub path" + githubAuthor=$(echo "$downloadURL" | cut -d "/" -f4) + githubRepo=$(echo "$downloadURL" | cut -d "/" -f5) + if [[ ! -z $githubAuthor && $githubRepo ]] ; then + echo "Github place: $githubAuthor $githubRepo" + originalDownloadURL="$downloadURL" + githubDownloadURL=$(downloadURLFromGit "$githubAuthor" "$githubRepo") + githubAppNewVersion=$(versionFromGit "$githubAuthor" "$githubRepo") + downloadURL=$originalDownloadURL + echo "Latest URL on github: $githubDownloadURL \nLatest version: $githubAppNewVersion" + if [[ "$originalDownloadURL" == "$githubDownloadURL" ]]; then + echo "GitHub calculated URL matches entered URL." + downloadURL="\$(downloadURLFromGit $githubAuthor $githubRepo)" + appNewVersion="\$(versionFromGit $githubAuthor $githubRepo)" + else + if [[ "$( echo $originalDownloadURL | cut -d "/" -f1-7)" == "$( echo $githubDownloadURL | cut -d "/" -f1-7)" ]]; then + echo "Calculated GitHub URL almost identical, only this diff:" + echo "“$( echo $originalDownloadURL | cut -d "/" -f8-)” and “$( echo $githubDownloadURL | cut -d "/" -f8-)”" + echo "Could be version difference or difference in archiveName for a given release." + echo "Testing for version difference." + #Investigate if these strings match if numbers are removed. + if [[ "$( echo $originalDownloadURL | cut -d "/" -f8- | sed 's/[0-9.]*//g')" == "$( echo $githubDownloadURL | cut -d "/" -f8- | sed 's/[0-9.]*//g')" ]]; then + echo "“$( echo $originalDownloadURL | cut -d "/" -f8- | sed 's/[0-9.]*//g')” and “$( echo $githubDownloadURL | cut -d "/" -f8- | sed 's/[0-9.]*//g')”" + echo "Matching without numbers in string.\nVERY LIKELY a version difference." + echo "Try running again with URL: ${githubDownloadURL}" + else + echo "Not a version problem.\nTesting for difference in archiveName." + tempName=$(echo ${archiveName%.*} | grep -o "[0-9.]*") + archiveDestinationName="$(echo $archiveName | sed -E "s/^(.*)$tempName(.*)$/\1[0-9.]*\2/g")" + echo "archiveName=\"$archiveDestinationName\"" + githubDownloadURL=$(downloadURLFromGit "$githubAuthor" "$githubRepo") + githubAppNewVersion=$(versionFromGit "$githubAuthor" "$githubRepo") + downloadURL=$originalDownloadURL + echo "Latest URL on github: $githubDownloadURL \nLatest version: $githubAppNewVersion" + if [[ "$originalDownloadURL" == "$githubDownloadURL" ]]; then + echo "GitHub calculated URL matches entered URL." + downloadURL="\$(downloadURLFromGit $githubAuthor $githubRepo)" + appNewVersion="\$(versionFromGit $githubAuthor $githubRepo)" + else + echo "Not solved by using archiveName." + echo "Not sure what this can be." + archiveDestinationName="" + fi + fi + #downloadURL="\$(downloadURLFromGit $githubAuthor $githubRepo)" + #appNewVersion="\$(versionFromGit $githubAuthor $githubRepo)" + else + echo "GitHub URL not matching" + fi + fi + fi +fi + echo echo "**********" echo @@ -165,11 +260,14 @@ echo echo "$identifier)" echo " name=\"$name\"" echo " type=\"$archiveExt\"" -if [ "$packageID" != "" ]; then +if [ -n "$packageID" ]; then echo " packageID=\"$packageID\"" fi +if [ -n "$archiveDestinationName" ]; then +echo " archiveName=\"$archiveDestinationName\"" +fi echo " downloadURL=\"$downloadURL\"" -echo " appNewVersion=\"\"" +echo " appNewVersion=\"$appNewVersion\"" echo " expectedTeamID=\"$teamID\"" if [ -n "$appName" ] && [ "$appName" != "${name}.app" ]; then echo " appName=\"$appName\"" @@ -179,6 +277,3 @@ echo echo "Above should be saved in a file with exact same name as label, and given extension “.sh”." echo "Put this file in folder “fragments/labels”." echo - - -exit 0 From ba7fc6468f0ad61d6769a9c4a516231f5a3d41ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Sat, 13 Nov 2021 20:15:54 +0100 Subject: [PATCH 2/4] GitHub improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I'm really proud to figure this out. Take a look at hos this label is being build: ``` % Documents/GitHub/Installomator/utils/buildLabel.sh "https://github.com/Aleph-One-Marathon/alephone/releases/download/release-20210408/Marathon-20210408-Mac.dmg" Changing directory to /Users/st/Downloads/2021-11-13-20-03-26 Working dir: /Users/st/Downloads/2021-11-13-20-03-26 Downloading https://github.com/Aleph-One-Marathon/alephone/releases/download/release-20210408/Marathon-20210408-Mac.dmg Marathon-20210408-Mac.dmg Redirecting to (maybe this can help us with version): % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 662 100 662 0 0 2225 0 --:--:-- --:--:-- --:--:-- 2290 100 49.7M 100 49.7M 0 0 7284k 0 0:00:06 0:00:06 --:--:-- 10.5M archiveTempName: Marathon-20210408-Mac.dmg archivePath: https://objects.githubusercontent.com/github-production-release-asset-2e65be/39701264/c534b380-98b5-11eb-9c5b-bd8909ee1263?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20211113%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20211113T190327Z&X-Amz-Expires=300&X-Amz-Signature=bb6789b784ade0fd9b1f81ca88d63dd09224bae9fd15be4a4a61f31425aca553&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=39701264&response-content-disposition=attachment%3B%20filename%3DMarathon-20210408-Mac.dmg&response-content-type=application%2Foctet-stream Calculated archiveName: Marathon-20210408-Mac.dmg name: Marathon-20210408-Mac archiveExt: dmg identifier: marathon20210408mac Diskimage found Mounting Marathon-20210408-Mac.dmg Mounted: /Volumes/Marathon Verifying: /Volumes/Marathon/Marathon.app "disk8" ejected. https://github.com/Aleph-One-Marathon/alephone/releases/download/release-20210408/Marathon-20210408-Mac.dmg ********** Found GitHub path Github place: Aleph-One-Marathon alephone Latest URL on github: https://github.com/Aleph-One-Marathon/alephone/releases/download/release-20210408/AlephOne-20210408-Mac.dmg Latest version: 20210408 Calculated GitHub URL almost identical, only this diff: “release-20210408/Marathon-20210408-Mac.dmg” and “release-20210408/AlephOne-20210408-Mac.dmg” Could be version difference or difference in archiveName for a given release. Testing for version difference. Not a version problem. Testing for difference in archiveName. archiveName="Marathon-[0-9.]*-Mac.dmg" Latest URL on github: https://github.com/Aleph-One-Marathon/alephone/releases/download/release-20210408/Marathon-20210408-Mac.dmg Latest version: 20210408 GitHub calculated URL matches entered URL. ********** Labels should be named in small caps, numbers 0-9, “-”, and “_”. No other characters allowed. marathon20210408mac) name="Marathon" type="dmg" archiveName="Marathon-[0-9.]*-Mac.dmg" downloadURL="$(downloadURLFromGit Aleph-One-Marathon alephone)" appNewVersion="$(versionFromGit Aleph-One-Marathon alephone)" expectedTeamID="E8K89CXZE7" ;; Label converted to GitHub label without errors. Details can be seen above. Above should be saved in a file with exact same name as label, and given extension “.sh”. Put this file in folder “fragments/labels”. ``` This repo on GitHub has several software titles, and because we have the link, it can automatically figure out how to make the `archiveName`. --- utils/buildLabel.sh | 46 +++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/utils/buildLabel.sh b/utils/buildLabel.sh index bb4c12e..f1e3638 100755 --- a/utils/buildLabel.sh +++ b/utils/buildLabel.sh @@ -201,6 +201,7 @@ if echo "$downloadURL" | grep -i "github.com.*releases/download"; then githubAuthor=$(echo "$downloadURL" | cut -d "/" -f4) githubRepo=$(echo "$downloadURL" | cut -d "/" -f5) if [[ ! -z $githubAuthor && $githubRepo ]] ; then + githubError=9 echo "Github place: $githubAuthor $githubRepo" originalDownloadURL="$downloadURL" githubDownloadURL=$(downloadURLFromGit "$githubAuthor" "$githubRepo") @@ -209,6 +210,7 @@ if echo "$downloadURL" | grep -i "github.com.*releases/download"; then echo "Latest URL on github: $githubDownloadURL \nLatest version: $githubAppNewVersion" if [[ "$originalDownloadURL" == "$githubDownloadURL" ]]; then echo "GitHub calculated URL matches entered URL." + githubError=0 downloadURL="\$(downloadURLFromGit $githubAuthor $githubRepo)" appNewVersion="\$(versionFromGit $githubAuthor $githubRepo)" else @@ -221,6 +223,7 @@ if echo "$downloadURL" | grep -i "github.com.*releases/download"; then if [[ "$( echo $originalDownloadURL | cut -d "/" -f8- | sed 's/[0-9.]*//g')" == "$( echo $githubDownloadURL | cut -d "/" -f8- | sed 's/[0-9.]*//g')" ]]; then echo "“$( echo $originalDownloadURL | cut -d "/" -f8- | sed 's/[0-9.]*//g')” and “$( echo $githubDownloadURL | cut -d "/" -f8- | sed 's/[0-9.]*//g')”" echo "Matching without numbers in string.\nVERY LIKELY a version difference." + githubError=1 echo "Try running again with URL: ${githubDownloadURL}" else echo "Not a version problem.\nTesting for difference in archiveName." @@ -233,9 +236,11 @@ if echo "$downloadURL" | grep -i "github.com.*releases/download"; then echo "Latest URL on github: $githubDownloadURL \nLatest version: $githubAppNewVersion" if [[ "$originalDownloadURL" == "$githubDownloadURL" ]]; then echo "GitHub calculated URL matches entered URL." + githubError=0 downloadURL="\$(downloadURLFromGit $githubAuthor $githubRepo)" appNewVersion="\$(versionFromGit $githubAuthor $githubRepo)" else + githubError=2 echo "Not solved by using archiveName." echo "Not sure what this can be." archiveDestinationName="" @@ -250,14 +255,14 @@ if echo "$downloadURL" | grep -i "github.com.*releases/download"; then fi fi -echo -echo "**********" -echo -echo "Labels should be named in small caps, numbers 0-9, “-”, and “_”. No other characters allowed." -echo -echo "appNewVersion is often difficult to find. Can sometimes be found in the filename, sometimes as part of the download redirects, but also on a web page. See redirect and archivePath above if link contains information about this. That is a good place to start" -echo -echo "$identifier)" +echo "\n**********" +echo "\nLabels should be named in small caps, numbers 0-9, “-”, and “_”. No other characters allowed." + +if [[ -z $githubError || $githubError != 0 ]]; then +echo "\nappNewVersion is often difficult to find. Can sometimes be found in the filename, sometimes as part of the download redirects, but also on a web page. See redirect and archivePath above if link contains information about this. That is a good place to start" +fi + +echo "\n$identifier)" echo " name=\"$name\"" echo " type=\"$archiveExt\"" if [ -n "$packageID" ]; then @@ -273,7 +278,24 @@ if [ -n "$appName" ] && [ "$appName" != "${name}.app" ]; then echo " appName=\"$appName\"" fi echo " ;;" -echo -echo "Above should be saved in a file with exact same name as label, and given extension “.sh”." -echo "Put this file in folder “fragments/labels”." -echo + +case $githubError in +0) + echo "\nLabel converted to GitHub label without errors." + echo "Details can be seen above." + ;; +1) + echo "\nFound Github place in this URL: $githubAuthor $githubRepo" + echo "But version has a problem." + echo "Try running again with URL: ${githubDownloadURL}" + echo "See details above." + ;; +2) + echo "\nFound Github place in this URL: $githubAuthor $githubRepo" + echo "But it could not be resolved." + echo "Can be from a hidden repository." + ;; +esac + +echo "\nAbove should be saved in a file with exact same name as label, and given extension “.sh”." +echo "Put this file in folder “fragments/labels”.\n" From 32353c3852459e41c79eb4afe845aace1e9ca16a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Sun, 14 Nov 2021 19:51:36 +0100 Subject: [PATCH 3/4] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index be8b237..be02e90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## v0.8 +- `buildLabel.sh` has been improved to build GitHub software labels much easier. In essense if the URL contains github.com, then it will try to find if it's the latest version or if variable `archiveName` is needed for finding the software. ## v0.7 From 374a32be9a2d3a6c5f16f6617383eba5a6483e43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Sun, 14 Nov 2021 21:02:34 +0100 Subject: [PATCH 4/4] better pkg handling --- CHANGELOG.md | 2 +- utils/buildLabel.sh | 39 ++++++++++++++++++++++++++++++++------- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index be02e90..a47f9de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## v0.8 -- `buildLabel.sh` has been improved to build GitHub software labels much easier. In essense if the URL contains github.com, then it will try to find if it's the latest version or if variable `archiveName` is needed for finding the software. +- `buildLabel.sh` has been improved to build GitHub software labels much easier. In essense if the URL contains github.com, then it will try to find if it's the latest version or if variable `archiveName` is needed for finding the software. Also improved messaging throughout the script, as well as handling a situation where a pkg does not include a “DIstribution” file, but a “PackageInfo”. ## v0.7 diff --git a/utils/buildLabel.sh b/utils/buildLabel.sh index f1e3638..e79c3fb 100755 --- a/utils/buildLabel.sh +++ b/utils/buildLabel.sh @@ -60,13 +60,24 @@ versionFromGit() { } pkgInvestigation() { - echo "Package found" + echo "Package investigation." teamID=$(spctl -a -vv -t install "$archiveName" 2>&1 | awk '/origin=/ {print $NF }' | tr -d '()' ) - echo "For PKGs it's advised to find packageID for version checking" + if [[ -z $teamID ]]; then + echo "Error verifying PKG: $archiveName" + echo "No TeamID found." + exit 4 + fi + echo "Team ID found for PKG: $teamID" + echo "For PKGs it's advised to find packageID for version checking, so extracting those" pkgutil --expand "$pkgPath" "$archiveName"_pkg - cat "$archiveName"_pkg/Distribution | xpath '//installer-gui-script/pkg-ref[@id][@version]' 2>/dev/null - packageID="$(cat "$archiveName"_pkg/Distribution | xpath '//installer-gui-script/pkg-ref[@id][@version]' 2>/dev/null | tr ' ' '\n' | grep -i "id" | cut -d \" -f 2)" + if [[ -a "$archiveName"_pkg/Distribution ]] ; then + cat "$archiveName"_pkg/Distribution | xpath '//installer-gui-script/pkg-ref[@id][@version]' 2>/dev/null + packageID="$(cat "$archiveName"_pkg/Distribution | xpath '//installer-gui-script/pkg-ref[@id][@version]' 2>/dev/null | tr ' ' '\n' | grep -i "id" | cut -d \" -f 2)" + elif [[ -a "$archiveName"_pkg/PackageInfo ]] ; then + cat "$archiveName"_pkg/PackageInfo | xpath '//pkg-info/@version' 2>/dev/null + packageID="$(cat "$archiveName"_pkg/PackageInfo | xpath '//pkg-info/@identifier' 2>/dev/null | cut -d '"' -f2 )" + fi rm -r "$archiveName"_pkg echo "$packageID" echo "Above is the possible packageIDs that can be used, and the correct one is probably one of those with a version number. More investigation might be needed to figure out correct packageID if several are displayed." @@ -74,13 +85,16 @@ pkgInvestigation() { appInvestigation() { appName=${appPath##*/} name=${appName%.*} + echo "Application investigation." # verify with spctl - echo "Verifying: $appPath" - if ! teamID=$(spctl -a -vv "$appPath" 2>&1 | awk '/origin=/ {print $NF }' | tr -d '()' ); then - echo "Error verifying $appPath" + teamID=$(spctl -a -vv "$appPath" 2>&1 | awk '/origin=/ {print $NF }' | tr -d '()' ) + if [[ -z $teamID ]]; then + echo "Error verifying app: $appPath" + echo "No TeamID found." exit 4 fi + echo "Team ID found for app: $teamID" } # Mark: Code @@ -155,6 +169,7 @@ echo "identifier: $identifier" if [ "$archiveExt" = "pkg" ]; then pkgPath="$archiveName" + echo "PKG found: $pkgPath" pkgInvestigation elif [ "$archiveExt" = "dmg" ]; then echo "Diskimage found" @@ -171,10 +186,15 @@ elif [ "$archiveExt" = "dmg" ]; then pkgPath=$(find "$dmgmount" -name "*.pkg" -maxdepth 1 -print ) if [[ $appPath != "" ]]; then + echo "App found: $appPath" appInvestigation elif [[ $pkgPath != "" ]]; then + echo "PKG found: $pkgPath" archiveExt="pkgInDmg" pkgInvestigation + else + echo "Nothing found on DMG." + exit 9 fi hdiutil detach "$dmgmount" @@ -188,10 +208,15 @@ elif [ "$archiveExt" = "zip" ] || [ "$archiveExt" = "tbz" ]; then pkgPath=$(find "$tmpDir" -name "*.pkg" -maxdepth 2 -print ) if [[ $appPath != "" ]]; then + echo "App found: $appPath" appInvestigation elif [[ $pkgPath != "" ]]; then + echo "PKG found: $pkgPath" archiveExt="pkgInZip" pkgInvestigation + else + echo "Nothing found in compressed archive." + exit 9 fi fi