Почему TERM=xterm должен быть установлен, чтобы мой сценарий работал правильно, когда удаленно выполняется?

invoke-expression "robocopy $source $dest $what $options /LOG:MyLogfile.txt"

Это интерполирует все переменные, затем назвать получившую строку. Путем у Вас есть он теперь, похоже, что robocopy вызывается с кавычками вокруг всех опций, т.е. robocopy "вздор c:\src c:\dst meh". Это интерпретируется как единственный параметр.

3
задан 13 November 2011 в 15:54
3 ответа

Пакет sun-java6-jre содержит сценарий preinst , который запрашивает лицензионное соглашение через / usr / share / debconf / confmodule (также известный как интерфейс "сценария оболочки" к интерфейсу debconf). За реализацией debconf очень сложно следить, но я предполагаю, что реализация db_input () проверяет переменную среды TERM и пытается реализовать различные подсказки лицензионного соглашения для разных терминалов. См. Руководство по debconf по адресу http://www.fifi.org/doc/debconf-doc/tutorial.html . Идея состоит в том, что интерфейс debconf может в конечном итоге использовать дисплей Брайля, если конечный пользователь имеет слабое зрение, и сценарий preinst будет просто работать.

You ' re не должен передавать вывод сценария в интерактивный интерфейс debconf, насколько я понимаю. Он предназначен для потребления человеком и может измениться в любое время (в зависимости от переменных окружающей среды, фазы луны и т. Д.). Вы можете найти в Google неинтерактивный интерфейс debconf .

1
ответ дан 3 December 2019 в 07:11

It's not boolean but select.

You can verify contents of debconf database :

root@workstation:~# debconf-show sun-java6-jre
* shared/accepted-sun-dlj-v1-1: true
  sun-java6-jre/stopthread: true
  sun-java6-jre/jcepolicy:
  shared/error-sun-dlj-v1-1:
* shared/present-sun-dlj-v1-1:
root@workstation:~# 

As you can see on my machine it's already set to true because I manually accepted it during install. If I was to install sun-java6-jre again it would not prompt me to accept the license.

Let's set it to false :

root@workstation:~# echo sun-java6-jre shared/accepted-sun-dlj-v1-1 select false | /usr/bin/debconf-set-selections

Now let's check :

root@workstation:~# debconf-show sun-java6-jre
* shared/accepted-sun-dlj-v1-1: false
  sun-java6-jre/stopthread: true
  sun-java6-jre/jcepolicy:
  shared/error-sun-dlj-v1-1:
* shared/present-sun-dlj-v1-1:
root@workstation:~# 

So Try :

ssh -i keyFile root@hostname "echo sun-java6-jre shared/accepted-sun-dlj-v1-1 select true | /usr/bin/debconf-set-selections && apt-get install -y sun-java6-jre"

Use debconf-show command to troubleshoot.

I suspect when you say

This works fine when executing the script locally.

It's because you installed sun-java6-jre manually at some point.

1
ответ дан 3 December 2019 в 07:11

Since the question has changed here is another answer.

TERM variable is checked as part of sun-java5-jre preinst script (see it here ) . Inside this script /usr/share/debconf/confmodule is used to interact with deconf database and to check whether the license has been set to accepted in the database or not. If not it will call debconf method to present the license to you. Debconf will present it in the way suitable for your environment. This is where TERM comes in. If you have no TERM it should fail over to other methods

So here is an example when license is set to false in debconf (not accepted)

Preparing to replace sun-java6-jre 6.26-1~lffl~oneiric~ppa (using .../sun-java6-jre_6.26-1~lffl~oneiric~ppa_all.deb) ...
debconf: Unable to initialise frontend: Dialog
debconf: (TERM is not set so the dialogue frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: Unable to initialise frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
Configuring sun-java6-jre
-------------------------

Operating System Distributor License for Java v1.1 (DLJ)

Operating System Distributor License for Java version 1.1 (DLJ)

SUN MICROSYSTEMS, INC. ("SUN") IS WILLING TO LICENSE THE JAVA PLATFORM STANDARD
EDITION DEVELOPER KIT ("JDK" - THE "SOFTWARE") TO YOU ONLY UPON THE CONDITION
THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS LICENSE AGREEMENT (THE
"AGREEMENT").  PLEASE READ THE AGREEMENT CAREFULLY.  BY INSTALLING, USING, OR
DISTRIBUTING THIS SOFTWARE, YOU ACCEPT ALL OF THE TERMS OF THE AGREEMENT. 



...................................... CUT .................................
    DLJ v1.1                                                  27APR2006ANS

In order to install this package, you must accept the license terms, the
"Operating System Distributor License for Java" (DLJ), v1.1. Not accepting will
cancel the installation.

Do you accept the DLJ license terms? yes

And here is an example when the license has been approved (set to true in deconf)

 root@workstation:/home/andrey/buildarea# ssh root@localhost "echo 'sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true' | debconf-set-selections && aptitude -y reinstall sun-java6-jre"
root@localhost's password:
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initialising package states...
Writing extended state information...
The following packages will be REINSTALLED:
  sun-java6-jre
0 packages upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 168 not upgraded.
Need to get 0 B/6,381 kB of archives. After unpacking 0 B will be used.
Writing extended state information...
debconf: Unable to initialise frontend: Dialog
debconf: (TERM is not set so the dialogue frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: Unable to initialise frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: Unable to re-open stdin:
(Reading database ... 161723 files and directories currently installed.)
Preparing to replace sun-java6-jre 6.26-1~lffl~oneiric~ppa (using .../sun-java6-jre_6.26-1~lffl~oneiric~ppa_all.deb) ...
debconf: Unable to initialise frontend: Dialog
debconf: (TERM is not set so the dialogue frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: Unable to initialise frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
sun-dlj-v1-1 license has already been accepted
Unpacking replacement sun-java6-jre ...
Processing triggers for shared-mime-info ...
Setting up sun-java6-jre (6.26-1~lffl~oneiric~ppa) ...
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initialising package states...
Writing extended state information...
root@workstation:/home/andrey/buildarea# 

Do you get the same "debconf" messages during install? You can see my experiments and successful installation of sun-java6-jre over SSH here NOTE : When running ssh root@localhost "env" I can't see TERM variable either.

If you want to see what the deb package is doing pre, during, post installation, donwload .deb file :

aptitude download sun-java6-jre

Extract .deb

ar x sun-java6-jre......deb

Extract control.tar.gz and take a look at preinstal and other files. data.tar.gz is the content of the package.

This might not answer your question directly but hopefully will help.

0
ответ дан 3 December 2019 в 07:11

Теги

Похожие вопросы