w10install/tools/personalfiles.cmd
Michael H.G. Schmidt b7d05161ad bugfix
2022-12-31 17:43:40 +01:00

91 lines
2.1 KiB
Batchfile

@echo off
rem ===================
rem GLOBAL VARS
rem ===================
set TOOLS=c:\tools
set PERSONALFILES_DONE=%LOCALAPPDATA%\.personalfiles_done
set SETTINGS=%TOOLS%\scripts\settings.cmd
set GITWORKDIR=%USERPROFILE%\workspace\git
rem already done ?
if EXIST %PERSONALFILES_DONE% (
echo.
echo This was already DONE!
echo please remove the file [ %PERSONALFILES_DONE% ] to re-execute this!
GOTO END
)
echo ####### %0 #######
rem ===================
rem CONFIGFILE CHECK
rem ===================
if NOT EXIST %SETTINGS% (
echo.
echo WARNING: %SETTINGS% NOT FOUND
echo.
) else (
call %SETTINGS%
)
echo ++++++++++++++++++
echo GITWORKDIR=%GITWORKDIR%
echo gitserver=%gitserver%
echo gitrepo=%gitrepo%
echo ++++++++++++++++++
echo.
rem GIT folder and REPO ...
echo Creating folder %GITWORKDIR% ...
mkdir %GITWORKDIR% 1>nul 2>nul
if NOT exist %GITWORKDIR% (
echo ERROR: cannot create folder [ %GITWORKDIR% ] !
echo ####### %0 #######
exit /b
)
echo cloning GIT repository ...
cd %GITWORKDIR%
git clone https://%USERNAME%@%gitserver%/%USERNAME%/%gitrepo%.git
if %ERRORLEVEL% NEQ 0 (
echo ERROR while executing "git clone".
echo cannot continue!
echo ####### %0 #######
exit /b
)
rem Totalcommander ini file ...
if EXIST %GITWORKDIR%\personal\WINCMD.ini (
echo copying ini file for TOTALCOMMANDER ...
copy /Y %GITWORKDIR%\personal\WINCMD.ini %APPDATA%\GHISLER
)
rem Totalcommander ftp config ...
if EXIST %GITWORKDIR%\personal\wcx_ftp.ini (
echo copying TOTALCOMMANDER ftp config file ...
copy /Y %GITWORKDIR%\personal\wcx_ftp.ini %APPDATA%\GHISLER
)
rem SSH keys ...
if EXIST %GITWORKDIR%\personal (
echo copying personal SSH keys ...
copy /Y %GITWORKDIR%\personal\id*.* %USERPROFILE%\.ssh 2>nul
)
rem GIT
if EXIST %GITWORKDIR%\personal\gitconfig (
echo copying gitconfig ...
copy /Y %GITWORKDIR%\personal\gitconfig %USERPROFILE%\.gitconfig
)
rem create a statusfile (this codeblock must be executed only once per user) ...
echo 1 >%PERSONALFILES_DONE%
echo ####### %0 #######
:END