Skip to content

Commit

Permalink
Execute scoop update without using git-bash to update git itself
Browse files Browse the repository at this point in the history
  • Loading branch information
km45 committed Nov 1, 2020
1 parent 84df5e4 commit 1da7342
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 14 deletions.
3 changes: 2 additions & 1 deletion main.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ setlocal
exit /b 1
)

REM "Execute setup.bat and scoop.sh at first"
REM "Execute setup.bat, update.bat and scoop.sh at first"
call %WORKDIR%\setup.bat
call %WORKDIR%\update.bat
%HOMEDRIVE%%HOMEPATH%\scoop\apps\git-with-openssh\current\usr\bin\bash.exe --login scoop.sh %1

REM "Execute the role python at second"
Expand Down
13 changes: 0 additions & 13 deletions scoop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@ function LOGE() {
LOG_impl ${LEVEL} "${messages}"
}

function update_scoop() {
LOGI "Update scoop"
scoop update
}

function update_installed_packages() {
LOGI "Update installed packages"
scoop update '*'
}

function add_bucket() {
local -r bucket_name=$1

Expand Down Expand Up @@ -75,9 +65,6 @@ function install_package() {
function main() {
local mode=$1

update_scoop
update_installed_packages

add_bucket "extras"
add_bucket "versions"

Expand Down
50 changes: 50 additions & 0 deletions update.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@echo off

:Main
setlocal
where scoop > nul 2> nul
if %ERRORLEVEL% == 1 (
call :LogError "You must install scoop. https://github.com/lukesampson/scoop"
exit /b
)

call :LogInfo "Update scoop"
call scoop update

call :LogInfo "Update installed packages"
call scoop update *

exit /b
endlocal

:InstallPackage
setlocal
set PACKAGE_NAME=%~1

scoop list | find " %PACKAGE_NAME% " > nul
if %ERRORLEVEL% == 0 (
call :LogDebug "Already installed" %PACKAGE_NAME%
) else (
call :LogInfo "Install" %PACKAGE_NAME%
call scoop install %PACKAGE_NAME%
)

exit /b
endlocal

:LogInfo
setlocal
call :LogImpl I %*
exit /b
endlocal

:LogImpl
setlocal
set /p NOP=%date% < nul
set /p NOP=%time% < nul
for %%s in (%*) do (
set /p NOP=%%~s < nul
)
echo;
exit /b
endlocal

0 comments on commit 1da7342

Please sign in to comment.