Build pkg with pkgbuild without limitations like in “Packages”.
Background: I am a script guy, I make automation workflows to my customers in the PostProduction branch. So I come around the problem that I want to implement these scripts in an easy way. Actually this should be as easy as the customer gets an pkg installer and start using the script without waiting for my expertise to install the script in the correct location on the client machine or server.
I have been using the nice Application called “Packages”, but it has its limitations to where you are allowed to install stuff. It has a really nice and intuitive interface and can make these bundled pkg installers.
But I just wanted a simple and flat pkg installer.
Surprise OSX comes with such a tool embedded.
Here is a personal note on how to get a nice simple pkg file for ddrescue: https://www.gnu.org/software/ddrescue/
This require you to compile ddrescue yourself. But any other type of app or script can be used by adjusting the info below.
Disclaimer: Please use this info as-is, I am not to be held responsible for any damage to your system. It works for me, but you can expect different outcome in your environment. Feel free to contact me if you have any comments to this info.
Create all the pre-requisist for the pkgbuild
- Create a folder for you pkg project. In this case “ddrescue”
- Create your folder structure inside “ddrescue” starting with a folder called ROOT.
- Put all the files you need to install inside the folderstructure. You should end up with something like:
- In the terminal go into the project folder “ddrescue”
$ cd ~/Desktop/ddrescue
- Check the ownership and permission of the folderstructure, depends what you are installing and where you are installing it.
$ la -lah
- In this due to I am installing in /usr/local/bin I want to be root as user and wheel as group.
$ chown -R root:wheel ROOT/ $ chmod -R 755 ROOT/
- The project are now ready to make a install pkg from, by issuing the following pkgbuild command.
$ pkgbuild --root ROOT --identifier com.kulmosen.ddrescue --version 1.21 ddrescue.pkg
Congratulation you should now a have a nice pkg file inside you project folder called “ddrescue.pkg”