“folder” is created but file.plist is not copied inside.
No matter when I tell to execute the script.
I put file.plist in the script folder together with the .sh
I also struggled with this until I had a look at the sample scripts. They find the current directory (where the scripts are) and save it as a variable.
BASENAME=${0##*/}
SCRIPTDIR=${0%$BASENAME}
Your cp command should then look like this
cp "${SCRIPTDIR}/file.plist" "/Library/Folder/"
After using this method I never had any problem with copying or file paths in general on my MDS drive.
This is a shot in the dark, but assuming I am understanding the behavior described in Issue #541 correctly, and the working directory is the script directory when running, you could try cp ../*/file.plist "/Library/folder/"
This means go up one directory (../) and then within any of those subdirectories (*), copy any files named file.plist to the specified location.
There are other unknowns here though. Does MDS delete the script files immediately after they have been executed? If so, file.plist may no longer exist by the time your script runs. If the files are not deleted immediately, you would also need to be sure that your file.plist “script” is set to run before the script that is expecting that file to exist, which I believe can be done by setting the order in the Scripts popover in MDS.
Seems like it may be valuable for MDS to add an option to copy resources to a defined location that scripts can reference with a variable set by MDS.
Also, I am making guesses and assumptions here without any testing or certainty of how MDS is copying these files. Sorry if I’m way off here.
Thanks for your try, but it still does not work. Tried putting the script file before and after the plist file, tried during the workflow, before the packages and after the packages… nothing to do. The fact is that I have a .dmg built by my former colleague with the same version of MDS, but with Catalina, and it was working like a charm! So my questions would be
is there a way from the working .dmg to understand how the file copy has been configured? I guess I cannot access the script nor the configuration, right?
isn’t there another way with MDS to copy a file in a certain location? I find it a quite common need…
I found the answer in one of the videos in the Twocanoes channel on Youtube.
I created a folder “Resources” inside the “Scripts” folder and placed the file to be copied there.