From ae3f7117383830050fe3a4fbf69c34ea5521c287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Theilgaard?= Date: Mon, 7 Feb 2022 16:32:23 +0100 Subject: [PATCH] Further logging, finding pkg only return files Important change, when we use `find` to locate pkgs. Now only files will be returned. --- fragments/functions.sh | 8 +++++--- fragments/main.sh | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/fragments/functions.sh b/fragments/functions.sh index 037086f..a851077 100644 --- a/fragments/functions.sh +++ b/fragments/functions.sh @@ -400,6 +400,7 @@ installAppWithPath() { # $1: path to app to install in $targetDir # verify with spctl printlog "Verifying: $appPath" INFO + printlog "App size: $(du -sh "$appPath")" DEBUG appVerify=$(spctl -a -vv "$appPath" 2>&1 ) appVerifyStatus=$(echo $?) teamID=$(echo $appVerify | awk '/origin=/ {print $NF }' | tr -d '()' ) @@ -537,7 +538,8 @@ installFromDMG() { installFromPKG() { # verify with spctl printlog "Verifying: $archiveName" - + printlog "File list: $(ls -lh "$archiveName")" DEBUG + printlog "File type: $(file "$archiveName")" DEBUG spctlOut=$(spctl -a -vv -t install "$archiveName" 2>&1 ) spctlStatus=$(echo $?) printlog "spctlOut is $spctlOut" DEBUG @@ -656,7 +658,7 @@ installPkgInDmg() { # locate pkg in dmg if [[ -z $pkgName ]]; then # find first file ending with 'pkg' - findfiles=$(find "$dmgmount" -iname "*.pkg" -maxdepth 1 ) + findfiles=$(find "$dmgmount" -iname "*.pkg" -type f -maxdepth 1 ) filearray=( ${(f)findfiles} ) if [[ ${#filearray} -eq 0 ]]; then cleanupAndExit 20 "couldn't find pkg in dmg $archiveName" ERROR @@ -691,7 +693,7 @@ installPkgInZip() { # locate pkg in zip if [[ -z $pkgName ]]; then # find first file ending with 'pkg' - findfiles=$(find "$tmpDir" -iname "*.pkg" -maxdepth 2 ) + findfiles=$(find "$tmpDir" -iname "*.pkg" -type f -maxdepth 2 ) filearray=( ${(f)findfiles} ) if [[ ${#filearray} -eq 0 ]]; then cleanupAndExit 20 "couldn't find pkg in zip $archiveName" ERROR diff --git a/fragments/main.sh b/fragments/main.sh index 88b0fbb..1de095f 100644 --- a/fragments/main.sh +++ b/fragments/main.sh @@ -207,8 +207,12 @@ else displaynotification "$message" "Error installing $name" ERROR fi fi + printlog "File list: $(ls -lh "$archiveName")" ERROR + printlog "File type: $(file "$archiveName")" ERROR cleanupAndExit 2 "Error downloading $downloadURL error:\n$logoutput" ERROR fi + printlog "File list: $(ls -lh "$archiveName")" DEBUG + printlog "File type: $(file "$archiveName")" DEBUG printlog "curl output was:\n$logoutput" DEBUG fi