windows-nt/Source/XPSP1/NT/tools/postbuildscripts/nntpsmtp.cmd
2020-09-26 16:20:57 +08:00

143 lines
3.5 KiB
Batchfile

@echo off
REM ------------------------------------------------------------------
REM
REM nntpsmtp.cmd
REM Generates cabs, catalogs, and infs for NNTP/SMTP
REM
REM Copyright (c) Microsoft Corporation. All rights reserved.
REM
REM ------------------------------------------------------------------
if defined _CPCMAGIC goto CPCBegin
perl -x "%~f0" %*
goto :EOF
#!perl
use strict;
use lib $ENV{RAZZLETOOLPATH} . "\\PostBuildScripts";
use lib $ENV{RAZZLETOOLPATH};
use PbuildEnv;
use ParseArgs;
sub Usage { print<<USAGE; exit(1) }
nntpsmtp [-l <language>]
Generates cabs, catalogs, and infs for NNTP/SMTP.
USAGE
parseargs('?' => \&Usage);
# *** NEXT FEW LINES ARE TEMPLATE ***
$ENV{"_CPCMAGIC"}++;exit(system($0)>>8);
__END__
:CPCBegin
set _CPCMAGIC=
setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
REM *** BEGIN YOUR CMD SCRIPT BELOW ***
REM Creates the following files for NNTP/SMTP:
REM NNTP:
REM ins.cab
REM ins.cat
REM ins.inf
REM srvinf\ins.inf
REM SMTP:
REM ims.cab
REM ims.cat
REM ims_w.inf
REM srvinf\ims_s.inf
REM
REM Perform cleanup of ins/ims cats and cabs for a full postbuild.
REM
if exist %_NTPOSTBLD%\build_logs\FullPass.txt (
call ExecuteCmd.cmd "if exist %_NTPostBld%\ins.cab del %_NTPostBld%\ins.cab /s/q"
call ExecuteCmd.cmd "if exist %_NTPostBld%\ins.cat del %_NTPostBld%\ins.cat /s/q"
call ExecuteCmd.cmd "if exist %_NTPostBld%\ims.cab del %_NTPostBld%\ims.cab /s/q"
call ExecuteCmd.cmd "if exist %_NTPostBld%\ims.cat del %_NTPostBld%\ims.cat /s/q"
)
REM
REM Create the cab files ins.cab and ims.cab for nntpsmtp.
REM
if not exist %_NTPostBld%\staxpt\dump (
call errmsg.cmd "Unable to find directory %_NTPostBld%\staxpt\dump."
goto end
)
pushd %_NTPostBld%\staxpt\dump
if errorlevel 1 goto end
set nonntp=
set noinf=
REM
REM NNTP/SMTP infs are dynamically generated for USA by makecab.cmd,
REM but they're dropped pre-localized for international languages to
REM \\rastaman\fe -p nntpsmtp.
REM
if /i not "%lang%"=="usa" set noinf=/noinf
REM
REM NNTP is only applicable to languages that ship a server product.
REM
set /A found=0
perl %RazzleToolPath%\cksku.pm -t:bla -l:%lang%
if %errorlevel% EQU 0 set /A found=1
perl %RazzleToolPath%\cksku.pm -t:sbs -l:%lang%
if %errorlevel% EQU 0 set /A found=1
perl %RazzleToolPath%\cksku.pm -t:srv -l:%lang%
if %errorlevel% EQU 0 set /A found=1
perl %RazzleToolPath%\cksku.pm -t:ads -l:%lang%
if %errorlevel% EQU 0 set /A found=1
perl %RazzleToolPath%\cksku.pm -t:dtc -l:%lang%
if %errorlevel% EQU 0 set /A found=1
if %found% EQU 0 set nonntp=/nonntp
REM Makecab.cmd should set errorlevel to a positive value if it fails.
call ExecuteCmd.cmd "call makecab.cmd %nonntp% %noinf%"
if errorlevel 1 goto end
popd
REM
REM Create the catalog files for nntpsmtp
REM
pushd %RazzleToolPath%
if errorlevel 1 (
call errmsg.cmd "createcat.cmd to run from %RazzleToolPath% only."
goto end
)
if not defined nonntp (
call ExecuteCmd.cmd "call createcat.cmd -f %_NTPostBld%\staxpt\dump\nt5ins.lst -c ins -t %_NTPostBld%\staxpt\dump -o %_NTPostBld% -l:%lang%"
)
call ExecuteCmd.cmd "call createcat.cmd -f %_NTPostBld%\staxpt\dump\nt5ims.lst -c ims -t %_NTPostBld%\staxpt\dump -o %_NTPostBld% -l:%lang%"
popd
if not exist %_NTPostBld%\cdf md %_NTPostBld%\cdf
REM Don't check errorlevel since md will return 1 if the directory already exists
if not defined nonntp (
call ExecuteCmd.cmd "move %_NTPostBld%\ins.cdf %_NTPostBld%\cdf\ins.cdf"
)
call ExecuteCmd.cmd "move %_NTPostBld%\ims.cdf %_NTPostBld%\cdf\ims.cdf"
goto end
:end
seterror.exe "%errors%"& goto :EOF