2022-12-18 16:10:09 +01:00
|
|
|
@echo off
|
|
|
|
|
|
|
|
rem ===================
|
|
|
|
rem GLOBAL VARS
|
|
|
|
rem ===================
|
2023-01-22 12:56:24 +01:00
|
|
|
|
2022-12-18 16:10:09 +01:00
|
|
|
set TOOLS=c:\tools
|
2023-01-22 12:56:24 +01:00
|
|
|
set SCRIPT_SETTINGS=%TOOLS%\scripts\settings.cmd
|
2024-02-25 10:50:33 +01:00
|
|
|
set CUSTOM_SETTINGS=%TOOLS%\custom\settings.cmd
|
2022-12-18 16:10:09 +01:00
|
|
|
set PERSONALFILES_DONE=%LOCALAPPDATA%\.personalfiles_done
|
2023-02-20 07:56:50 +01:00
|
|
|
set GITWORKDIR=%USERPROFILE%\workspace
|
2023-01-22 13:37:14 +01:00
|
|
|
set gitrepo=undefined
|
|
|
|
set gitserver=undefined
|
2022-12-18 16:10:09 +01:00
|
|
|
|
|
|
|
rem already done ?
|
2022-12-30 14:53:45 +01:00
|
|
|
if EXIST %PERSONALFILES_DONE% (
|
|
|
|
echo.
|
|
|
|
echo This was already DONE!
|
|
|
|
echo please remove the file [ %PERSONALFILES_DONE% ] to re-execute this!
|
|
|
|
GOTO END
|
|
|
|
)
|
2022-12-18 16:10:09 +01:00
|
|
|
|
|
|
|
echo ####### %0 #######
|
|
|
|
|
2022-12-30 14:53:45 +01:00
|
|
|
rem ===================
|
|
|
|
rem CONFIGFILE CHECK
|
|
|
|
rem ===================
|
|
|
|
|
2023-01-22 12:56:24 +01:00
|
|
|
echo.
|
|
|
|
echo searching for SCRIPT settings ...
|
|
|
|
if NOT EXIST %SCRIPT_SETTINGS% (
|
|
|
|
echo INFO: config file %SCRIPT_SETTINGS% NOT FOUND
|
|
|
|
) else (
|
|
|
|
echo OK. Loading SCRIPT settings ...
|
|
|
|
call %SCRIPT_SETTINGS%
|
|
|
|
)
|
|
|
|
|
|
|
|
echo.
|
2024-02-21 11:58:08 +01:00
|
|
|
echo searching for CUSTOM settings ...
|
|
|
|
if NOT EXIST %CUSTOM_SETTINGS% (
|
|
|
|
echo INFO: config file %CUSTOM_SETTINGS% NOT FOUND
|
2022-12-30 14:53:45 +01:00
|
|
|
) else (
|
2024-02-21 11:58:08 +01:00
|
|
|
echo OK. Loading CUSTOM settings ...
|
|
|
|
call %CUSTOM_SETTINGS%
|
2022-12-30 14:53:45 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
echo ++++++++++++++++++
|
2022-12-30 19:53:13 +01:00
|
|
|
echo GITWORKDIR=%GITWORKDIR%
|
2022-12-31 17:43:40 +01:00
|
|
|
echo gitserver=%gitserver%
|
2022-12-30 14:53:45 +01:00
|
|
|
echo gitrepo=%gitrepo%
|
|
|
|
echo ++++++++++++++++++
|
|
|
|
echo.
|
|
|
|
|
2022-12-30 19:53:13 +01:00
|
|
|
rem GIT folder and REPO ...
|
|
|
|
echo Creating folder %GITWORKDIR% ...
|
|
|
|
mkdir %GITWORKDIR% 1>nul 2>nul
|
2022-12-30 14:53:45 +01:00
|
|
|
|
2022-12-30 19:53:13 +01:00
|
|
|
if NOT exist %GITWORKDIR% (
|
|
|
|
echo ERROR: cannot create folder [ %GITWORKDIR% ] !
|
2022-12-30 14:53:45 +01:00
|
|
|
echo ####### %0 #######
|
|
|
|
exit /b
|
|
|
|
)
|
|
|
|
|
|
|
|
echo cloning GIT repository ...
|
2022-12-30 19:53:13 +01:00
|
|
|
cd %GITWORKDIR%
|
2024-02-01 12:32:02 +01:00
|
|
|
git config --global http.sslVerify false
|
2022-12-30 14:53:45 +01:00
|
|
|
git clone https://%USERNAME%@%gitserver%/%USERNAME%/%gitrepo%.git
|
|
|
|
|
2022-12-30 19:53:13 +01:00
|
|
|
if %ERRORLEVEL% NEQ 0 (
|
|
|
|
echo ERROR while executing "git clone".
|
|
|
|
echo cannot continue!
|
|
|
|
echo ####### %0 #######
|
|
|
|
exit /b
|
|
|
|
)
|
|
|
|
|
|
|
|
rem Totalcommander ini file ...
|
2023-02-18 09:28:03 +01:00
|
|
|
if EXIST %GITWORKDIR%\%gitrepo%\WINCMD.ini (
|
2022-12-30 19:53:13 +01:00
|
|
|
echo copying ini file for TOTALCOMMANDER ...
|
2023-02-18 09:28:03 +01:00
|
|
|
copy /Y %GITWORKDIR%\%gitrepo%\WINCMD.ini %APPDATA%\GHISLER
|
2022-12-18 16:10:09 +01:00
|
|
|
)
|
|
|
|
|
2022-12-30 19:53:13 +01:00
|
|
|
rem Totalcommander ftp config ...
|
2023-02-18 09:28:03 +01:00
|
|
|
if EXIST %GITWORKDIR%\%gitrepo%\wcx_ftp.ini (
|
2022-12-30 19:53:13 +01:00
|
|
|
echo copying TOTALCOMMANDER ftp config file ...
|
2023-02-18 09:28:03 +01:00
|
|
|
copy /Y %GITWORKDIR%\%gitrepo%\wcx_ftp.ini %APPDATA%\GHISLER
|
2022-12-18 16:10:09 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
rem SSH keys ...
|
2023-02-18 09:28:03 +01:00
|
|
|
if EXIST %GITWORKDIR%\%gitrepo% (
|
|
|
|
echo copying users SSH keys ...
|
|
|
|
copy /Y %GITWORKDIR%\%gitrepo%\id*.* %USERPROFILE%\.ssh 2>nul
|
2023-12-27 21:55:52 +01:00
|
|
|
|
|
|
|
if "%HOMEDRIVE%%HOMEPATH%" NEQ "%USERPROFILE%" (
|
2023-12-27 23:19:17 +01:00
|
|
|
echo copying users gitconfig for the domain drive ...
|
2024-01-04 15:24:41 +01:00
|
|
|
copy /Y %GITWORKDIR%\%gitrepo%\id*.* "%HOMEDRIVE%%HOMEPATH%".ssh
|
2023-12-27 21:55:52 +01:00
|
|
|
)
|
2022-12-18 16:10:09 +01:00
|
|
|
)
|
|
|
|
|
2023-12-27 21:55:52 +01:00
|
|
|
rem GITCONFIG ...
|
2023-02-18 09:28:03 +01:00
|
|
|
if EXIST %GITWORKDIR%\%gitrepo%\gitconfig (
|
|
|
|
echo copying users gitconfig ...
|
|
|
|
copy /Y %GITWORKDIR%\%gitrepo%\gitconfig %USERPROFILE%\.gitconfig
|
2023-12-27 21:55:52 +01:00
|
|
|
|
|
|
|
if "%HOMEDRIVE%%HOMEPATH%" NEQ "%USERPROFILE%" (
|
2023-12-27 23:19:17 +01:00
|
|
|
echo copying users gitconfig for the domain drive ...
|
2024-01-04 15:24:41 +01:00
|
|
|
copy /Y %GITWORKDIR%\%gitrepo%\gitconfig "%HOMEDRIVE%%HOMEPATH%".gitconfig
|
2023-12-27 21:55:52 +01:00
|
|
|
)
|
2022-12-18 16:10:09 +01:00
|
|
|
)
|
|
|
|
|
2023-12-27 21:55:52 +01:00
|
|
|
|
2022-12-18 16:10:09 +01:00
|
|
|
rem create a statusfile (this codeblock must be executed only once per user) ...
|
|
|
|
echo 1 >%PERSONALFILES_DONE%
|
|
|
|
|
|
|
|
echo ####### %0 #######
|
2022-12-30 14:53:45 +01:00
|
|
|
|
|
|
|
:END
|
2023-01-22 13:37:14 +01:00
|
|
|
|