fusion809 / AppImages

[NO LONGER MAINTAINED] My repository of recipes for building AppImages. Fork of https://github.com/probonopd/AppImages.
https://fusion809.github.io/appimages/
MIT License
10 stars 0 forks source link

How do I add an auto-updating feature to my Atom (and perhaps other) AppImage? #7

Open fusion809 opened 7 years ago

fusion809 commented 7 years ago

Hi,

@probonopd Please do explain how I might add an auto-update feature to my AppImages (for those looking at this issue later, this has started out of atom/atom#2956).

Thanks for your time, Brenton

probonopd commented 7 years ago

Add to the app in question (pseudocode):

if($ENV[APPIMAGE]); then
  menu.help.add("Update...");
fi

onClicked(menu.help.Update){
  exec('AppImageUpddate $ENV[APPIMAGE]');
}

and put AppImageUpdate into usr/bin of the AppImage. Finally put update information into your AppImage, e.g., using appimagetool:

./appimagetool Your.AppDir -u zsync|http://server.domain/path/Your-latest-x86_64.AppImage.zsync

As a result, whenever the user chooses that menu, AppImageUpdate is launched and will check for available updates, then update the AppImage if a newer one is there.

fusion809 commented 7 years ago

How would:

./appimagetool Your.AppDir -u zsync|http://server.domain/path/Your-latest-x86_64.AppImage.zsync

work for AppImages uploaded to Bintray? After all the Your-latest depends on the latest version of the app (which differs at any given time).

probonopd commented 7 years ago

For Bintray, there is the alternative form as per the spec:

bintray-zsync|username|reponame|packagename|Package-_latestVersion-x86_64.AppImage.zsync
fusion809 commented 7 years ago

Is it possible to get the app to automatically run update on app startup (to ensure if a new version of Atom is available on startup it will update to it)? Because adding that to my Atom AppImage will require me to edit the Atom source code itself and that sounds like a headache I don't need. Especially seeing how I know very little CoffeeScript/JS.

probonopd commented 7 years ago

Come on, it's just adding one menu item, and adding one line of exec code to that menu item :-)

probonopd commented 7 years ago

You don't really want the AppImageUpdate dialog come up on each application launch...

fusion809 commented 7 years ago

Which file though? Running:

grep --include="*" -R "About Atom"

from the source's top-level directory (where "About Atom" is a menu item in the Help menu) returns:

menus/win32.cson:      { label: 'About Atom', command: 'application:about' }
menus/darwin.cson:      { label: 'About Atom', command: 'application:about' }
menus/linux.cson:      { label: 'About Atom', command: 'application:about' }

which are CSON files, where I do not believe I could even add your code...

probonopd commented 7 years ago

menus/linux.cson since AppImage is a Linux thing.

fusion809 commented 7 years ago

What app provides the bintray-zsync command? In a new repo of mine, fusion809/Atom.AppImage on line 308 of my Recipe I run:

VERSION=$VERSION ./appimagetool -n --bintray-user $BINTRAY_USER --bintray-repo $BINTRAY_REPO -v ./$APP.AppDir/ -u bintray-zsync|fusion809|Atom.AppImage|Atom|Atom-_latestVersion-x86_64.AppImage.zsync

(which is what I assumed it should be given your previous comments) but it fails giving the error:

+chmod a+x ./appimagetool
+VERSION=1.14.4.glibc2.14
+./appimagetool -n --bintray-user fusion809 --bintray-repo -v ./Atom.AppDir/ -u bintray-zsync
+fusion809
Recipe: line 308: fusion809: command not found
+Atom.AppImage
Recipe: line 308: Atom.AppImage: command not found
+Atom
Recipe: line 308: Atom: command not found
+Atom-_latestVersion-x86_64.AppImage.zsync
Recipe: line 308: Atom-_latestVersion-x86_64.AppImage.zsync: command not found
Arch: 86_64
Deleting pre-existing .DirIcon
Creating .DirIcon symlink based on information from desktop file
Generating squashfs...
Embedding ELF...
Marking the AppImage as executable...
zsyncmake is installed and updateinformation is provided, hence generating zsync file
Success
fusion809 commented 7 years ago

As for the CSON well how do I implement your paracode in it? It's a CSON file so it won't follow your paracode's syntax... That's what my question was, I knew it should be linux.cson, of all of those files... So what should I insert in that file?

probonopd commented 7 years ago

You need to quote the update information string:

VERSION=$VERSION ./appimagetool -n --bintray-user $BINTRAY_USER --bintray-repo $BINTRAY_REPO -v ./$APP.AppDir/ -u 'bintray-zsync|fusion809|Atom.AppImage|Atom|Atom-_latestVersion-x86_64.AppImage.zsync'
probonopd commented 7 years ago

As for the CSON well how do I implement your paracode in it?

I don't know, never coded anything in Electron. But I am sure the Electron devs can do it in 1 minute :-)

fusion809 commented 7 years ago

I can tell you here and now it will probably take at least a day before I have an answer from discuss.atom.io (here is where I asked it). They usually take quite a while for such technical questions... Seems like this is a little more challenging than ya lead me to believe.

probonopd commented 7 years ago

@fusion809 I hope you agree that adding a menu item to an application is outside of the scope of AppImage itself. I was referring to adding the update-ability ;-)

fusion809 commented 7 years ago

Well it's required in order to add the auto-update ability, so it is relevant to the question of how difficult it is to implement.

fusion809 commented 7 years ago

Sorry, I'm in a bit of a bad mood. Ya I realize it's not something you have control over, that the app is a pain to add a new menu item to.