简体   繁体   中英

How to answer installation questions during EasyEngine installation?

I am trying to make a very basic script that installs EasyEngine on multiple servers. During the installation of EasyEngine it asks for your name and e-mail. How can I define these in the script?

My script looks like this

#!/bin/bash

ssh root@$s1 wget -qO ee rt.cx/ee
ssh root@$s1 bash ee #After this command I have to provide name and e-mail
ssh root@$s1 source /etc/bash_completion.d/ee_auto.rc

ssh root@$s2 wget -qO ee rt.cx/ee
ssh root@$s2 bash ee #After this command I have to provide name and e-mail
ssh root@$s2 source /etc/bash_completion.d/ee_auto.rc

ssh root@$s3 wget -qO ee rt.cx/ee
ssh root@$s3 bash ee #After this command I have to provide name and e-mail
ssh root@$s3 source /etc/bash_completion.d/ee_auto.rc

Also Bonus question. Anyone have an idea how to combine these 3 blocks into one?

Get expect . It's not difficult, and well worth learning. The autoexpect command comes with it. Just run it without any parameters, and it will start up a new shell for you. Run your three commands against one host, then exit out of the shell. It will create script.exp for you. You'll need to clean it up a bit, especially putting in:

set ipaddr [lindex $argv 0]

to get the host from the command line. Replace your spawn ssh root@s1 with

spawn ssh root@$ipaddr

If hostnames or anything else host-specific shown up in an expect line, you'll want to clean it out.

If you have a lot of hosts to manage, I also recommend Ansible.

EasyEngine will ask for Name and Email if it did not find in .gitconfig .

Try this:

bash -c 'echo -e "[user]\n\tname = abc\n\temail = root@localhost.com" > /root/.gitconfig'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM