Page 1 of 1

script to update forge for linux

PostPosted: 05 Mar 2017, 23:24
by Asta666
A little bored and tired of checking the website to see whether a new version was released I wrote a tiny script to do it automatically, and also replace the old version with the new one, keeping the profile file: https://github.com/Asta1986/forge_updat ... updater.sh
Any thoughts or suggestions? Something to do this already existed and I missed it?

Re: script to update forge for linux

PostPosted: 09 Mar 2017, 19:13
by vinnie
ok, meanwhile thanks for sharing
I've seen the script but I have not tried it yet, I must say that at first glance I do not have enough knowledge of bash to understand all.
I did not understand what kind of file is "forge.profile.properties", what I think I've figured out is that if you have made changes to the directory as "editions" or "skins", these are lost.
It's correct?

Re: script to update forge for linux

PostPosted: 09 Mar 2017, 21:18
by Asta666
Yeah it's correct, you'd lose them since those two directories aren't stored within user data directories (userDir, cacheDir, cardPicsDir). It wouldn't be hard to keep them as well but I'm not sure it would be as safe to assume compatibility with newer versions of the game as it is with user data directories, which I believe are already stored in separate directories by default for this reason. Do you think it's common to edit those?
forge.profile.properties is a file that comes with forge and enables you to use custom directories for storing user data, so IMHO it makes sense to preserve it after an update in case one is using it (I use it actually).

Re: script to update forge for linux

PostPosted: 09 Mar 2017, 22:01
by vinnie
if you want to complicate the things, you could compare all the old dir whit the new with "diff -q" and if there are differences, show them and ask the user if he wants to overwrite the old dir over the new.
imho

or you can test only a reasonable part of dir, for example I think there are good chances that there are changes in "skin" since it is the themes dir.

However if you do not accept the changes because you think it's better to operate by hand, it would be good still have the old version.
So maybe it would be right to keep the old version instead of deleting it

Re: script to update forge for linux

PostPosted: 09 Mar 2017, 22:35
by Asta666
Thanks for your feedback. Yeah and I think another problem in that case would be how to determine the old customisations are compatible with the new release.
Nonetheless you can keep both versions, if you choose no when prompted for replacement the new version is downloaded and extracted to ~/Downloads/Forge and the old one remains unchanged.

Re: script to update forge for linux

PostPosted: 10 Mar 2017, 11:07
by vinnie
Asta666 wrote:Thanks for your feedback. Yeah and I think another problem in that case would be how to determine the old customisations are compatible with the new release.
I think that should not be the script to determine this, but it should be a choice left to the user.
I think that automatically determine the compatibility of overwriting is impraticable task

Nonetheless you can keep both versions, if you choose no when prompted for replacement the new version is downloaded and extracted to ~/Downloads/Forge and the old one remains unchanged.
The system that you used has the advantage of never delete the old version if not required.
The system that I have suggested has the advantage of being able to create the new version without deleting the old, in theory you should not erase the old version even if you start your script 2 times by mistake, since the script controls the latest version before updating.

Re: script to update forge for linux

PostPosted: 21 Apr 2017, 10:43
by mussol
I just found your script and as a Catalan speaker I recomend you to use xdg standards to avoid assuming fixed paths like ~/Downloads.

is really easy to do with something like:
Code: Select all
FOLDER_DOWNLOAD=`xdg-user-dir DOWNLOAD`
I also see some other minor cosmetic improvements (bash fanatic here) but all good :)

Re: script to update forge for linux

PostPosted: 28 Apr 2017, 13:01
by Asta666
Thanks for the suggestion, I thought $HOME would be safer but I personally don't like when applications place files that should go elsewhere in the home folder, so using something like xdg-user-dir would solve both concerns.

Re: script to update forge for linux

PostPosted: 11 May 2017, 01:05
by Asta666
I updated the script to use xdg-user-dir and the new download url for the game.

Re: script to update forge for linux

PostPosted: 11 Jul 2017, 22:18
by Asta666
I've made the download of a new version optional and the download progress visible since I've noticed it can take a while lately :cry:.