Skip to content

Instantly share code, notes, and snippets.

@ferventcoder
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ferventcoder/40503c0aff49fe32bec1 to your computer and use it in GitHub Desktop.
Save ferventcoder/40503c0aff49fe32bec1 to your computer and use it in GitHub Desktop.
Choco updater scripts
@echo off
SET DIR=%~dp0%
@PowerShell -NoProfile -NoLogo -ExecutionPolicy Unrestricted -Command "& '%DIR%chocolateyautomaticpackages.ps1'"
set logdate=
set logtime=
::http://stackoverflow.com/questions/203090/how-to-get-current-datetime-on-windows-command-line-in-a-suitable-format-for-us
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set logdate=%%c%%a%%b)
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set logtime=%%a%%b)
::For /f "tokens=1-2 delims=/:" %%a in ("%TIME%") do (set logtime=%%a%%b)
:: this of course needs fixed, it's a path that is hardcoded to a version of ketarin
C:\Chocolatey\lib\ketarin.1.6.0.434\tools\Ketarin.exe /silent /log=C:\ProgramData\chocolateypackageupdater\ketarin.%logdate%_%logtime%.log
$ChocoPkgsDir='C:\code\mine\chocolatey-packages'
$LogDate=[System.DateTime]::Now.ToString('yyyyMMdd_HHmmss')
$Ketarin="C:\Chocolatey\lib\ketarin.1.6.0.434\tools\Ketarin.exe"
$KetarinLogLocation="C:\ProgramData\chocolateypackageupdater\ketarin.$($LogDate).log"
$KetarinXmlLocation= Join-Path $ChocoPkgsDir '_backup\ketarinbkp.xml'
& "$Ketarin" /export="$KetarinXmlLocation"
pushd "$ChocoPkgsDir"
. git fetch
. git add .
. git commit -m "updates prior to automatic run for $LogDate"
. git rebase origin/master
. git push origin master
popd
# THIS IS DISABLED BECAUSE POWERSHELL DOESN'T LET GO PROPERLY SO THE APPLICATION HANGS. And once you get out of it, it doesn't continue...
# & "$Ketarin" /silent /log="$KetarinLogLocation"
# pushd "$ChocoPkgsDir"
# . git fetch
# . git add .
# . git commit -m "updates for automatic run for $LogDate"
# . git rebase origin/master
# . git push origin master
# popd
@TomOne
Copy link

TomOne commented Oct 9, 2014

What is the reason for the hardcoded path to Ketarin? Sooner or later this is expected to break.

Keep in mind that you already merged a commit in chocopkgup to replace this hardcoded path: chocolatey-archive/chocolatey-package-updater@a708282

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment