What would be the best way to have a self updating (from SVN) Powershell script?
It should be able to start a new process and then call SVN update $script; './$script', after making sure the current process has ended.
if ((svn st -u --quiet $script) -match "\*"){
$scriptToRun = 'SVN update $script; "./$script"'
##start new process that will end this process and execute $scriptToRun
}
I thought this would do the trick, even if a little naive. You have two scripts –
StartApp.ps1which does any necessary checks for updates. After running it then chainsMainApp.ps1which is the app itself, this is what would get updated.StartApp.ps1 – kicks off app but also does the update check: