Please refer to this question first,
unable to read opensslv.h:No such file or directory
Based on that I need to run the following three line Terminal commands using AppleScript,
/tmp/ssl/openssl-1.0.1h/Configure darwin64-x86_64-cc ––prefix=/usr no-threads shared
make -f /tmp/ssl/openssl-1.0.1h/Makefile
sudo make -f /tmp/ssl/openssl-1.0.1h/Makefile install
I tried two methods I created text files with .command and .sh extensions and added the above three lines. Then tried to run it from AppleScript as,
do shell script "/Users/Username/Desktop/RunScript.sh"
But got this error,
error "/Users/Username/Desktop/RunScript.sh: line 1: /tmp/ssl/openssl-1.0.1h/Configure: No such file or directory
/Users/Muhriz/Desktop/InstallOpenSSL.sh: line 2: make: command not found sudo: no tty present and no askpass program specified" number 1
This could work,
tell application "Terminal" to activate
tell application "Terminal"
do script ("/tmp/ssl/openssl-1.0.1h/Configure darwin64-x86_64-cc ––prefix=/usr no-threads shared") in window 1
do script ("make -f /tmp/ssl/openssl-1.0.1h/Makefile") in window 1
do script ("sudo make -f /tmp/ssl/openssl-1.0.1h/Makefile install") in window 1
end tell
But it asks for password in Terminal at the third line and waits for user response. The password dialog shown from the AppleScript (when using with administrator privileges
) is OK. But it must no ask for password via Terminal when running the commands. It needs to ask only once when the AppleScript is executed and run all sudo
related commands without asking for password in Terminal.
What code needs to be used to run from AppleScript?