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 Media as Administrator
|
|
|
|
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
|
|
|
|
|
|
|
|
set GIT_MEDIA_BIN_PATH="%LOCALAPPDATA%\GitMedia\bin"
|
2015-02-09 23:41:08 +00:00
|
|
|
IF EXIST %GIT_MEDIA_BIN_PATH% GOTO DIRECTORY_EXISTS
|
2015-02-09 18:46:24 +00:00
|
|
|
mkdir %GIT_MEDIA_BIN_PATH%
|
2015-02-10 00:42:59 +00:00
|
|
|
set "path=%PATH%;%GIT_MEDIA_BIN_PATH:"=%"
|
2015-02-11 20:07:07 +00:00
|
|
|
1>NUL setx PATH "%PATH%" /M
|
2015-02-09 23:41:08 +00:00
|
|
|
:DIRECTORY_EXISTS
|
2015-02-09 18:46:24 +00:00
|
|
|
|
2015-02-09 21:00:58 +00:00
|
|
|
:: Delete any existing git-media programs
|
2015-02-09 23:41:32 +00:00
|
|
|
2>NUL del /q %GIT_MEDIA_BIN_PATH%\git-media*
|
2015-02-09 18:46:24 +00:00
|
|
|
|
2015-02-09 23:41:32 +00:00
|
|
|
1>NUL copy git-media.exe %GIT_MEDIA_BIN_PATH%\git-media.exe
|
2015-02-09 18:46:24 +00:00
|
|
|
|
|
|
|
git media init
|
|
|
|
|
|
|
|
cmd /k
|