Jump to content

Batch Files, SVN Updates, and such.


Alex C

Recommended Posts

I am currently starting a GSP, and want to make sure all the files my users download are up-to-date. I have two main questions which, although I've seen addressed on this forum, have not been answered very clearly.

 

1. Batch Files

I understand that these can be used to update the root game installs, from which TCAdmin pulls the files from. The only thing I'm unclear in is how to create these batch files? I've seen some code around here on the forums but it hasn't been very clear.

 

2. SVN Updates

I need mods kept up-to-date, and many of them use SVNs. Could anyone help me create a batch file that downloads the SVN, deletes the old mod, zips the SVN, and then places it in the old mods spot?

 

Thanks

Link to comment
Share on other sites

  • 2 weeks later...

Here's a script that I put together for our SVNs, although we do ours manually because it's not that big of a deal to us or our customers to have them done automatically.

 

@ECHO OFF

set exportpath=E:\GameInstalls\GMod\TCA.Mods\
set modpath=orangebox\garrysmod\addons\
set folder=phx3
set zipname=phx3
goto update

:update
Echo.  >>Log_%folder%.txt
Echo.=================== >>Log_%folder%.txt
Echo.==Update== >>Log_%folder%.txt
Echo.%Date% >>Log_%folder%.txt
Echo.%Time% >>Log_%folder%.txt
Echo.  >>Log_%folder%.txt
svn update %folder% >>Log_%folder%.txt
Echo.  >>Log_%folder%.txt
goto export

:export
Echo.  >>Log_%folder%.txt
Echo.==Export== >>Log_%folder%.txt
Echo.  >>Log_%folder%.txt
md "%folder%-exp\%modpath%" >>Log_%folder%.txt
svn export %folder% "%folder%-exp\%modpath%\%folder%" >>Log_%folder%.txt
Echo. "Package + Move" >>Log_%folder%.txt
del /F /Q "%exportpath%\%zipname%.zip" >>Log_%folder%.txt
7za a "%exportpath%\%zipname%.zip" ".\%folder%-exp\*" >>Log_%folder%.txt
Echo. "Delete export folder" >>Log_%folder%.txt
rd %folder%-exp /q /s >>Log_%folder%.txt
goto end

:end

 

This batch script will update+export whatever svn folder you tell it to. Edit the variables in the header of the script to suit your svn, this example is for PHX3 (a Garry's Mod addon).

 

You will also need to install CollabNet Subversion Command-Line Client (scroll down, requires registration), and use the 7-zip command-line archiver alongside this batch file for it to even work.

 

This will also export all information to a log file.

I would not recommend having this setup to automatically update every SVN, as some can be quite large and will take up a lot of resources exporting it needlessly.

 

You will need to checkout a folder before being able to update + export it. To do so, just run this line:

svn checkout (svn_url) (svn_folder)

Link to comment
Share on other sites

the goto instructions are useless and the rd one should be removed imo.

 

I left the goto's in there because I stripped it out from our script and recoded it, and the rd is simply to keep the folders neat. The export folder isn't needed once it has been packaged, hence why it is removed.

Link to comment
Share on other sites

I left the goto's in there because I stripped it out from our script and recoded it, and the rd is simply to keep the folders neat. The export folder isn't needed once it has been packaged, hence why it is removed.

 

 

your rd makes the svn redownloaded everytime the script is ran whereas it would only be updated if needed if you remove it. Would save bw.

Link to comment
Share on other sites

your rd makes the svn redownloaded everytime the script is ran whereas it would only be updated if needed if you remove it. Would save bw.

 

Incorrect - the rd is removing a temporary export folder.

 

SVN folders have a large amount of hidden files (svn files), which almost doubles the amount of space it takes up.

Clients have no need for these hidden svn files, and by exporting the SVN folder, you remove all of these un-needed hidden SVN files; which reduces the amount of space needed by around half (which also means decreasing packaging and installation times).

 

This script is built to update the svn, export it to a temporary folder (./%folder%-exp/), package the exported files, and remove the temporary export folder.

 

It has nothing to do with saving bandwidth, because it does not download further or modify the original SVN folder.

Link to comment
Share on other sites

I would not recommend having this setup to automatically update every SVN, as some can be quite large and will take up a lot of resources exporting it needlessly.

 

my bad then, Ididnt go through the whole script but this above and the fact you were deleting the export folders made me think everything was redownloaded again everytime the script was ran.

 

Tbh you can get similar restult in 2 lines of script for those who are interested :

just export once then in scipt update and zip. you can zip excluding folders so no need to remove them.

Link to comment
Share on other sites

  • 7 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use