With MacOS, we have iquploader.app, iqboxshare.app and Share file(s) online with IQBoxShare.workflow (we will zip this file) and we want to create only one installation package what will let two app files to Application folder and workflow file to ~/Library/Services (/Users/[user name]/Library/Services)
Tools: packageMaker (auxiliary tool for Xcode)
Step1: Drag and Drop 3 files to PackageMaker.
-With iquploader.app and iqboxshare.app, we set /Applications
–With Share file(s) online with IQBoxShare.zip, we set to /tmp
(PackageMaker cannot know the current user home folder (Ex: /User/Tung/Library/Services) and Mac 10.8 doesn’t have services folder. We must set this file to a temporary folder and then we run a shell script to do all things for it.)
Uncheck “Allow relocation” with both IQUploader.app and IQBoxShare.app. When “allow relocation” is checked, it means that the installer will search for an existing copy of the application and replace it there rather than the default install location. It’s probably finding the app in its build folder and replacing it there.
Step 3: Select our Shell Script for postflight (This script is launched after the files in the package have been installed. See (preinstall / preupgrade) to see which one is launched)
The content of shell script or can download here:
#!/bin/bash echo "Start postflight script" cd ~/Library if [ -d "Services" ]; then echo "That directory exists" else echo "That directory doesn't exists. Create it" mkdir "Services" fi mv "/tmp/Share file(s) online with IQBoxShare.zip" ~/Library/Services/ cd ~/Library/Services/ unzip "Share file(s) online with IQBoxShare.zip" rm "Share file(s) online with IQBoxShare.zip" rm -rf __MACOSX echo "End postflight script" exit 0
Then set a name for the output
Click “Build” and we will have a package file.