@ECHO OFF
REM FDGTSTA.BAT
REM FLAGDIR compare test.
REM
REM Direct part:
REM   OUT    = Novell baseline using \NPUBLIC\FLAGDIR
REM   PUBOUT = our implementation using \PUBLIC\FLAGDIR
REM
REM User-context part:
REM   NOPASSUSER logs in via DLYSTRT helper and runs the same effective tests.

IF "%1"=="" GOTO PART1
IF "%1"=="PART2" GOTO PART2
IF "%1"=="part2" GOTO PART2
IF "%1"=="Part2" GOTO PART2
ECHO Usage: FDGTSTA [PART2]
GOTO END

:PART1
F:
CD \

IF EXIST FDGTEST\NUL DELTREE /Y FDGTEST\*.*
IF EXIST FDGCMP\NUL DELTREE /Y FDGCMP\*.*
IF EXIST FDGTMP\NUL DELTREE /Y FDGTMP\*.*

IF NOT EXIST FDGTEST\NUL MD FDGTEST
IF NOT EXIST FDGTEST\DIRA\NUL MD FDGTEST\DIRA
IF NOT EXIST FDGTEST\DIRB\NUL MD FDGTEST\DIRB
IF NOT EXIST FDGTEST\DIRC\NUL MD FDGTEST\DIRC
IF NOT EXIST FDGTEST\DIRB\SUB\NUL MD FDGTEST\DIRB\SUB
IF NOT EXIST FDGCMP\NUL MD FDGCMP
IF NOT EXIST FDGCMP\OUT\NUL MD FDGCMP\OUT
IF NOT EXIST FDGCMP\PUBOUT\NUL MD FDGCMP\PUBOUT
IF NOT EXIST FDGCMP\SETUP\NUL MD FDGCMP\SETUP
IF NOT EXIST FDGCMP\UNOV\NUL MD FDGCMP\UNOV
IF NOT EXIST FDGCMP\UPUB\NUL MD FDGCMP\UPUB

IF EXIST F:\FDGCMP\RUN.LOG DEL F:\FDGCMP\RUN.LOG
IF EXIST F:\FDGCMP\SUMMARY.TXT DEL F:\FDGCMP\SUMMARY.TXT
IF EXIST F:\FDGCMP\COMPARE.LOG DEL F:\FDGCMP\COMPARE.LOG
IF EXIST F:\FDGCMP\UCOMP.LOG DEL F:\FDGCMP\UCOMP.LOG
IF EXIST F:\FDGCMP\FDGTSTA.ZIP DEL F:\FDGCMP\FDGTSTA.ZIP
IF EXIST F:\FDGCMP\ZIP.LOG DEL F:\FDGCMP\ZIP.LOG

ECHO SUB FILE > F:\FDGTEST\DIRB\SUB\SUB.TXT
ECHO FDGTSTA FLAGDIR compare > F:\FDGCMP\RUN.LOG

ECHO Starting D10 read normal...
NPUBLIC\FLAGDIR F:\FDGTEST\DIRA Normal > NUL
NPUBLIC\FLAGDIR F:\FDGTEST\DIRA > F:\FDGCMP\OUT\D10_READ.OUT
PUBLIC\FLAGDIR F:\FDGTEST\DIRA > F:\FDGCMP\PUBOUT\D10_READ.OUT

ECHO Starting D11 Hidden...
NPUBLIC\FLAGDIR F:\FDGTEST\DIRA Normal > NUL
NPUBLIC\FLAGDIR F:\FDGTEST\DIRA Hidden > F:\FDGCMP\OUT\D11_HID.OUT
NPUBLIC\FLAGDIR F:\FDGTEST\DIRA >> F:\FDGCMP\OUT\D11_HID.OUT
NPUBLIC\FLAGDIR F:\FDGTEST\DIRA Normal > NUL
PUBLIC\FLAGDIR F:\FDGTEST\DIRA Hidden > F:\FDGCMP\PUBOUT\D11_HID.OUT
PUBLIC\FLAGDIR F:\FDGTEST\DIRA >> F:\FDGCMP\PUBOUT\D11_HID.OUT

ECHO Starting D12 System...
NPUBLIC\FLAGDIR F:\FDGTEST\DIRB Normal > NUL
NPUBLIC\FLAGDIR F:\FDGTEST\DIRB System > F:\FDGCMP\OUT\D12_SYS.OUT
NPUBLIC\FLAGDIR F:\FDGTEST\DIRB >> F:\FDGCMP\OUT\D12_SYS.OUT
NPUBLIC\FLAGDIR F:\FDGTEST\DIRB Normal > NUL
PUBLIC\FLAGDIR F:\FDGTEST\DIRB System > F:\FDGCMP\PUBOUT\D12_SYS.OUT
PUBLIC\FLAGDIR F:\FDGTEST\DIRB >> F:\FDGCMP\PUBOUT\D12_SYS.OUT

ECHO Starting D13 Purge...
NPUBLIC\FLAGDIR F:\FDGTEST\DIRC Normal > NUL
NPUBLIC\FLAGDIR F:\FDGTEST\DIRC Purge > F:\FDGCMP\OUT\D13_PUR.OUT
NPUBLIC\FLAGDIR F:\FDGTEST\DIRC >> F:\FDGCMP\OUT\D13_PUR.OUT
NPUBLIC\FLAGDIR F:\FDGTEST\DIRC Normal > NUL
PUBLIC\FLAGDIR F:\FDGTEST\DIRC Purge > F:\FDGCMP\PUBOUT\D13_PUR.OUT
PUBLIC\FLAGDIR F:\FDGTEST\DIRC >> F:\FDGCMP\PUBOUT\D13_PUR.OUT

ECHO Starting D14 Delete/Rename inhibit...
NPUBLIC\FLAGDIR F:\FDGTEST\DIRB\SUB Normal > NUL
NPUBLIC\FLAGDIR F:\FDGTEST\DIRB\SUB Deleteinhibit Renameinhibit > F:\FDGCMP\OUT\D14_DIRI.OUT
NPUBLIC\FLAGDIR F:\FDGTEST\DIRB\SUB >> F:\FDGCMP\OUT\D14_DIRI.OUT
NPUBLIC\FLAGDIR F:\FDGTEST\DIRB\SUB Normal > NUL
PUBLIC\FLAGDIR F:\FDGTEST\DIRB\SUB Deleteinhibit Renameinhibit > F:\FDGCMP\PUBOUT\D14_DIRI.OUT
PUBLIC\FLAGDIR F:\FDGTEST\DIRB\SUB >> F:\FDGCMP\PUBOUT\D14_DIRI.OUT

ECHO Starting D15 mixed reset...
NPUBLIC\FLAGDIR F:\FDGTEST\DIRA Hidden System > NUL
NPUBLIC\FLAGDIR F:\FDGTEST\DIRA Normal > F:\FDGCMP\OUT\D15_NORM.OUT
NPUBLIC\FLAGDIR F:\FDGTEST\DIRA >> F:\FDGCMP\OUT\D15_NORM.OUT
NPUBLIC\FLAGDIR F:\FDGTEST\DIRA Hidden System > NUL
PUBLIC\FLAGDIR F:\FDGTEST\DIRA Normal > F:\FDGCMP\PUBOUT\D15_NORM.OUT
PUBLIC\FLAGDIR F:\FDGTEST\DIRA >> F:\FDGCMP\PUBOUT\D15_NORM.OUT

ECHO Starting D90 missing dir...
NPUBLIC\FLAGDIR F:\FDGTEST\MISSING > F:\FDGCMP\OUT\D90_MISS.OUT
PUBLIC\FLAGDIR F:\FDGTEST\MISSING > F:\FDGCMP\PUBOUT\D90_MISS.OUT

ECHO Comparing direct FLAGDIR outputs... > F:\FDGCMP\COMPARE.LOG
FOR %%F IN (D10_READ.OUT D11_HID.OUT D12_SYS.OUT D13_PUR.OUT D14_DIRI.OUT D15_NORM.OUT D90_MISS.OUT) DO FC F:\FDGCMP\OUT\%%F F:\FDGCMP\PUBOUT\%%F >> F:\FDGCMP\COMPARE.LOG

REM Grant NOPASSUSER enough rights for user-context directory flag tests.
NPUBLIC\GRANT ALL FOR F:\FDGTEST TO USER NOPASSUSER > F:\FDGCMP\SETUP\S01_GRD.OUT
NPUBLIC\GRANT ALL FOR F:\FDGTEST\DIRA TO USER NOPASSUSER >> F:\FDGCMP\SETUP\S01_GRD.OUT
NPUBLIC\GRANT ALL FOR F:\FDGTEST\DIRB TO USER NOPASSUSER >> F:\FDGCMP\SETUP\S01_GRD.OUT
NPUBLIC\GRANT ALL FOR F:\FDGTEST\DIRC TO USER NOPASSUSER >> F:\FDGCMP\SETUP\S01_GRD.OUT
NPUBLIC\GRANT ALL FOR F:\FDGTEST\DIRB\SUB TO USER NOPASSUSER >> F:\FDGCMP\SETUP\S01_GRD.OUT

IF "%LGNTPWD%"=="" GOTO NEEDPWD

IF EXIST C:\FDGTMP DELTREE /Y C:\FDGTMP > NUL
MD C:\FDGTMP
MD C:\FDGTMP\UNOV
MD C:\FDGTMP\UPUB
COPY F:\FDGC.BAT C:\FDGTMP\FDGC.BAT > NUL
COPY F:\PUBLIC\DLYSTRT.EXE C:\FDGTMP\DLYSTRT.EXE > NUL

C:
CD \FDGTMP
DLYSTRT /T:2 FDGC.BAT
GOTO END

:NEEDPWD
ECHO LGNTPWD is not set. User-context FLAGDIR block skipped. >> F:\FDGCMP\RUN.LOG
ECHO.
ECHO LGNTPWD ist nicht gesetzt. User-Kontext wurde nicht gestartet.
GOTO END

:PART2
F:
CD \
IF NOT EXIST FDGCMP\UNOV\NUL MD FDGCMP\UNOV
IF NOT EXIST FDGCMP\UPUB\NUL MD FDGCMP\UPUB
IF EXIST F:\FDGCMP\UCOMP.LOG DEL F:\FDGCMP\UCOMP.LOG
COPY C:\FDGTMP\UNOV\*.OUT F:\FDGCMP\UNOV > NUL
COPY C:\FDGTMP\UPUB\*.OUT F:\FDGCMP\UPUB > NUL
IF EXIST C:\FDGTMP\HELPER.TXT COPY C:\FDGTMP\HELPER.TXT F:\FDGCMP > NUL
ECHO Comparing NOPASSUSER FLAGDIR outputs... > F:\FDGCMP\UCOMP.LOG
FOR %%F IN (U10_READ.OUT U11_HID.OUT U12_SYS.OUT U13_PUR.OUT U14_DIRI.OUT U15_NORM.OUT U90_MISS.OUT) DO FC F:\FDGCMP\UNOV\%%F F:\FDGCMP\UPUB\%%F >> F:\FDGCMP\UCOMP.LOG
ECHO FDGTSTA summary > F:\FDGCMP\SUMMARY.TXT
ECHO Direct compare: F:\FDGCMP\COMPARE.LOG >> F:\FDGCMP\SUMMARY.TXT
ECHO User compare:   F:\FDGCMP\UCOMP.LOG >> F:\FDGCMP\SUMMARY.TXT
ECHO Optional: FDGTZIP ausfuehren. >> F:\FDGCMP\SUMMARY.TXT
ECHO.
ECHO FDGTSTA PART2 fertig. Optional FDGTZIP ausfuehren.
GOTO END

:END
