|
For quite a while there has been an option to create your own
custom installer for Perforce deployments (including automation). This can
be particularly useful for larger sites with lots of new users coming along
regularly.
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.
One of the annoyances with this approach is that you have to expand the .zip
file and put things on a network drive. It is not easy to do this sort of thing
within a single executable for example (which makes it hard to put on your
intranet and get users to double click).
Well, having played around with various installers and options, I have
discovered a fairly simple way of doing this via a self extracting executable
(SFX), and the open source 7-Zip program.
Instructions
Create a directory structure:
- some root dir
- 7-zip - contains a batch file, a couple of config files and
perforce.cfg - see below for contents.
- p4winst - contains expanded
p4winst.zip (without the perforce.cfg)
- p4vinst - contains expanded
p4vinst.zip (without the perforce.cfg)
Currently (as of 2007.2) the perforce.cfg file is the same for both P4Win and
P4V.
You need to get a couple of files from 7-zip.org/download.html
Edit perforce.cfg to customize for your installation.
Create a p4winst.conf and p4v.conf (which must both be UTF-8 - Notepad can save
this format, as can Notepad++ or other editors) in that directory.
Run make_installers.bat from the command line in the
appropriate directory and check that the following are created (which you can
put on an intranet or whatever):
You can then send your users a single exectuable which unzips itself and
automatically runs the perforce setup.exe with the included perforce.cfg - QED!
make_installers.bat
This contains something like the following:
:: Batch file to package up P4Win using .zip file and the 7-Zip freely available
:: Zip program (which can create SFX - Self Extracting Archives).
@echo off
:: May need to customize the following
set ZIP_DIR="d:\apps\7-zip"
call :make_install p4winst
call :make_install p4vinst
goto :exit
:make_install
set INSTALLER=%1
:: First create new clean versions of the zip files (including current directory version of perforce.cfg in preference)
if exist %INSTALLER%.7z del %INSTALLER%.7z
if exist %INSTALLER%.exe del %INSTALLER%.exe
%ZIP_DIR%\7z a %INSTALLER%.7z ..\%INSTALLER%\* perforce.cfg
:: Copy SFX file plus config file plus zipped installer into a single SFX .exe
copy /b %ZIP_DIR%\7zsd.sfx + %INSTALLER%.conf + %INSTALLER%.7z %INSTALLER%.exe
if not errorlevel 1 goto :EOF
if exist %INSTALLER%.exe goto :EOF
echo *** ERROR: failed to create %INSTALLER%.exe
goto :exit
:exit
p4winst.conf (and p4vinst.conf)
These are simple UTF8 format file with contents similar to:
;!@Install@!UTF-8!
Title="P4Win Custom Installer"
BeginPrompt="Do you want to install P4Win?"
RunProgram="setup.exe"
;!@InstallEnd@!
|