Merge pull request #353 from Installomator/pkgInDMGExpansionFix

Pkg in dmg expansion fix
This commit is contained in:
Søren Theilgaard
2022-01-09 21:29:41 +01:00
committed by GitHub

View File

@@ -484,10 +484,11 @@ installFromPKG() {
# Check version of pkg to be installed if packageID is set # Check version of pkg to be installed if packageID is set
if [[ $packageID != "" && $appversion != "" ]]; then if [[ $packageID != "" && $appversion != "" ]]; then
printlog "Checking package version." printlog "Checking package version."
pkgutil --expand "$archiveName" "$archiveName"_pkg baseArchiveName=$(basename $archiveName)
#printlog "$(cat "$archiveName"_pkg/Distribution | xpath '//installer-gui-script/pkg-ref[@id][@version]' 2>/dev/null)" expandedPkg="$tmpDir/${baseArchiveName}_pkg"
appNewVersion=$(cat "$archiveName"_pkg/Distribution | xpath '//installer-gui-script/pkg-ref[@id][@version]' 2>/dev/null | grep -i "$packageID" | tr ' ' '\n' | grep -i version | cut -d \" -f 2) #sed -E 's/.*\"([0-9.]*)\".*/\1/g' pkgutil --expand "$archiveName" "$expandedPkg"
rm -r "$archiveName"_pkg appNewVersion=$(cat "$expandedPkg"/Distribution | xpath 'string(//installer-gui-script/pkg-ref[@id][@version]/@version)' 2>/dev/null )
rm -r "$expandedPkg"
printlog "Downloaded package $packageID version $appNewVersion" printlog "Downloaded package $packageID version $appNewVersion"
if [[ $appversion == $appNewVersion ]]; then if [[ $appversion == $appNewVersion ]]; then
printlog "Downloaded version of $name is the same as installed." printlog "Downloaded version of $name is the same as installed."