Configuration
First, configure your app to build a package (.pkg) instead of the default .dmg:
package.json
Script Setup
Place your script and the kernel extensions inbuild/pkg-scripts, or define a custom directory.
Requirements
The script must be called either
preinstall or postinstallUse
#!/bin/sh as the first line in your scriptThe script must be executable (
chmod +x <filename>)Example Script
Here’s an examplepostinstall script for managing kernel extensions:
build/pkg-scripts/postinstall
Making the Script Executable
Before building, ensure your script has execute permissions:Workflow
- Unload existing extensions - Use
kextunloadto unload any old versions - Remove old files - Delete old extension files from
/Library/Extensions/ - Copy new extensions - Copy your new
.kextfiles to the system directory - Load new extensions - Use
kextloadto activate the new extensions
Directory Structure
Custom Script Directory
To use a custom directory for your scripts, configure thescripts option: