How do I get the original *.pkg file directory when install it?
I have created a pkg file, and put it with another file(like test.txt
) into a same folder, like ~/Desktop/test
And when install pkg file, I want it to copy the "test.txt" file to ~/Library folder. So I add preinstall/postinstall script into pkg file to copy the "test.txt" file. I try to get the directory use
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
But it will return the tmp directory
/private/tmp/PKInstallSandbox.G5GFI6/Scripts/com.myApp.testApp.pkg.o5k2nE
not the original pkg directory (~/Desktop/test)
Has anybody know how to get the original directory when install?