Automated Deployment of Perforce

Automating deployment of Perforce client programs for large Windows sites

Info & Tags

Article #:
68
Created:
04/25/07
Modified:
01/09/08

TASK

Automate deployment of Perforce client programs for large Windows sites.


SOLUTION

For releases prior to 2007.3, a scripted installer solution is provided to automate deployment of client applications. Details can be found below.

For releases 2007.3 and later, Perforce installers for Windows offer silent and customizable installations to automate large-scale deployment of client applications. Silent installs are done using command line options passed to the Perforce installer executable. The command line options are used to:
  • Specify desired user interface level
  • Specify which features are installed or removed
  • Specify property values used during the installation
  • Instruct the installer to produce a log file
A basic command line for a silent install of the Perforce Windows Client (P4Win) would look like this:

p4winst.exe /v”/qb P4PORT=perforce:1666 P4USER=bruno” 
The /v”” passes any options in the quotes directly to the msiexec. In this example, the P4PORT and P4USER properties are provided values for this installation. To produce an installer log file, add 
"/l+*v <filename.log>" to the options passed to msiexec. For example:

p4winst.exe /v”/qb /l+*v p4winst.log P4PORT=perforce:1666 P4USER=bruno


Specifying desired user interface level

Included in the arguments passed to msiexec is the desired user interface level. The following user interface levels are available:

/qn - Silent, no user interface.
/qb - Basic user interface 
/qr - Reduced user interface


Specifying which features are installed or removed

When calling the installer executable, you can pass additional arguments to specify which features are installed or removed. 

ADDLOCAL=<feature>,<feature> (or ALL)
        REMOVE=<feature>,<feature> (or ALL)

ADDLOCAL is the entire list of features to install and REMOVE is the entire list of features to not install or uninstall. Examples:

Install all features except P4EXP:
p4winst.exe /v"/qb ADDLOCAL=ALL REMOVE=P4EXP"
Install only P4EXP feature:
p4winst.exe /v"/qb ADDLOCAL=P4EXP"
Uninstall P4EXP feature:
p4winst.exe /v"/qb REMOVE=P4EXP"
Uninstall all feature:
p4winst.exe /v"/qb REMOVE=ALL"

The valid feature names for each installer are:

Perforce Server (perforce.exe) - P4D, P4P. P4
Perforce Visual Client (p4vinst.exe) - P4V, P4MERGE, P4SCC, P4
Perforce Web (p4webinst.exe) - P4WEB, P4
Perforce Windows Client (p4winst.exe) - P4WIN, P4DIFF, P4WINMRG, P4EXP, P4



Specifying values for properties

The basic syntax for assigning property values is PropertyName=PropertyValue where properties are delimited by spaces. Property values containing spaces must be delimited within backslash/double-quote (\") characters. Placing an underscore (_) between property name and the equal sign (=) will only set the property if not already set (not supported by P4Win performance properties).


Batch File Example

The commands for invoking the installer and configuring its arguments and property settings can be placed into a batch file, an example of which is given below.
REM Silent install of Perforce Windows Client (P4Win)
@ECHO OFF
REM Set the installer executable name
SET INSTALLERCMD=p4winst.exe 
REM Set the arguments we'll pass to msiexec
SET MSIARGS=/qb /l+*v .\p4winst.log^
  INSTALLDIR=\"%ProgramFiles%\Perforce\"^
  P4USER=%UserName%^
  P4CLIENT=%UserName%-%ComputerName%^
  P4PORT=perforce:1666
REM Invoke the installer
%INSTALLERCMD% /v"%MSIARGS%"

Full list of properties: 

Common to all products

INSTALLDIR
Path to installation directory.

P4PORT
Host name or IP address and/or port number of Perforce server 
that client applications connect to. A port number only attempts 
to connect to a local server.

P4EDITOR 
Path to editor invoked by those Perforce commands that use forms.

P4USER 
Perforce user to connect as.

P4CLIENT
Perforce client to connect as.

P4MERGE 
Path to application used for merging files.

P4DIFF
Path to application to use for comparing files.

NETUSER 
Name of local system user to run services as if using a network 
location. Must have administrative privileges and rights to log on 
as a service. Required if INSTALLDIR, SERVROOT, PRXYCACHE, 
P4LOG, or P4JOUNAL are set to network location.

NETPASS
Password for NETUSER. Required if INSTALLDIR, SERVROOT, 
PRXYCACHE, P4LOG, or P4JOUNAL are set to network location.
  

Server only

SERVROOT
Path to server installation directory and server root, unless already
set.

SERVPORT
Server port number. Not the same as PRXYPORT or P4WEBPORT.

P4JOURNAL
Path and/or file name of server journal file.

P4LOG
Path and/or file name of server log file.
   

Proxy only

PRXYFORCE
Forces the proxy to be installed. Not installed by default, set to 1 
to install.

PRXYCACHE 
Path to proxy installation directory and proxy cache.

PRXYPORT 
Proxy port number. Not the same as SERVPORT or P4WEBPORT.
PRXYTARGET Computer name or IP address and port number of 
Perforce server that proxy connects to.
  

P4Web only

P4WEBPORT
P4Web client port number. Not the same as PRXYPORT or SERVPORT.

P4WEBMODE 
Select either standard or viewer mode. Standard (-s), Viewer (-v).

P4WEBVIEWER
Select either guest or authenticated viewer mode. 
Guest (-b), authenticated ( -B).

P4WEBP4PORT
Computer name or IP address and/or port number of Perforce server
that P4Web viewer service connects to. A port number only attempts 
to connect to a local server.

P4WEBLOCALONLY 
Controls whether standard mode accepts remote connections, 0 or 1.

P4WEBLOG
Controls whether a log is written, 0 or 1.
  

P4Win performance

The following variables can be used to preconfigure "Settings -> Options" values for the P4Win client program. The default values are appropriate for most sites, but administrators of large sites may want to change the defaults in order to make P4Win clients poll the server less frequently or to request less data from the server during normal use. Note: use of "_=" is not supported on these settings.

AUTOPOLLICONIC       0 or 1
Default value: 0
For better performance: 0
Settings->Options->Perforce Objects->Server, Poll when inactive

AUTOPOLLJOBS         0 or 1
Default value: 0
For better performance: 0
Settings->Options->Perforce Objects->Server, Poll for job updates

AUTOPOLLSERVER       0 or 1
Default value: 1
For better performance: 0
Settings -> Options, enable AUTOPOLLTIME

AUTOPOLLTIME         if AUTOPOLLSERVER=1, poll every N minutes
Default value: 10
For better performance: 30 or more if AUTOPOLLSERVER=1
Settings -> Options, Poll server for updates AUTOPOLLTIME minutes

ENABLEREVHISTSHOWINTEGS  0 or 1
Default value: 1
For better performance: 0
Settings -> Options, Enable displaying branching history in Revision 
History dialog

ENABLESUBCHGINTEGFILTER   0 or 1
Default value: 1
For better performance: 0
Settings -> Options, Enable including integrations when filtering 
submitted changes

EXPANDCHGLISTS       0 or 1
Default value: 1
For better performance: 0
Settings -> Options, Expand pending changelists whenever a file or 
job is added

EXPANDFLAG           0 or 1
Default value: 0
For better performance: 0
Settings -> Options, Expand Depot to Previous location

FETCHALLCHANGES      0 or 1
Default value: 0
For better performance: 0
Settings -> Options, Automatically fetch all submitted changelists

FETCHCHANGECOUNT     if FETCHALLCHANGES=0, fetch NNN changelists
Default value: 100
For better performance: 100 or less (but not 0) FETCHALLCHANGES=0
Settings -> Options, Automatically fetch last NNN changelists

FETCHALLJOBS         0 or 1
Default value: 0
For better performance: 0
Settings -> Options, Display all filtered or unfiltered jobs

FETCHJOBCOUNT        if FETCHALLJOBS=0, fetch NNN jobs
Default value: 100
For better performance: 100 or less (but not 0) 
Settings -> Options, Display maximum NNN jobs, selected in jobname 
order

FETCHALLHIST         0 or 1
Default value: 1
For better performance: 0
Settings -> Options, Automatically fetch all revision history records

FETCHHISTCOUNT       if FETCHALLHIST=0, fetch NNN history records
Default value: 100
For better performance: 100 or less (but not 0) 
Settings -> Options, Automatically fetch last NNN history records

RELOADONUNCOVER      0 or 1
Default value: 0
For better performance: 0
Settings -> Options, Automatically reload pane when it is uncovered

RELOADUNCOVERTIME    if RELOADONUNCOVER=1, reload after N minutes
Default value: 1
For better performance: 30 or more if RELOADONUNCOVER=1
Settings -> Options, ... reload pane when it is uncovered after 
N minutes

SHOWDELETED          0 or 1
Default value: 0
For better performance: 0
Settings -> Options, Show deleted depot files


Pre-2007.3 installers

To assist in automating installation of Perforce client programs across multiple desktops, Perforce provides a scripted version of the Perforce Windows Installer. The scripted version of the installer enables Perforce administrators to standardize options and settings before installation, thereby speeding up the process of deploying Perforce client programs throughout an organization.

The customizable element of the scripted installer is a configuration file named perforce.cfg. The Perforce Administrator edits this file, and places it on a shared network drive along with the expanded contents of the perforce.zip file. Perforce client programs can then be installed by running setup.exe from each desktop. It is important to run setup.exe from the folder in which it resides otherwise it will not be able to find perforce.cfg.

Here are some sample settings from the perforce.cfg file:

INSTTYPE=ClientOnly
(Install only the Perforce client programs, and not the Perforce Server)

INSTMODE=NoPrompt
(Install according to the settings in the configuration file without displaying installation dialogs)

P4PORT=perforce:1666
(Configure a value for the Perforce Server machine and port number)

P4WEBPORT=8080
(Configure a value for the port where P4Web is listening)

Other settings and additional information are available in the comments included within the perforce.cfg file. As of release 2005.2, the P4Win performance variable naming convention has been modified. These details are also embedded within the perforce.cfg file for reference.

The scripted Core installer can be downloaded from ftp://ftp.perforce.com/perforce/r06.2/bin.ntx86/perforce.zip.

The P4Win scripted installer can be downloaded from ftp://ftp.perforce.com/perforce/r06.2/bin.ntx86/p4winst.zip.

The P4V scripted installer can be downloaded from ftp://ftp.perforce.com/perforce/r07.2/bin.ntx86/p4vinst.zip

To use the scripted installer:

  1. Download perforce.zip from the FTP site.
  2. Extract the contents of perforce.zip into a directory on your machine.
  3. In this directory, edit perforce.cfg as required.
  4. Place the unzipped contents of this directory, including your customized perforce.cfg, in a folder accessible from a Network Drive or into the root folder of a CD.
  5. From the network drive or CD, run setup.exe to install Perforce according to the settings you configured in perforce.cfg onto each desktop.

Note: the method to exclude certain binaries from being installed by the scripted installer is to remove those binaries from the directory where the perforce.zip (or p4winst.zip) file has been expanded. For example, if you wish to exclude the P4EXP from the install of P4Win, then unzip the p4winst.zip and remove the P4Exp.dll from the expanded directory prior to running setup.exe.

If you have any questions about the settings in perforce.cfg, please contact Perforce Support.