It is currently 16 Apr 2024, 23:53
   
Text Size

script to update forge for linux

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

script to update forge for linux

Postby Asta666 » 05 Mar 2017, 23:24

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?
Asta666
 
Posts: 46
Joined: 06 Oct 2010, 13:22
Has thanked: 3 times
Been thanked: 4 times

Re: script to update forge for linux

Postby vinnie » 09 Mar 2017, 19:13

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?
User avatar
vinnie
 
Posts: 111
Joined: 21 Dec 2015, 14:03
Has thanked: 23 times
Been thanked: 6 times

Re: script to update forge for linux

Postby Asta666 » 09 Mar 2017, 21:18

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).
Asta666
 
Posts: 46
Joined: 06 Oct 2010, 13:22
Has thanked: 3 times
Been thanked: 4 times

Re: script to update forge for linux

Postby vinnie » 09 Mar 2017, 22:01

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
User avatar
vinnie
 
Posts: 111
Joined: 21 Dec 2015, 14:03
Has thanked: 23 times
Been thanked: 6 times

Re: script to update forge for linux

Postby Asta666 » 09 Mar 2017, 22:35

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.
Asta666
 
Posts: 46
Joined: 06 Oct 2010, 13:22
Has thanked: 3 times
Been thanked: 4 times

Re: script to update forge for linux

Postby vinnie » 10 Mar 2017, 11:07

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.
User avatar
vinnie
 
Posts: 111
Joined: 21 Dec 2015, 14:03
Has thanked: 23 times
Been thanked: 6 times

Re: script to update forge for linux

Postby mussol » 21 Apr 2017, 10:43

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 :)
mussol
 
Posts: 2
Joined: 17 Apr 2017, 14:53
Has thanked: 0 time
Been thanked: 0 time

Re: script to update forge for linux

Postby Asta666 » 28 Apr 2017, 13:01

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.
Asta666
 
Posts: 46
Joined: 06 Oct 2010, 13:22
Has thanked: 3 times
Been thanked: 4 times

Re: script to update forge for linux

Postby Asta666 » 11 May 2017, 01:05

I updated the script to use xdg-user-dir and the new download url for the game.
Asta666
 
Posts: 46
Joined: 06 Oct 2010, 13:22
Has thanked: 3 times
Been thanked: 4 times

Re: script to update forge for linux

Postby Asta666 » 11 Jul 2017, 22:18

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:.
Asta666
 
Posts: 46
Joined: 06 Oct 2010, 13:22
Has thanked: 3 times
Been thanked: 4 times


Return to Forge

Who is online

Users browsing this forum: No registered users and 63 guests


Who is online

In total there are 63 users online :: 0 registered, 0 hidden and 63 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 63 guests

Login Form