Automated Deployment of Perforce
TASK
How do I automate deployment of Perforce client programs at 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 provide silent and customizable installations to automate large-scale deployment of client applications. Silent installs use command line options passed to the Perforce installer executable. The command line options are used to:
- Specify the desired user interface level
- Specify which features are installed or removed
- Specify property values used during the installation
- Optionally instruct the installer to generate a log file
Here is an example of a basic command line for a silent install of the Perforce Visual Client (P4V):
p4vinst.exe /v”/qb P4PORT=perforce:1666 P4USER=bruno"
The /v”” passes any options inside the quotes directly to the Windows Installer Engine (msiexec). In the example above, we instruct the installer to use a basic user interface (/qb) and specify values for both P4PORT and P4USER. To produce an installer log file, add "/l+* <filename.log>":
p4vinst.exe /v”/qb /l+* p4vinst.log P4PORT=perforce:1666 P4USER=bruno"
Specifying desired user interface level
The following user interface levels are available:
- /qn - Silent, no user interface.
- /qb - Basic user interface
- /qr - Reduced user interface
- /qf - Full UI (default)
Specifying which features are installed or removed
You can pass additional arguments to specify which features are installed or removed. The syntax for specifying features is as follows:
where ADDLOCAL is the entire list of features to install and REMOVE is the entire list of features to not install or uninstall.
p4vinst.exe /v"/qb ADDLOCAL=ALL REMOVE=P4SCC"Install only P4SCC feature:
p4vinst.exe /v"/qb ADDLOCAL=P4SCC"Uninstall P4SCC feature:
p4vinst.exe /v"/qb REMOVE=P4SCC"Uninstall all features:
p4vinst.exe /v"/qb REMOVE=ALL"
The valid feature names for each installer are:
Perforce Web - P4WEB, P4
p4vinst.exe /v"/qb REBOOT=ReallySuppress ..."but P4EXP will not be guaranteed to work properly until the system has been rebooted.
Specifying values for properties
The basic syntax for assigning property values is:
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).
P4V custom settings
- p4vfeatures.xml: Configures the feature set for P4V (all features enabled).
- basic_p4vfeatures.xml: Enables a minimum set of features.
- p4vdefaults.xml: Configures the default settings for performance preferences and initial application appearance.
- basic_p4vdefaults.xml: Enables a simplified application layout.
- Performance: Defines settings that control the impact of P4V on the Perforce server
- Layout: Enables you to define the features that are visible when P4V is launched, to determine its initial appearance.
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.
@ECHO OFF REM Example batch files showing silent install of REM the Perforce Visual Client (P4V). Install all REM features except P4SCC and create a p4vfeatures.xml REM file that turns off the Connection Wizard. REM Set the installer executable name SET INSTALLERCMD=p4vinst.exe REM Set the arguments we'll pass to msiexec SET MSIARGS=/qb /l+* .\p4vinst.log^ INSTALLDIR=\"%ProgramFiles%\Perforce\"^ P4USER=%UserName%^ P4CLIENT=%UserName%-%ComputerName%^ P4PORT=perforce:1666^ ADDLOCAL=ALL^ REMOVE=P4SCC REM Invoke the installer %INSTALLERCMD% /v"%MSIARGS%" REM Create a feature XML file in the P4VResources directory REM to turn off the P4V Connection Wizard. SET PREFDIR=%ProgramFiles%\Perforce\P4VResources\ SET P4VFEATS=%PrefDir%p4vfeatures.xml echo ^<?xml version="1.0" encoding="UTF-8"?^> > "%P4VFeats%" echo ^<!--perforce-xml-version=1.0--^> >> %P4VFeats% echo ^<FeaturesEnabled varName="FeaturesEnabled"^> >> "%P4VFeats%" echo ^<Visibilility varName="Functionality"^> >> "%P4VFeats%" echo ^<ConnectionWizard^>Off^</ConnectionWizard^> >> "%P4VFeats%" echo ^</Visibilility^> >> "%P4VFeats%" echo ^</FeaturesEnabled^> >> "%P4VFeats%"
Full list of properties:
Common to all productsThe P4Win performance properties are not configurable directly by the installer. They are configured as registry entries under the following registry key:
HKEY_CURRENT_USER\Software\perforce\P4win\Options
The recommended method for configuring the properties is through the use of a registration entries (.reg) file. For example, a p4win.reg file containing the following text:
Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\perforce\P4win\Options] "AUTOPOLLSERVER"="0" "ENABLEREVHISTSHOWINTEGS"="0" "ENABLESUBCHGINTEGFILTER"="0" "EXPANDCHGLISTS"="0" "FETCHALLHIST"="0"can then be sourced by the install batch file that performs the P4Win install as follows:
regedit.exe /S ./p4win.reg
AUTOPOLLICONIC 0 or 1
For better performance: 0
Settings->Options->Perforce Objects->Server, Poll when inactive
AUTOPOLLJOBS 0 or 1
For better performance: 0
Settings->Options->Perforce Objects->Server, Poll for job updates
AUTOPOLLSERVER 0 or 1
For better performance: 0
Settings -> Options, enable AUTOPOLLTIME
AUTOPOLLTIME if AUTOPOLLSERVER=1, poll every N minutes
For better performance: 30 or more if AUTOPOLLSERVER=1
Settings -> Options, Poll server for updates AUTOPOLLTIME minutes
ENABLEREVHISTSHOWINTEGS 0 or 1
For better performance: 0
Settings -> Options, Enable displaying branching history in Revision
History dialog
ENABLESUBCHGINTEGFILTER 0 or 1
For better performance: 0
Settings -> Options, Enable including integrations when filtering
submitted changes
EXPANDCHGLISTS 0 or 1
For better performance: 0
Settings -> Options, Expand pending changelists whenever a file or
job is added
EXPANDFLAG 0 or 1
For better performance: 0
Settings -> Options, Expand Depot to Previous location
FETCHALLCHANGES 0 or 1
For better performance: 0
Settings -> Options, Automatically fetch all submitted changelists
FETCHCHANGECOUNT if FETCHALLCHANGES=0, fetch NNN changelists
For better performance: 100 or less (but not 0) FETCHALLCHANGES=0
Settings -> Options, Automatically fetch last NNN changelists
FETCHALLJOBS 0 or 1
For better performance: 0 Settings -> Options, Display all filtered or unfiltered jobs
FETCHJOBCOUNT if FETCHALLJOBS=0, fetch NNN jobs
For better performance: 100 or less (but not 0) Settings -> Options, Display maximum NNN jobs, selected in jobname order
FETCHALLHIST 0 or 1
For better performance: 0
Settings -> Options, Automatically fetch all revision history records
For better performance: 100 or less (but not 0)
Settings -> Options, Automatically fetch last NNN history records
RELOADONUNCOVER 0 or 1
For better performance: 0
Settings -> Options, Automatically reload pane when it is uncovered
RELOADUNCOVERTIME if RELOADONUNCOVER=1, reload after N minutes
For better performance: 30 or more if RELOADONUNCOVER=1
Settings -> Options, ... reload pane when it is uncovered after
N minutes
SHOWDELETED 0 or 1
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.
The following 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 Perforce Core (Server and Proxy) scripted 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:
- Download perforce.zip from the FTP site.
- Extract the contents of perforce.zip into a directory on your machine.
- In this directory, edit perforce.cfg as required.
- Place the unzipped contents of this directory, including your customized perforce.cfg file, in a folder accessible from a Network Drive or into the root folder of a CD.
- 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 at support@perforce.com.
