munki / macadmin-scripts

Scripts of possible interest to macOS admins
Other
2.33k stars 523 forks source link

Installer .app generated for macOS Catalina Beta 19A512f missing files #21

Closed jazaval closed 5 years ago

jazaval commented 5 years ago

When using installinstallmacos.py to create an installer for the 19A512f beta, the following files are missing from Install macOS Catalina Beta.app:

AppleDiagnostics.chunklist AppleDiagnostics.dmg BaseSystem.chunklist BaseSystem.dmg

These files do end up installed to the root_dir "/tmp", but in a duplicate of the target folder that has the string Applications appended:

/tmp$ tree -L 5
.
├── dmg.fBRzpi
│   ├── Applications
│   │   └── Install\ macOS\ Catalina\ Beta.app
│   │       └── Contents
│   │           ├── Frameworks
│   │           ├── Info.plist
│   │           ├── MacOS
│   │           ├── PkgInfo
│   │           ├── PlugIns
│   │           ├── Resources
│   │           ├── SharedSupport
│   │           ├── _CodeSignature
│   │           └── version.plist
│   └── System
│       └── Library
│           └── Receipts
│               ├── com.apple.pkg.InstallAssistantAuto.bom
│               └── com.apple.pkg.InstallAssistantAuto.plist
└── dmg.fBRzpiApplications
    └── Install\ macOS\ Catalina\ Beta.app
        └── Contents
            └── SharedSupport
                ├── AppleDiagnostics.chunklist
                ├── AppleDiagnostics.dmg
                ├── BaseSystem.chunklist
                └── BaseSystem.dmg

17 directories, 9 files

It seems like a / is missing from the generated path for those 4 files, but not sure why this is only the case for 19A512f.

gregneagle commented 5 years ago

Yes, I can confirm this behavior as well. I do not plan to do anything about it yet. We'll see what the behavior is for the next beta.

gregneagle commented 5 years ago

(This feels like an Apple error in authoring the packages)

hkatsura commented 5 years ago

yep. a bug in the copy_dmg script. missing "/" after ${TARGET}

RecoveryHDMetaDmg.pkg/Scripts/copy_dmg:

19A512f:

TARGET="$2" TARGET_INSTALLER_PATH="${TARGET}Applications/Install macOS Catalina Beta.app" SHARED_SUPPORT_PATH="${TARGET_INSTALLER_PATH}/Contents/SharedSupport"

19A501i:

TARGET="$2"

SHARED_SUPPORT_PATH="$3/Applications/Install macOS Catalina Beta.app/Contents/SharedSupport"

jazaval commented 5 years ago

@gregneagle - just wrapped up a case with Apple on this issue, the change to TARGET_INSTALLER_PATH is not in error and is a deliberate change to the installer process to fix a different issue. They indicated we'd need to update it going forward. 😞

gregneagle commented 5 years ago

That's madness. I find it difficult to believe that TARGET_INSTALLER_PATH="${TARGET}/Applications/Install macOS Catalina Beta.app" is not the intended thing here.

jazaval commented 5 years ago

The explanation I got was that "/" is almost always the intended TARGET, and this code works for that case. I tried pointing out that //Applications works just fine, so an extra slash wouldn't break them, but there was no response to this point.

gregneagle commented 5 years ago

If you fail to fasten your seat belt, you almost always get to your intended destination without flying through the windshield.

hkatsura commented 5 years ago

until Apple fixes the noobie shell script bug (missing /), here is the workaround:

    cmd = ['/usr/sbin/installer', '-pkg', dist_path, '-target', target_vol]
    try:
        subprocess.check_call(cmd)
        # dmg.T9ak1HApplications
        path = target_vol + 'Applications'
        if os.path.exists(path):
            print('executing the ${TARGET}Applications workaround...')
            subprocess.check_call(['/usr/bin/ditto', path, os.path.join(target_vol, 'Applications')])
            subprocess.check_call(['/bin/rm', '-r', path])
        return True
jazaval commented 5 years ago

I would consider implementing this, because so far the response when engaging Apple engineering is that the missing / is a feature, not a bug. Catalina beta 5 kept the breaking change.

gregneagle commented 5 years ago

Addressed under protest here: https://github.com/munki/macadmin-scripts/commit/66331c6b5a2851c979788cf29f54afd1d9aa00d3

rodchristiansen commented 5 years ago

Work-around successfully downloaded and built Install_macOS_10.15-19A526h.dmg today.