big migration to csv started
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
@echo off
|
||||
setlocal
|
||||
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
|
||||
if '%errorlevel%' NEQ '0' (
|
||||
echo Restarting as Admin...
|
||||
powershell -Command "Start-Process -FilePath '%~dp0apps-manager.bat' -ArgumentList 'connect' -Verb RunAs"
|
||||
exit /b
|
||||
)
|
||||
|
||||
call "%~dp0apps-manager.bat" connect
|
||||
endlocal
|
||||
@@ -0,0 +1,11 @@
|
||||
@echo off
|
||||
setlocal
|
||||
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
|
||||
if '%errorlevel%' NEQ '0' (
|
||||
echo Restarting as Admin...
|
||||
powershell -Command "Start-Process -FilePath '%~dp0apps-manager.bat' -ArgumentList 'disconnect' -Verb RunAs"
|
||||
exit /b
|
||||
)
|
||||
|
||||
call "%~dp0apps-manager.bat" disconnect
|
||||
endlocal
|
||||
@@ -0,0 +1,95 @@
|
||||
@echo off
|
||||
:: ==========================================
|
||||
:: Проверка прав администратора
|
||||
:: ==========================================
|
||||
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
|
||||
if '%errorlevel%' NEQ '0' (
|
||||
echo Требуются права администратора. Перезапуск...
|
||||
powershell -Command "Start-Process -FilePath '%~f0' -ArgumentList '%*' -Verb RunAs"
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: ==========================================
|
||||
:: Инициализация
|
||||
:: ==========================================
|
||||
setlocal EnableDelayedExpansion
|
||||
set "init=%~dp0\..\settings\init.bat"
|
||||
call "%init%"
|
||||
|
||||
set "config=%csv%"
|
||||
|
||||
:: ==========================================
|
||||
:: Аргумент действия
|
||||
:: ==========================================
|
||||
set "action=%1"
|
||||
if "%action%"=="" set "action=reconnect"
|
||||
|
||||
:: ==========================================
|
||||
:: Обработка CSV
|
||||
:: ==========================================
|
||||
for /f "skip=1 tokens=1-8 delims=," %%A in (%config%) do (
|
||||
set "App=%%A"
|
||||
set "From=%%B"
|
||||
set "To=%%C"
|
||||
set "Type=%%D"
|
||||
set "Enabled=%%E"
|
||||
set "ExtraVariables=%%F"
|
||||
set "ExtraConnect=%%G"
|
||||
set "ExtraDisconnect=%%H"
|
||||
|
||||
if "!Enabled!"=="1" (
|
||||
:: Разворачиваем стандартные переменные окружения
|
||||
call set "From=!From!"
|
||||
call set "To=!To!"
|
||||
if not "!ExtraConnect!"=="" call set "ExtraConnect=!ExtraConnect!"
|
||||
if not "!ExtraDisconnect!"=="" call set "ExtraDisconnect=!ExtraDisconnect!"
|
||||
|
||||
:: Выполняем Extra-Variables как команду
|
||||
if not "!ExtraVariables!"=="" (
|
||||
call !ExtraVariables!
|
||||
)
|
||||
|
||||
echo ==============================
|
||||
echo Processing !App! with action %action% (Type=!Type!)
|
||||
|
||||
if /I "!Type!"=="isolate" (
|
||||
:: Для isolate исполняем только extra команды
|
||||
if /I "%action%"=="disconnect" if not "!ExtraDisconnect!"=="" call !ExtraDisconnect!
|
||||
if /I "%action%"=="connect" if not "!ExtraConnect!"=="" call !ExtraConnect!
|
||||
if /I "%action%"=="reconnect" (
|
||||
if not "!ExtraDisconnect!"=="" call !ExtraDisconnect!
|
||||
if not "!ExtraConnect!"=="" call !ExtraConnect!
|
||||
)
|
||||
) else (
|
||||
:: default — обычное поведение
|
||||
if /I "%action%"=="disconnect" call :disconnect
|
||||
if /I "%action%"=="connect" call :connect
|
||||
if /I "%action%"=="reconnect" (
|
||||
call :disconnect
|
||||
call :connect
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
:: ==========================================
|
||||
:: Завершение
|
||||
:: ==========================================
|
||||
:end
|
||||
endlocal
|
||||
exit /b
|
||||
|
||||
:: ==========================================
|
||||
:: Функции
|
||||
:: ==========================================
|
||||
:disconnect
|
||||
echo Removing "!To!"...
|
||||
rd /S /Q "!To!" 2>nul
|
||||
if not "!ExtraDisconnect!"=="" call !ExtraDisconnect!
|
||||
goto :eof
|
||||
|
||||
:connect
|
||||
echo Creating symlink "!To!" -> "!From!"...
|
||||
mklink /D "!To!" "!From!"
|
||||
if not "!ExtraConnect!"=="" call !ExtraConnect!
|
||||
goto :eof
|
||||
@@ -0,0 +1,11 @@
|
||||
@echo off
|
||||
setlocal
|
||||
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
|
||||
if '%errorlevel%' NEQ '0' (
|
||||
echo Restarting as Admin...
|
||||
powershell -Command "Start-Process -FilePath '%~dp0apps-manager.bat' -ArgumentList 'reconnect' -Verb RunAs"
|
||||
exit /b
|
||||
)
|
||||
|
||||
call "%~dp0apps-manager.bat" reconnect
|
||||
endlocal
|
||||
@@ -1,15 +0,0 @@
|
||||
setlocal
|
||||
|
||||
set "init=%~dp0\..\settings\init.bat"
|
||||
call %init%
|
||||
|
||||
for %%f in ("%configurations-all%\*.bat") do (
|
||||
echo Running %%f
|
||||
call "%%f"
|
||||
)
|
||||
for %%f in ("%configurations-user%\*.bat") do (
|
||||
echo Running %%f
|
||||
call "%%f"
|
||||
)
|
||||
|
||||
endlocal
|
||||
@@ -1,24 +0,0 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
set "init=%~dp0\..\settings\init.bat"
|
||||
call %init%
|
||||
|
||||
if not exist "%packages-user-lists%" (
|
||||
mkdir "%packages-user-lists%"
|
||||
)
|
||||
|
||||
:choco-list
|
||||
start cmd /c choco export "%packages-user-lists%\choco.config"
|
||||
::--include-version-numbers
|
||||
|
||||
:msstore-list
|
||||
start cmd /c winget export -o "%packages-user-lists%\msstore.json" -s "msstore"
|
||||
:: --include-versions
|
||||
|
||||
:winget-list
|
||||
start cmd /c winget export -o "%packages-user-lists%\winget.json" -s "winget"
|
||||
:: --include-versions
|
||||
|
||||
endlocal
|
||||
exit /B
|
||||
@@ -1,11 +1,11 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
set "init=%~dp0\..\settings\init.bat"
|
||||
call %init%
|
||||
|
||||
for %%f in ("%mounts%\*.bat") do (
|
||||
echo Running %%f
|
||||
call "%%f"
|
||||
)
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
set "init=%~dp0\..\settings\init.bat"
|
||||
call %init%
|
||||
|
||||
for %%f in ("%mounts%\*.bat") do (
|
||||
echo Running %%f
|
||||
call "%%f"
|
||||
)
|
||||
endlocal
|
||||
@@ -1,17 +0,0 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
set "init=%~dp0\..\settings\init.bat"
|
||||
call %init%
|
||||
|
||||
where choco >nul 2>nul
|
||||
if %errorlevel% neq 0 (
|
||||
echo Chocolatey installing...
|
||||
powershell -ExecutionPolicy Bypass -File "%chocolatey%"
|
||||
) else (
|
||||
echo Chocolatey has already installed.
|
||||
)
|
||||
|
||||
call %packages-installer%
|
||||
|
||||
endlocal
|
||||
@@ -0,0 +1,15 @@
|
||||
setlocal
|
||||
|
||||
set "init=%~dp0\..\settings\init.bat"
|
||||
call %init%
|
||||
|
||||
for %%f in ("%apps-all%\*.bat") do (
|
||||
echo Running %%f - disconnect
|
||||
call "%%f" disconnect
|
||||
)
|
||||
for %%f in ("%apps-user%\*.bat") do (
|
||||
echo Running %%f - disconnect
|
||||
call "%%f" disconnect
|
||||
)
|
||||
|
||||
endlocal
|
||||
@@ -0,0 +1,15 @@
|
||||
setlocal
|
||||
|
||||
set "init=%~dp0\..\settings\init.bat"
|
||||
call %init%
|
||||
|
||||
for %%f in ("%legacy%\*.bat") do (
|
||||
echo Running %%f - reconnect
|
||||
call "%%f"
|
||||
)
|
||||
for %%f in ("%legacy%\*.bat") do (
|
||||
echo Running %%f - reconnect
|
||||
call "%%f"
|
||||
)
|
||||
|
||||
endlocal
|
||||
Reference in New Issue
Block a user