akvirtualcamera/ports/deploy/mac/installScripts/postinstall

55 lines
1.5 KiB
Text
Raw Normal View History

2021-11-03 22:10:30 +00:00
#!/bin/sh
2021-11-10 19:31:00 +00:00
packagePath=$1
installDir=$2
volumeInstallDir=$3
2021-11-03 22:10:30 +00:00
appName=AkVirtualCamera
2021-11-10 19:31:00 +00:00
targetDir=${volumeInstallDir}/${installDir}/${appName}
2021-11-03 22:10:30 +00:00
# Remove old plugin
rm -rf "/Library/CoreMediaIO/Plug-Ins/DAL/${appName}.plugin"
resourcesDir=${targetDir}/${appName}.plugin/Contents/Resources
# Reset permissions
chmod a+x "${resourcesDir}/AkVCamAssistant"
chmod a+x "${resourcesDir}/AkVCamManager"
# Create a symlink to the plugin.
ln -s "${targetDir}/${appName}.plugin" "/Library/CoreMediaIO/Plug-Ins/DAL/${appName}.plugin"
2021-11-04 00:14:05 +00:00
# Set assistant daemon.
2021-11-03 22:10:30 +00:00
service=org.webcamoid.cmio.AkVCam.Assistant
daemonPlist=/Library/LaunchDaemons/${service}.plist
cat << EOF > "${daemonPlist}"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>${service}</string>
<key>ProgramArguments</key>
<array>
<string>${resourcesDir}/AkVCamAssistant</string>
<string>--timeout</string>
<string>300.0</string>
</array>
<key>MachServices</key>
<dict>
<key>${service}</key>
<true/>
</dict>
<key>StandardOutPath</key>
<string>/tmp/AkVCamAssistant.log</string>
<key>StandardErrorPath</key>
<string>/tmp/AkVCamAssistant.log</string>
</dict>
</plist>
EOF
# Load assistant daemon.
launchctl enable "system/${service}"
launchctl bootstrap system "${daemonPlist}"