Scripting Question

MAC Shell Scripting Issues

03/03/2016 1043 views
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"

All Answers

Here is something similar to what I have in the script:

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.
Answered 03/04/2016 by: m698322h
Orange Senior Belt

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:

Answered 03/04/2016 by: chucksteel
Red Belt

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ