MAC Shell Scripting Issues
We are trying to deploy some software through K1000 that needs to have a custom shell script run. I have the DMG file and shell script zipped up in a package. I have the K1000 running sh myscript.sh and this seems to fail at the first line hdiutil attach mydmgfile.dmg. I get hdiutil: attach failed - No such file or directory.
Both the shell script and dmg file are in the same folder. I also get this error when running the shell script by hand.
What am I doing wrong to mount the DMG file? It should be as simple as running hdiutil attach mydmgfile.dmg.
I can run the hdiutil command by hand and it works fine, but from the script it does not.
Any help appreciated.
1 Comment
[ + ] Show comment
-
What do you have selected for the "Type" of the script? If it's an "Online Kscript" and you're referencing $(KACE_DEPENDENCY_DIR) I've seen similar errors. If so, my advice is to change it to a "Online Shell Script" - JasonEgg 8 years ago
Answers (2)
Please log in to answer
Posted by:
m698322h
8 years ago
Here is something similar to what I have in the script:
#!/bin/sh
hdiutil attach d.dmg
Then the rest of the code to run the subscripts.
The d.dmg and myshellscript.sh are in the same folder. I can run the script from the folder and I get the error attach failed - no such file or directory, but I can type hdiutil attach d.dmg from the same folder in terminal and it works.
Any help appreciated.
Posted by:
chucksteel
8 years ago
I would approach this by creating a new package that wraps the shell script together with the installation files. Download Packages from here:
Create a new package
Add the files from your disk image as resources for the post install script
Set your install script as the post install script
Compile the package and deploy as a managed install
Here's a blog post on how to do this with Office, it's not quite what you need but it's a good example of the approach: