Для запуска USDownloader на GUI-less (или, как говорят, headless) Linux server (в моем случае - Ubuntu server 8.10) нужны 4 шага, самый сложный из которых - заставить корректно запускаться "урезанную" framebuffer версию иксов - Xvfb.
Итак, по пунктам:
1) - УСТАНОВКА XVFB, WINE и CABEXTRACT -== Устанавливаем Xvfb, wine и cabextract:
~$ sudo apt-get install xvfb wine cabextract
В силу того, что пакет xvfb не был выверен для работы с Ubuntu-server:
https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/294454пока это компенсируется необходимостью поставить еще несколько пакетов:
~$ sudo apt-get install xfs xfonts-scalable xfonts-100dpi
==Запускаем Xvfb
~$ /usr/bin/X11/Xvfb :10.10 -screen 10 800x600x16 -ac -br -kb -c -fbdir /var/tmp/ &
** Здесь могут возникнуть ошибки с дефолтной конфигуацией Xorg (см. выше баг Xvfb) - поэтому привожу работающие у меня файлы конфигурации:$ cat /etc/X11/xorg.conf
# xorg.conf (X.Org X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the xorg.conf manual page.
# (Type "man xorg.conf" at the shell prompt.)
#
# This file is automatically updated on xserver-xorg package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xorg
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command:
# sudo dpkg-reconfigure -phigh xserver-xorg
Section "InputDevice"
Identifier "Generic Keyboard"
Driver "kbd"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "us,ru"
Option "XkbVariant" ",winkeys"
Option "XkbOptions" "grp:caps_toggle,grp_led:scroll"
EndSection
Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
EndSection
Section "Device"
Identifier "Intel Corporation 82845G/GL[Brookdale-G]/GE Chipset Int egrated Graphics Device"
EndSection
Section "Monitor"
Identifier "LG"
EndSection
Section "Screen"
Identifier "Default Screen"
Device "Intel Corporation 82845G/GL[Brookdale-G]/GE Chipset Integrated Graph ics Device"
Monitor "LG"
DefaultDepth 16
SubSection "Display"
Viewport 0 0
Depth 16
Modes "800x600" "640x480"
EndSubSection
EndSection
Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen"
EndSection
$ cat /etc/X11/xserver/SecurityPolicy
version-1
# $Xorg: SecurityPolicy,v 1.3 2000/08/17 19:47:56 cpqbld Exp $
# The site policy fields are interpreted by the XC-QUERY-SECURITY-1
# authorization protocol. The values are arbitrary and site-specific.
# Refer to the Security Extension Specification for the usage of the policies.
#sitepolicy A
#sitepolicy B
#sitepolicy C
# Property access rules:
# property <property> <window> <permissions>
# <window> ::= any | root | <propertyselector>
# <propertyselector> ::= <property> | <property>=<value>
# <permissions> :== [ <operation> | <action> | <space> ]*
# <operation> :== r | w | d
# r read
# w write
# d delete
# <action> :== a | i | e
# a allow
# i ignore
# e error
# Allow reading of application resources, but not writing.
property RESOURCE_MANAGER root ar iw
property SCREEN_RESOURCES root ar iw
# Ignore attempts to use cut buffers. Giving errors causes apps to crash,
# and allowing access may give away too much information.
property CUT_BUFFER0 root irw
property CUT_BUFFER1 root irw
property CUT_BUFFER2 root irw
property CUT_BUFFER3 root irw
property CUT_BUFFER4 root irw
property CUT_BUFFER5 root irw
property CUT_BUFFER6 root irw
property CUT_BUFFER7 root irw
# If you are using Motif, you probably want these.
property _MOTIF_DEFAULT_BINDINGS root ar iw
property _MOTIF_DRAG_WINDOW root ar iw
property _MOTIF_DRAG_TARGETS any ar iw
property _MOTIF_DRAG_ATOMS any ar iw
property _MOTIF_DRAG_ATOM_PAIRS any ar iw
# If you are running CDE you also need these
property _MOTIF_WM_INFO root arw
property TT_SESSION root irw
property WM_ICON_SIZE root irw
property "SDT Pixel Set" any irw
# The next two rules let xwininfo -tree work when untrusted.
property WM_NAME any ar
# Allow read of WM_CLASS, but only for windows with WM_NAME.
# This might be more restrictive than necessary, but demonstrates
# the <required property> facility, and is also an attempt to
# say "top level windows only."
property WM_CLASS WM_NAME ar
# These next three let xlsclients work untrusted. Think carefully
# before including these; giving away the client machine name and command
# may be exposing too much.
property WM_STATE WM_NAME ar
property WM_CLIENT_MACHINE WM_NAME ar
property WM_COMMAND WM_NAME ar
# To let untrusted clients use the standard colormaps created by
# xstdcmap, include these lines.
property RGB_DEFAULT_MAP root ar
property RGB_BEST_MAP root ar
property RGB_RED_MAP root ar
property RGB_GREEN_MAP root ar
property RGB_BLUE_MAP root ar
property RGB_GRAY_MAP root ar
# To let untrusted clients use the color management database created
# by xcmsdb, include these lines.
property XDCCC_LINEAR_RGB_CORRECTION root ar
property XDCCC_LINEAR_RGB_MATRICES root ar
property XDCCC_GRAY_SCREENWHITEPOINT root ar
property XDCCC_GRAY_CORRECTION root ar
# To let untrusted clients use the overlay visuals that many vendors
# support, include this line.
property SERVER_OVERLAY_VISUALS root ar
== Устанавливаем текущий дисплей
$ export DISPLAY=:10.10
проверяем
$ echo $DISPLAY
==Добиваемся корректной работы Xvfb (как минимум - wine-приложения не завершаются с критической ошибкой).
В моем случае - выдаваемые некритичные ошибки Xvfb и wine (типа недоступных шрифтов и т.п.) не вызывают падения USDownloader
Для проверки, запускаем, например
$ wine notepad.exe &
Проверяем
$ ps -C notepad.exe
2) - УСТАНОВКА IES4LINUX -Следуем инструкциям отсюда (в принципе, достаточен только шаг №6)
http://www.tatanka.com.br/ies4linux/page/Installation:Ubuntu
3) - УСТАНОВКА WINDOWS SCRIPTING HOST (запуск .VBS) -== Загружаем скрипт автоматической доустановки в wine различных компонентов windozz (спасибо подвижничеству Dan Kegel, dank@kegel.com)
http://kegel.com/wine/winetricksПравим скрипт - убираем с помощью переключателя /Q все выскакивающие в процессе установки окна "Accept license terms" и т.п.:
было>
try $WINE "$WINETRICKS_CACHE"/vc6redistsetup_enu.exe "/T:`$WINE winepath -w "$WINETRICKS_TMP"`" /c $WINETRICKS_QUIET
стало>
try $WINE "$WINETRICKS_CACHE"/vc6redistsetup_enu.exe "/T:`$WINE winepath -w "$WINETRICKS_TMP"`" /c /Q
было>
$WINE "$WINETRICKS_CACHE"/vcredist.exe || true
стало>
$WINE "$WINETRICKS_CACHE"/vcredist.exe /Q || true
было>
try $WINE "$WINETRICKS_CACHE"/WindowsXP-Windows2000-Script56-KB917344-x86-enu.exe $WINETRICKS_QUIET
стало>
try $WINE "$WINETRICKS_CACHE"/WindowsXP-Windows2000-Script56-KB917344-x86-enu.exe /Q
== Устанавливаем Windows Scripting Host (необходим для запуска скриптов .vbs в USD)
~$ ./winetricks -v wsh56
4) - УСТАНОВКА И НАСТРОЙКА USDownloader -== Загружаем актуальную portable сборку USD от blackmanos (это придется делать в браузере, т.к. сборка выложена на файлообменниках)
http://forum.ru-board.com/topic.cgi?forum=5&topic=27428&start=20#19Распаковывыем сборку в windoze, переносим содержимое Linux в отдельную папку (у меня это ~/.wine/drive_c/usd)
== Создаем "Windows диск" u:\ в виде ссылки на папку, куда USD будет сохранять закачанные файлы (в моем случае - это папка /mm/usd):
~$ cd ~/.wine/dosdevices
~$ ln -s -T /mm/usd u:
== Правим соответствующие пути в файле USDownloader.ini (заодно поменяем дефолтный язык на английский - чтобы проще было логи читать)
[Main]
SelectLang=1
Language=USDownloader.eng.lng
SaveTo=u:\
SaveToItems=u:\
...
DefaultSaveToFolder=u:\
== Там же (USDownloader.ini) прописываем запуск web-сервера USD
[WebServer]
Enabled=1
Address=0.0.0.0
Port=8088
Login=YOURLOGIN
Password=YOURPASSWORD
Form.AddLink.Width=400
Form.AddLink.URL.Height=200
Form.AddLink.Descr.Height=100
YOURLOGIN и YOURPASSWORD, естественно, прописываем свои. Не забудьте открыть в firewall указанный вами здесь порт (8088) на подключения извне (к нему вы и будете коннектиться браузером для управления USD).
== Запускаем USDownloader
~$ wine C:\\usd\\USDownloader.exe &
Проверяем, появился ли такой процесс в системе:
~$ ps -C USDownloader.exe
== Заходим браузером на сервер USD
http://your.server.ip.address:8088Проверяем работу - ставим закачку в USD, параллельно смотрим лог:
~$ tail -f ~/.wine/drive_c/usd/USDownloader.log
Закачка с depositfiles работает - похоже, что скрипты vbs-автоматизации выполняются корректно.
Вроде бы, все.