w10install/tools/personalfiles.cmd

91 lines
2.1 KiB
Batchfile
Raw Normal View History

2022-12-18 16:10:09 +01:00
@echo off
rem ===================
rem GLOBAL VARS
rem ===================
set TOOLS=c:\tools
set PERSONALFILES_DONE=%LOCALAPPDATA%\.personalfiles_done
set SETTINGS=%TOOLS%\scripts\settings.cmd
2022-12-30 19:53:13 +01:00
set GITWORKDIR=%USERPROFILE%\workspace\git
2022-12-18 16:10:09 +01:00
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
)
2022-12-18 16:10:09 +01:00
echo ####### %0 #######
rem ===================
rem CONFIGFILE CHECK
rem ===================
if NOT EXIST %SETTINGS% (
echo.
echo WARNING: %SETTINGS% NOT FOUND
echo.
) else (
call %SETTINGS%
)
echo ++++++++++++++++++
2022-12-30 19:53:13 +01:00
echo GITWORKDIR=%GITWORKDIR%
2022-12-31 17:43:40 +01:00
echo gitserver=%gitserver%
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 19:53:13 +01:00
if NOT exist %GITWORKDIR% (
echo ERROR: cannot create folder [ %GITWORKDIR% ] !
echo ####### %0 #######
exit /b
)
echo cloning GIT repository ...
2022-12-30 19:53:13 +01:00
cd %GITWORKDIR%
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 ...
if EXIST %GITWORKDIR%\personal\WINCMD.ini (
echo copying ini file for TOTALCOMMANDER ...
copy /Y %GITWORKDIR%\personal\WINCMD.ini %APPDATA%\GHISLER
2022-12-18 16:10:09 +01:00
)
2022-12-30 19:53:13 +01:00
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
2022-12-18 16:10:09 +01:00
)
rem SSH keys ...
2022-12-30 19:53:13 +01:00
if EXIST %GITWORKDIR%\personal (
2022-12-18 16:10:09 +01:00
echo copying personal SSH keys ...
2022-12-30 19:53:13 +01:00
copy /Y %GITWORKDIR%\personal\id*.* %USERPROFILE%\.ssh 2>nul
2022-12-18 16:10:09 +01:00
)
rem GIT
2022-12-30 19:53:13 +01:00
if EXIST %GITWORKDIR%\personal\gitconfig (
2022-12-18 16:10:09 +01:00
echo copying gitconfig ...
2022-12-30 19:53:13 +01:00
copy /Y %GITWORKDIR%\personal\gitconfig %USERPROFILE%\.gitconfig
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 #######
:END