This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallAnywhere
- :
- InstallAnywhere Forum
- :
- Re: execute sudo commands from shell script
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Aug 01, 2013
09:01 AM
execute sudo commands from shell script
Hello,
I'm creating an installer for Mac OS X and I'm having huge issues trying to execute sudo commands. I have the installer checked for "Requires an Administrator Name and Password to Install" but the installer is still failing to execute sudo commands from a bash script that i create in a custom code action and deploy to be executed. The bash script has looks like this ....
#!/bin/bash
#Install XCode Command Line Utilities
cd "/usr/local/bin/AppWrapping/XCode"
hdiutil mount xcode452cltools10_86938211a.dmg
sudo installer -pkg "/Volumes/Command Line Tools (Mountain Lion)/Command Line Tools (Mountain Lion).mpkg" -target /
hdiutil eject "/Volumes/Command Line Tools (Mountain Lion)"
The script is running and mounting the dmg file. then when it trys to run the sudo installer -pkg line i get this error "no tty present and no askpass program specified"
please help...
I'm creating an installer for Mac OS X and I'm having huge issues trying to execute sudo commands. I have the installer checked for "Requires an Administrator Name and Password to Install" but the installer is still failing to execute sudo commands from a bash script that i create in a custom code action and deploy to be executed. The bash script has looks like this ....
#!/bin/bash
#Install XCode Command Line Utilities
cd "/usr/local/bin/AppWrapping/XCode"
hdiutil mount xcode452cltools10_86938211a.dmg
sudo installer -pkg "/Volumes/Command Line Tools (Mountain Lion)/Command Line Tools (Mountain Lion).mpkg" -target /
hdiutil eject "/Volumes/Command Line Tools (Mountain Lion)"
The script is running and mounting the dmg file. then when it trys to run the sudo installer -pkg line i get this error "no tty present and no askpass program specified"
please help...
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Aug 02, 2013
09:14 AM
I think that it'll be easier to run a custom code that would check if the installer is run by root and it would abort the installation if it's not the case. Using sudo is tricky, and I think that you need several prerequisite: the user running the installer must be in the sudoers group AND sudo should work without prompting for a password (most likely this is what happens in your case, the installer waits for the script which expects you to enter your password when executing the sudo command).