Erase and Instal - Install Package

georgel
New Contributor III

The --installpackage command is not working for me. I am trying to reimage my non-dep macs so i've added the QuickAdd package so it re-enrolls.
This is the script im using. The quickad trigger adds the pkg to the /Users/Shared/ successfully but after the os is reinstalled it hasnt reenrolled.

#!/bin/sh

if [ -e "/Users/Shared/QuickAdd.pkg" ] && [ -e "/Applications/Install macOS Mojave.app" ]; then
    /Applications/Install macOS Mojave.app/Contents/Resources/startosinstall --eraseinstall --agreetolicense --nointeraction --installpackage /Users/Shared/QuickAdd.pkg
    echo "QuickAdd pkg and macOS Mojave app exists"
else
    echo "QuickAdd & macOS Mojave app don't exist"
fi

if [ -e "/Users/Shared/QuickAdd.pkg" ]; then
    echo "QuickAdd pkg exists"
else
    jamf policy -trigger QuickAdd
    echo "QuickAdd downloaded"
fi


if [ -e "/Applications/Install macOS Mojave.app" ]; then
    echo "macOS Mojave app already exists"
else
    jamf policy -trigger macOSInstaller
    echo "macOS Mojave app downloaded"  
fi

if [ -e "/Users/Shared/QuickAdd.pkg" ] && [ -e "/Applications/Install macOS Mojave.app" ]; then
    /Applications/Install macOS Mojave.app/Contents/Resources/startosinstall --eraseinstall --agreetolicense --nointeraction --installpackage /Users/Shared/QuickAdd.pkg
fi
5 REPLIES 5

cbrewer
Valued Contributor II

You might not be able to to use eraseinstall with installpackage pointed to a local package. Have you tried placing the QuickAdd package on an external volume (install media or separate flash drive)? You might, then, need to specify the full path (I.E. /Volumes/Untitled/QuickAdd.pkg).

chriscollins
Valued Contributor

-

chriscollins
Valued Contributor

@georgel Actually what I think your problem is is that startosinstall requires a Distribution style installer package with a product identifier in it. If you are trying to install a QuickAdd package that was built with the Recon app or downloaded from the jss, it is not actually in that format and will fail to install. You'd basically need to strip JAMF's package and create a new one in the proper format.

You can see more on this blog post: https://managingosx.wordpress.com/2017/11/17/customized-high-sierra-install-issues-and-workarounds/

Nix4Life
Valued Contributor

agree with @chriscollins , flatten the package with pkguitl or use installr. You just reverse engineered it

tjhall
Contributor III

The QuickAdd package must be signed for it to work.
https://simplemdm.com/2018/10/04/certificate-sign-macos-packages/