3

I have this script:

cd /usr/local/src/
wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
tar xf noip-duc-linux.tar.gz
cd noip-2.1.9-1/
make install <<END_SCRIPT
Username
password
30
N
END_SCRIPT

According to this guide it should install Noip DUC (I'm using Ubuntu 14.04, go to the section for Ubuntu 12.04 LTS). When it gets to make install part, I tried to configure it so it would automatically enter all need information ("username", "password", "update interval", and "do you wish to run something after install (Y/N)?").

The install goes fine until I get to the configuration part. This is the last line of the output:

Enter-username Enter-password-for-Username _

(underscore is the cursor)

The program then just hangs ther and accepts no input.

This is how it looks like when you do it manually (more or less, I didn't copy preset printed strings to the letter):

Enter-username Username
Enter-password-for-Username password
Enter-interval 30
Question(Y/N)? N

Install done

Now, I know the Username was entered properly because it prints it out when requesting password. However, when it comes to the password part, it just hangs there. Any ideas?

2

The expect program is designed exactly for this situation. To use it with the noip client, adjust your script like:

#!/usr/bin/bash

cd /usr/local/src
wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
tar xf noip-duc-linux.tar.gz
cd noip-2.1.9-1/

/usr/bin/expect <<END_SCRIPT
spawn make install
expect "Please enter the login/email*" { send "Username\r" }
expect "Please enter the password for user*" { send "password\r" }
expect "Please enter an update interval*" { send "30\r" }
expect "Do you wish to run something at successful update*" {send "N\r" }
END_SCRIPT
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.