@echo off
rem $Header: /home/cvs/src/prj/CrCheck/cr2gpg.bat,v 1.15 2024/12/30 18:23:21 ralph Exp $
rem Original Revision 2.2  2001/11/26 21:44:24  Administrator
rem Tested with gpg 1.4.22,23 and 2.1.23, 2.2.27, 2.2.35, 2.4.35

rem This echo statements failed with Bat2exec under Windows 10.
echo ++-------------------------------------------------------------------------++
echo CR2GPG for CrCheck + gpg (GnuPG) driver for DOS16 (c) by ROSE SWE, Ralph Roth
echo DOS16/Windows - "$Id: cr2gpg.bat,v 1.15 2024/12/30 18:23:21 ralph Exp $"
echo ++-------------------------------------------------------------------------++

rem Only CR2PGP.Bat works with long file names....

rem Housekeeping
if exist CrCheck.asc del CrCheck.asc > nul
if exist CrCheck.txt del CrCheck.txt > nul
if exist CrCheck.txt.asc del CrCheck.txt.asc > nul

echo Validating (crc-checking) all the files in the current directory.
echo Please verify with GPG/PGP that this file has a valid signature! > CrCheck.txt
echo   gpg2 --verify CrCheck.txt >> CrCheck.txt
CrCheck *.* /h /s>>CrCheck.txt
describe CrCheck.txt "Checksum file, run CrCheck and GPG to verify if tampered"
echo Signing+Validating now with (GNU)-PGP (GPG must be in the PATH=... statement)

gpg2 --clear-sign CrCheck.txt
echo Moving and touching (needs MOVE and TOUCH)

if exist CrCheck.txt.asc goto newdos

rem some fixes provided by cyberrax

echo FOUND: CrCheck.txt [oldstyle]
if exist CrCheck.txt            copy /y CrCheck.asc CrCheck.txt >nul
goto olddos

:newdos
echo FOUND: CrCheck.txt.asc
if exist CrCheck.txt.asc        copy /y CrCheck.txt.asc CrCheck.txt >nul

:olddos
if exist CrCheck.asc del CrCheck.asc > nul
if exist CrCheck.txt.asc del CrCheck.txt.asc > nul

rem if you don't have rtouch (ROSE SWE)//touch (4Dos, Caldera/Dr.DOS, UNIX) remark this line out.

rtouch -eins CrCheck.txt
if exist CrCheck.txt.asc del CrCheck.asc > nul

