Developers Club geek daily blog

6 years, 10 months ago
Still more recently I watching, as experts of IT everywhere tr to implement open a software, and the manual resisting and demanding to use products of Microsoft. Counterfeit products, but nevertheless. Now I even more often sees reverse: the manual demanded implementation of an open software, and employees of IT of departments beaten out the extension of the budget for purchase of licenses. The reasons of the chang sights of a manual was clear are and regular spot-checks of the police, not allow to use stolen, and successful implementations of an open software in other companies, and possibility to save the considerable totals. I speaks now, first of all, about popular changeover of Microsoft Office with Outlook’ом in a set on OpenOffice.org and Mozilla Thunderbird.

But in what the reason of lowering of interest to an open software from IT of experts? Attending. If the manual on planyorke for an hour till the end of the working day making the decision demand change of adjustments of a software at all workstations to the next morning, in a homogeneous environment of a software from MS it are enough to administrator to launch equipment «Control of group policies», to make some klikov and to go home. The software not from Microsoft normally are not adjust by policies … And the administrator "running" on hundred workstations. And houses the mum \wife \children \dog again in a corner spoiling (necessary to underline). Or here, for example, update of Thunderbird. WSUS’ом will not be download, on workstations the will not be scatter also will not be install. It are thus updat every month.

It are good, if the administrator liked to invent bicycles. It are even more best, if are able. Then under all unrenewable and not provisionable crutches was fenc and it all are shaky, but costed. While the administrator will not leave. Then normally with a roar fell.

It are still healthy, when there are a fighter. Young and with the strong feet. The regulated task are wr to the fighter, and the fighter are more its fulfilled, replac with itself both GPO, and WSUS, and set of other useful pieces.

It not our methods. We wanted rational usage of work forces, standardization of an infrastructure and the transparent business processes of IT. Therefore adjustments and updates we will spread on a centralized basis. By means of WPKG. It are strange that on Habré there were no article about it.


WPKG are a WSH script, a dial-up of configuration files in a format of xml and the client service which is periodically fulfill this most script. It are possible and to manage without a client part, but I will describe the typical decision.

Object of implementation – the company with three offices and 112 workstations. From them 6 worked under control the 64-yokh of bit Windows 7, 4 under control of Windows XP, 63 under control of Windows Vista and remain under control of Windows 7. At each office there are a server with WSUS onboard – SRV-1, SRV-2, SRV-3. Here near to WSUS’ом also we will fence WPKG.

First of all sozdayom on each server the directory of WPKG and an appropriate network folder of WPKG$ with access on reading for all. We downloaded wpkg.org/files/stable/1.3.x/wpkg-1.3.0-bin.zip and we unpacked in aforementioned directories. In the same directories I creating subdirectories of software and client. The first software for distribution kits which we will install and update – UltraVNC, Thunderbird and OpenOffice. Second WPKG for a client part.

Client of WPKG

The client part of WPKG are the Windows service launch at each loading of the computer and fulfill wpkg.js with a network folder, specif in adjustments. All are extreme simple.

The setup package of the client are download from here and kladyom in the appropriate directory — client. There it are necessary to suppose a file of a configuration of the client — settings.xml. But at first it should be ma. For this purpose it are necessary to install the client, to launch C:\Program Files\wpkg\wpkginst.exe, to fill fields and to push the Export settings button.

image

At me it turning out about such:
<? xml version = "1.0" encoding = "UTF-8" ?> 
<configuration>
<file> \\SRV-1\WPKG$\\wpkg.js </file> 
<net-use-machine-account>YES</net-use-machine-account> 
SYSTEM <exec-user> </exec-user> 
<exec-password /> 
<parameters>/synchronize/nonotify/quiet  </parameters> 
YES <silent> </silent> 
<pre-action /> 
<post-action /> 
NO <show-GUI> </show-GUI> 
<logon-delay> 0 </logon-delay> 
  WPKG Software Deployment <logon-message-title> </logon-message-title> 
<logon-message-logo-picture /> 
      WPKG is installing applications and applying settings <logon-message-1>... </logon-message-1> 
<logon-message-2> of Please wait,       do not restart or power off your computer... </logon-message-2> 
<script-variable name = "SOFTWARE"> \\SRV-1\WPKG$\\software </script-variable> 
normal <priority> </priority> 
<stop-service-after-done>NO</stop-service-after-done> 
NO <laptop-mode> </laptop-mode> 
<server-connecting-method>standard</server-connecting-method> 
<server-connecting-ip /> 
<server-connecting-timeout>3</server-connecting-timeout> 
<server-connecting-script-timeout>3</server-connecting-script-timeout> 
<server-connecting-script-file /> 
<log-file /> 
NO <run-on-shutdown> </run-on-shutdown> 
<shutdown-delay> 10 </shutdown-delay> 
<logon-interrupt-password>OJzMGd0PqAMI2Vc=</logon-interrupt-password> 
<repeat-count-on-failure>0</repeat-count-on-failure> 
</configuration>
 


Parameters – file and script-variable was interesting here. In the first it are specif that the client part should launch. Second — are a variable of the client, in our case stor a path to a repository of a software. It are useful to us later, when writing a configuration for the WPKG server. While it are necessary to create still two copies of a configuration, for SRV-2 and SRV-3 and to correct in them parameters of file and script-variable in appropriate way.

Client part on workstations we will install through GPO. That the client were install with our adjustments, it is necessary to create transformation of a setup package and to add in the table of Properties a line of SETTINGSFILE with value \\SRV-1\WPKG$\\client\settings.xml. To make it it are possible by means of Orca. Naturally, for each server it are necessary to make the file of transformation and to suppose there, in the directory of client.

Distribution kits

Let's prepare a dial-up of distribution kits. In the directory of software I creating such structure of directories:
image

Thunderbird

In the directory of Thunderbird I creating still two subdirectories – configuration and extensions. In a root kladyom of Thunderbird Setup 9.0.1.exe. In configuration files of all.js and autoconf.cfg (to esteem about it it are possible here). Extensions of Thunderbird in extensions need to be put the unpack. It are possible to unpack the archiver xpi, but I doing not become zamorachivatsya and simply copying folders from the profile — C:\Users\%USERNAME%\AppData\Roaming\Thunderbird\Profiles\abc1defg.default\extensions.

OpenOffice

We launched setting of OpenOffice, zhdyom while the installer will unpack files in software\Std\all\OpenOffice, we completed setting. We again need Orca to disaccustom a setup package to demand start setup.exe. We opened openofficeorg33.msi, we found the table of LaunchCondition and we deleted in it a line contain a condition of SETUP_USED.

VNC

In software\Std\x86\VNC kladyom 32 bit version of the distribution kit, in x64, accordingly, the 64-yokh the bit. In both the directory kladyom uvnc.inf and ultravnc.ini. The first can be receiv, ha launch setting with key/saveinf, but it are primitive:

[Setup]
Lang=en
Dir=C:\Program Files\UltraVNC
Group=UltraVNC
NoIcons=0
SetupType=server_silent
Components=ultravnc_server_s
Tasks=installservice,startservice


– result of adjustment of already install UltraVNC, it are possible to take second in C:\Program Files\UltraVNC.

WPKG server

Now it were necessary to adjust WPKG. For this purpose there was three cores of a file – host.xml, profiles.xml and packages.xml, describ a coma to install what to install and how to install.

At start on client side of WPKG searched for a name of a workstation on whom it are triggered, in a file hosts.xml. In a name the regular expressions was support. In moyom a case names was explicitly register in a file the 64-yokh of bit workstations and a template for all remaining.

<host name = "WKS-088" profile-id = "StdX64" />
<host name = ". +" profile-id = "StdX86" />


Ha f in host.xml a name of a workstation, WPKG received a name of a profile of setting for this workstation. Descriptions of profiles was stor in profiles.xml. In a profile packets for setting and dependence on other profiles was enumerat. For example: A profile for a workstation of WKS-088 – StdX64. StdX64 depended on a profile of Std. Therefore at first on WKS-088 all packets from a profile of Std, and then only from StdX64 will be install.

<profile id = "Std">
<package package-id = "Thunderbird" />
<package package-id = "Lightning" />
<package package-id = "MinTrayR" />
<package package-id = "OpenOffice" />
</profile>
 
<profile id = "StdX64">
 <depends profile-id = "Std" />
<package package-id = "VNCx64" />
</profile>


Packets was describ in packages.xml. Each packet – whether are a dial-up of instructions for check are install by a software, for setting of a software, for update of a software and for deleting of a software. Vozmyom for an example a packet Lightning describ setting of the extension for Thunderbird:

<package
    id = "Lightning"
    name = "Lightning"
    revision = "2012.01.10"
    reboot = "false"
    priority = "0">
 
    <variable name = "version" value = "1.1" />
 
    <depends package-id = "Thunderbird" />
 
    <check type = "file" condition = "exists" path = "% PROGRAMFILES %\Mozilla Thunderbird\extensions\{ e2fda1a4-762b-4020-b5ad-a41df1933103 }\\install.rdf" />
 
    <install cmd = '% COMSPEC % /       C xcopy/Q/I/E/Y/V/Z "%SOFTWARE %\Std\all\Thunderbird\extensions\{ e2fda1a4-762b-4020-b5ad-a41df1933103 }" " %PROGRAMFILES %\Mozilla Thunderbird\extensions\{ e2fda1a4-762b-4020-b5ad-a41df1933103 }"' />
 
    <upgrade cmd = '% COMSPEC % /       C xcopy/Q/I/E/Y/V/Z "%SOFTWARE %\Std\all\Thunderbird\extensions\{ e2fda1a4-762b-4020-b5ad-a41df1933103 }" " %PROGRAMFILES %\Mozilla Thunderbird\extensions\{ e2fda1a4-762b-4020-b5ad-a41df1933103 }"' />
 
    <remove cmd = '% COMSPEC % /   C rmdir/S/Q " %PROGRAMFILES %\Mozilla Thunderbird\extensions\{ e2fda1a4-762b-4020-b5ad-a41df1933103 }"' />
  </package>


The packet had title contain identifier of a packet, a name, audit and a priority. The identifier of a packet are us in a configuration of WPKG, for communication of a packet with a profile and instructions of dependences between packets. The name of a packet are us for an output of messages in the event log of Windows. WPKG processed packets as the specif priority. It are not recommended to use a priority, it are more best to use dependences. For instructions of audit of a packet it are possible to use some formats: a simple number format – 1, 2, 3 etc., a format with points – 1.1, 2.1.4, 3.200.3987 etc., a format tsifrobukvenny — 1.2RC1, 1.5I32, 2.73M24, 1.65.b etc., but I deciding to use date in a format – YYYY.MM.DD. In my opinion, so more simply and more reliably. WPKG checked the list of packets for the g profile with the list with the last start. If in the list there were a new packet, instructions of check of this packet sequentially was carr out. If any of them doing not find out the install applications also instructions of install sequentially was carr out. If from the list the packet instructions of remove of this packet was carr out fading. If audit changing, instructions of upgrade sequentially was execut.

Packets, as well as profiles, could depend from each other. This dependence are defin by the directive of depends. In our example the packet of Lightning will not be install, Thunderbird are not install yet.

In instructions there was variables, obramlyonny percent signs (%). It could be variable surroundings of system, variables of a client part of WPKG (for example, variable %SOFTWARE % were defin by us in settings.xml) and the variables describ in files of a configuration. Last was describ by the directive of variable.

The complete files of a configuration of working system:

host.xml

<? xml version = "1.0" encoding = "UTF-8"?>
 
<hosts:wpkg xmlns:hosts = "www.wpkg.org/hosts" xmlns:wpkg = "www.wpkg.org/wpkg"
xmlns:xsi = "www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation = "www.wpkg.org/hosts xsd/hosts.xsd ">
 
<host name = "WKS-088" profile-id = "StdX64" />
<host name = "WKS-109" profile-id = "StdX64" />
<host name = "WKS-112" profile-id = "StdX64" />
<host name = "WKS-114" profile-id = "StdX64" />
<host name = "WKS-115" profile-id = "StdX64" />
<host name = "WKS-121" profile-id = "StdX64" />
 
<host name = ". +" profile-id = "StdX86" />
 
</hosts:wpkg>
 

To download

profiles.xml

<? xml version = "1.0" encoding = "UTF-8"?>
<profiles:profiles xmlns:profiles = "www.wpkg.org/profiles"
xmlns:wpkg = "www.wpkg.org/wpkg" xmlns:xsi = "www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation = "www.wpkg.org/profiles xsd/profiles.xsd ">
<profile id = "Std">
<package package-id = "Thunderbird" />
<package package-id = "Lightning" />
<package package-id = "MinTrayR" />
<package package-id = "OpenOffice" />
</profile>
 
<profile id = "StdX86">
        <depends profile-id = "Std" />
       <package package-id = "VNCx86" />
</profile>
 
<profile id = "StdX64">
        <depends profile-id = "Std" />
       <package package-id = "VNCx64" />
</profile>
</profiles:profiles>
 

To download

packages.xml

<? xml version = "1.0" encoding = "UTF-8"?>
<packages:packages xmlns:packages = "www.wpkg.org/packages"
xmlns:wpkg = "www.wpkg.org/wpkg" xmlns:xsi = "www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation = "www.wpkg.org/packages xsd/packages.xsd">
 
  <package
    id = "Thunderbird"
    name =  "Mozilla Thunderbird"
    revision = "2012.01.10"
    reboot = "false"
    priority = "0">
 
    <variable name = "version" value = "9.0.1" />
    <variable name = "architecture" value = "x86" />
    <variable name = "locale" value = "ru" />
 
    <check type = "uninstall" condition = "exists" path = "  Mozilla Thunderbird %version % (%architecture % %locale %)" />
 
    <install cmd =' "% SOFTWARE %\Std\all\Thunderbird\Thunderbird Setup %version%.exe" - ms' />
 
    <install cmd = '% COMSPEC % /     C copy/v/y/z %SOFTWARE %\Std\all\Thunderbird\configuration\all.js  " %PROGRAMFILES %\Mozilla Thunderbird\defaults\pref \"' />
    <install cmd = '% COMSPEC % /     C copy/v/y/z %SOFTWARE %\Std\all\Thunderbird\configuration\autoconf.cfg  " %PROGRAMFILES %\Mozilla Thunderbird \"' />
 
    <upgrade cmd ='taskkill/F/IM    thunderbird.exe'>
      <exit code = "0" />
      <exit code = "128" />
    </upgrade>
 
    <upgrade cmd =' "% SOFTWARE %\thunderbird\Thunderbird Setup %version%.exe" - ms' />
 
    <upgrade cmd = '% COMSPEC % /     C copy/v/y/z %SOFTWARE %\Std\all\Thunderbird\configuration\all.js  " %PROGRAMFILES %\Mozilla Thunderbird\defaults\pref \"' />
    <upgrade cmd = '% COMSPEC % /     C copy/v/y/z %SOFTWARE %\Std\all\Thunderbird\configuration\autoconf.cfg  " %PROGRAMFILES %\Mozilla Thunderbird \"' />
 
    <remove cmd ='taskkill/F/IM    thunderbird.exe'>
      <exit code = "0" />
      <exit code = "128" />
    </remove>
 
    <remove cmd =' % COMSPEC % /  C if exist  of "%PROGRAMFILES %\Mozilla Thunderbird\uninstall\helper.exe"  of "%PROGRAMFILES %\Mozilla Thunderbird\uninstall\helper.exe" - ms' />
  </package>
 
  <package
    id = "Lightning"
    name = "Lightning"
    revision = "2012.01.10"
    reboot = "false"
    priority = "0">
 
    <variable name = "version" value = "1.1" />
 
    <depends package-id = "Thunderbird" />
 
    <check type = "file" condition = "exists" path = "% PROGRAMFILES %\Mozilla Thunderbird\extensions\{ e2fda1a4-762b-4020-b5ad-a41df1933103 }\\install.rdf" />
 
    <install cmd = '% COMSPEC % /       C xcopy/Q/I/E/Y/V/Z "%SOFTWARE %\Std\all\Thunderbird\extensions\{ e2fda1a4-762b-4020-b5ad-a41df1933103 }" " %PROGRAMFILES %\Mozilla Thunderbird\extensions\{ e2fda1a4-762b-4020-b5ad-a41df1933103 }"' />
 
    <upgrade cmd = '% COMSPEC % /       C xcopy/Q/I/E/Y/V/Z "%SOFTWARE %\Std\all\Thunderbird\extensions\{ e2fda1a4-762b-4020-b5ad-a41df1933103 }" " %PROGRAMFILES %\Mozilla Thunderbird\extensions\{ e2fda1a4-762b-4020-b5ad-a41df1933103 }"' />
 
    <remove cmd = '% COMSPEC % /   C rmdir/S/Q " %PROGRAMFILES %\Mozilla Thunderbird\extensions\{ e2fda1a4-762b-4020-b5ad-a41df1933103 }"' />
  </package>
 
  <package
    id = "MinTrayR"
    name =  "MinimizeToTray revived"
    revision = "2012.01.10"
    reboot = "false"
    priority = "0">
 
    <variable name = "version" value = "1.0" />
 
    <depends package-id = "Thunderbird" />
 
    <check type = "file" condition = "exists" path = "% PROGRAMFILES %\Mozilla Thunderbird\extensions\mintrayr@tn123.ath.cx\install.rdf" />
 
    <install cmd = '% COMSPEC % /       C xcopy/Q/I/E/Y/V/Z "%SOFTWARE %\Std\all\Thunderbird\extensions\mintrayr@tn123.ath.cx"  "%PROGRAMFILES %\Mozilla Thunderbird\extensions\mintrayr@tn123.ath.cx"' />
 
    <upgrade cmd = '% COMSPEC % /       C xcopy/Q/I/E/Y/V/Z "%SOFTWARE %\Std\all\Thunderbird\extensions\mintrayr@tn123.ath.cx"  "%PROGRAMFILES %\Mozilla Thunderbird\extensions\mintrayr@tn123.ath.cx"' />
 
    <remove cmd = '% COMSPEC % /     "%PROGRAMFILES %\Mozilla Thunderbird\extensions\mintrayr@tn123.ath.cx" C rmdir/S/Q' />
  </package>
 
  <package
    id = "OpenOffice"
    name = "OpenOffice.org 3.3"
    revision = "2012.01.11"
    reboot = "false"
    priority = "0">
 
    <variable name = "version" value = "3.3.9567.500" />
    <variable name = "code" value = "{ 4218E1CD-CDB6-448C-8036-2871403BDE57 }" />
 
    <check type = "file" condition = "versionequalto" path = "% PROGRAMFILES %\OpenOffice.org 3\program\soffice.exe" value = "% version %" />
 
    <install cmd = '% COMSPEC % /  C if exist "%PROGRAMFILES %\OpenOffice.org 3\program\soffice.exe"    msiexec/qn/x %code %' />
    <install cmd ='msiexec/qn/i    "%SOFTWARE %\Std\all\OpenOffice\openofficeorg33.msi"   ALLUSERS=1 ADDLOCAL=ALL REMOVE=gm_o_Quickstart, gm_o_Onlineupdate' />
    <install cmd = '% COMSPEC % /     C copy/v/y/z %SOFTWARE %\Std\all\OpenOffice\bootstrap.ini  "%PROGRAMFILES %\OpenOffice.org 3\program \"' />
 
    <upgrade cmd ='msiexec/qn/i    "%SOFTWARE %\Std\all\OpenOffice\openofficeorg33.msi"   ALLUSERS=1 ADDLOCAL=ALL REMOVE=gm_o_Quickstart, gm_o_Onlineupdate' />
    <upgrade cmd = '% COMSPEC % /     C copy/v/y/z %SOFTWARE %\Std\all\OpenOffice\bootstrap.ini  "%PROGRAMFILES %\OpenOffice.org 3\program \"' />
 
    <remove cmd ='msiexec/qn/x %code    %' />
  </package>
 
  <package id =  name "VNCx86" = " Ultra VNC (x86)" revision = "2012.01.11" priority = "0">
    <variable name = "version" value = "1.0.9.6" />
 
    <check type = "file" condition = "versionequalto" path = "% PROGRAMFILES %\UltraVNC\winvnc.exe" value = "% version %" />
 
    <install cmd = '% SOFTWARE  %\Std\x86\vnc\UltraVNC_1.0.9.6.1_Setup.exe/verysilent/loadinf = "% SOFTWARE %\Std\x86\vnc\uvnc.inf"' />
    <install cmd = '% COMSPEC % /   C copy/Y %SOFTWARE %\Std\x86\vnc\ultravnc.ini "%PROGRAMFILES %\UltraVNC \"' />
 
    <upgrade cmd ='net stop uvnc_service   '>
      <exit code = '0' />
      <exit code = '2' />
    </upgrade>
    <upgrade cmd ='sc delete uvnc_service   ' />
    <upgrade cmd = '% SOFTWARE  %\Std\x86\vnc\UltraVNC_1.0.9.6.1_Setup.exe/verysilent/loadinf = "% SOFTWARE %\Std\x86\vnc\uvnc.inf"' />
    <upgrade cmd = '% COMSPEC % /   C copy/Y %SOFTWARE %\Std\x86\vnc\ultravnc.ini "%PROGRAMFILES %\UltraVNC \"' />
 
    <remove cmd ='net stop uvnc_service   '>
      <exit code = '0' />
      <exit code = '2' />
    </remove>
    <remove cmd ='sc delete uvnc_service   ' />
    <remove cmd = '"% PROGRAMFILES %\UltraVNC\unins000.exe" / verysilent/norestart' />
    <remove cmd = '% COMSPEC % /    "%PROGRAMFILES %\UltraVNC" C rmdir/S/Q' />
  </package>
 
  <package id =  name "VNCx64" = " Ultra VNC (x64)" revision = "2012.01.11" priority = "0">
    <variable name = "version" value = "1.0.9.6" />
 
    <check type = "file" condition = "versionequalto" path = "% PROGRAMFILES %\UltraVNC\winvnc.exe" value = "% version %" />
 
    <install cmd = '% SOFTWARE  %\Std\x64\vnc\UltraVNC_1.0.9.6.1_x64_Setup.exe/verysilent/loadinf = "% SOFTWARE %\Std\x64\vnc\uvnc.inf"' />
    <install cmd = '% COMSPEC % /   C copy/Y %SOFTWARE %\Std\x64\vnc\ultravnc.ini "%PROGRAMFILES %\UltraVNC \"' />
 
    <upgrade cmd ='net stop uvnc_service   '>
      <exit code = '0' />
      <exit code = '2' />
    </upgrade>
    <upgrade cmd ='sc delete uvnc_service   ' />
    <upgrade cmd = '% SOFTWARE  %\Std\x64\vnc\UltraVNC_1.0.9.6.1_x64_Setup.exe/verysilent/loadinf = "% SOFTWARE %\Std\x64\vnc\uvnc.inf"' />
    <upgrade cmd = '% COMSPEC % /   C copy/Y %SOFTWARE %\Std\x64\vnc\ultravnc.ini "%PROGRAMFILES %\UltraVNC \"' />
 
    <remove cmd ='net stop uvnc_service   '>
      <exit code = '0' />
      <exit code = '2' />
    </remove>
    <remove cmd ='sc delete uvnc_service   ' />
    <remove cmd = '"% PROGRAMFILES %\UltraVNC\unins000.exe" / verysilent/norestart' />
    <remove cmd = '% COMSPEC % /    "%PROGRAMFILES %\UltraVNC" C rmdir/S/Q' />
  </package>
</packages:packages>

To download

All packets t by me with a site wpkg.org. But are more their easily and independently to write.

Also problems, in case of them origin was easily diagnos and solv. In the course of operation of WPKG registered events in the event log of Windows and vedyot a broad gull in %SYSTEMROOT %\System32\wpkg.xml

The system administrator needed to download in time only in the directory of software fresh versions of a software and to supervise the exact operation of packets.

This article is a translation of the original post at habrahabr.ru/post/136314/
If you have any questions regarding the material covered in the article above, please, contact the original author of the post.
If you have any complaints about this article or you want this article to be deleted, please, drop an email here: sysmagazine.com@gmail.com.

We believe that the knowledge, which is available at the most popular Russian IT blog habrahabr.ru, should be accessed by everyone, even though it is poorly translated.
Shared knowledge makes the world better.
Best wishes.

comments powered by Disqus