mirror of
https://github.com/mtan93/Installomator.git
synced 2026-05-15 22:07:13 +01:00
version checking pkgInDMG would attempt to expand the pkg into the read-only dmg, also simplified the xpath call
This commit is contained in:
@@ -465,10 +465,11 @@ installFromPKG() {
|
||||
# Check version of pkg to be installed if packageID is set
|
||||
if [[ $packageID != "" && $appversion != "" ]]; then
|
||||
printlog "Checking package version."
|
||||
pkgutil --expand "$archiveName" "$archiveName"_pkg
|
||||
#printlog "$(cat "$archiveName"_pkg/Distribution | xpath '//installer-gui-script/pkg-ref[@id][@version]' 2>/dev/null)"
|
||||
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'
|
||||
rm -r "$archiveName"_pkg
|
||||
baseArchiveName=$(basename $archiveName)
|
||||
expandedPkg="$tmpDir/${baseArchiveName}_pkg"
|
||||
pkgutil --expand "$archiveName" "$expandedPkg"
|
||||
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"
|
||||
if [[ $appversion == $appNewVersion ]]; then
|
||||
printlog "Downloaded version of $name is the same as installed."
|
||||
|
||||
Reference in New Issue
Block a user