git-lfs/script/install.bat.example

49 lines
1.3 KiB
Plaintext
Raw Normal View History

2015-02-09 18:46:24 +00:00
:::::::::::::::::::::::::::::::::::::::::
:: Automatically check & get admin rights
:::::::::::::::::::::::::::::::::::::::::
@echo off
CLS
2015-02-06 19:19:44 +00:00
2015-02-09 23:40:48 +00:00
:: Check if git.exe is in the user's path before continuing
where /q git.exe
if %errorlevel% neq 0 (ECHO Unable to find git.exe, exiting... & EXIT /b %errorlevel%)
2015-02-09 18:46:24 +00:00
:checkPrivileges
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
2015-02-06 19:19:44 +00:00
2015-02-09 18:46:24 +00:00
:getPrivileges
if '%1'=='ELEV' (shift & goto gotPrivileges)
echo.
echo **************************************
echo Installing Git LFS as Administrator
2015-02-09 18:46:24 +00:00
echo **************************************
2015-02-06 19:19:44 +00:00
2015-02-09 18:46:24 +00:00
setlocal DisableDelayedExpansion
set "batchPath=%~0"
setlocal EnableDelayedExpansion
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
echo UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
"%temp%\OEgetPrivileges.vbs"
exit /B
2015-02-06 19:24:25 +00:00
2015-02-09 18:46:24 +00:00
:gotPrivileges
setlocal & cd /d %~dp0
2015-04-10 23:44:50 +00:00
set GIT_LFS_BIN_PATH="%LOCALAPPDATA%\GitLFS\bin"
2015-04-10 23:33:10 +00:00
IF EXIST %GIT_LFS_BIN_PATH% GOTO DIRECTORY_EXISTS
mkdir %GIT_LFS_BIN_PATH%
set "path=%PATH%;%GIT_LFS_BIN_PATH:"=%"
2015-02-11 20:07:07 +00:00
1>NUL setx PATH "%PATH%" /M
:DIRECTORY_EXISTS
2015-02-09 18:46:24 +00:00
2015-04-10 23:33:10 +00:00
:: Delete any existing git-lfs programs
2>NUL del /q %GIT_LFS_BIN_PATH%\git-lfs*
2015-02-09 18:46:24 +00:00
2015-04-10 23:33:10 +00:00
1>NUL copy git-lfs.exe %GIT_LFS_BIN_PATH%\git-lfs.exe
2015-02-09 18:46:24 +00:00
git lfs init
2015-02-09 18:46:24 +00:00
cmd /k