12.13 Sharing Triggers Between UNIX and Windows

You can define triggers that fire correctly on both UNIX and Windows computers. The following sections describe two techniques. With one, you use different pathnames or different scripts; with the other, you use the same script for both platforms.

Using Different Pathnames or Different Scripts

To define a trigger that fires on UNIX, Windows, or both, and that uses different pathnames to point to the trigger scripts, use the -execunix and -execwin options with the mktrtype command. These options behave the same as -exec when fired on the appropriate platform (UNIX or Windows, respectively). On the other platform, they do nothing. This technique allows a single trigger type to use different paths for the same script or to use completely different scripts on UNIX and Windows computers. For example:

cleartool mktrtype -element -all -nc -preop checkin ^
-execunix
/public/scripts/precheckin.sh -execwin \\neon\scripts\precheckin.bat ^
pre_ci_trig

On UNIX, only the script precheckin.sh runs. On Windows, only precheckin.bat runs.

To prevent users on a new platform from bypassing the trigger process, triggers that specify only -execunix always fail on Windows. Likewise, triggers that specify only -execwin fail on UNIX.

Using the Same Script

To use the same trigger script on both Windows and UNIX platforms, you must use a batch command interpreter that runs on both operating systems. For this purpose, ClearCase includes the ccperl program. On Windows, ccperl is a version of the Perl program available on UNIX.

The following mktrtype command creates sample trigger type pre_ci_trig and names precheckin.pl as the executable trigger script.

cleartool mktrtype -element -all -nc -preop checkin ^
-execunix "Perl /public/scripts/precheckin.pl" ^
-execwin
"ccperl \\neon\scripts\precheckin.pl" ^
pre_ci_trig

Notes