Интерактив при -silent инсталляции

cd ~/FlashphonerWebCallServer-*/ && sudo ./install.sh -silent
выводит:

Press ENTER if you agree to the license terms. Press Ctrl+C to stop installation
(остальной интерактив действительно скипает).
как принять это из скрипта? или пилить на Expect?
без автодеплоя же проект не проект 8)
 

Max

Administrator
Staff member
Добрый день. Да, можно на expect автоматизировать.
Пример скрипта на expect:
Code:
#!/usr/bin/expect -f

cd ~/FlashphonerWebCallServer-*/

exp_internal 0

set timeout 1

spawn ./install.sh -silent 192.168.100.2 192.168.100.2

while {1} {
    expect -re "(.*)Press ENTER(.*)" {send "\r"}
    expect -re "(.*)Do you agree to the license terms(.*)" {send "yes\r"}
    expect -re "(.*)Do you want to start WebCallServer at server startup(.*)\r\n" {send "yes\r"; break}
}

exit 0
Пример playbook для ansible:

Code:
- name: Remove previous sources
  shell: "rm -rf /tmp/FlashphonerWebCallServer*"

- name: Download latest build
  shell: "wget https://flashphoner.com/download-wcs5-server.tar.gz -O- | tar -zx"
  args:
    chdir: /tmp

- name: Get WCS install directory
  shell: "ls /tmp | grep FlashphonerWebCallServer"
  register: install_dir

- name: Install Flashphoner WebCallServer
  expect:
    command: "./install.sh"
    chdir: "/tmp/{{ install_dir.stdout }}"
    responses:
      '(.*)Press ENTER(.*)': "\n"
      '(.*)Do you agree to the license terms(.*)': "yes"
      'Is your server located in your LAN \[yes/no\] ?': "yes"
      'Press any key to continue...': "\n"
      '(.*)Do you want to start WebCallServer at server startup(.*)': "no"
      '(.*)Installation complete!(.*)': "\n"
 
Top