Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the appimage able to update itself #9

Closed
andy5995 opened this issue Oct 14, 2022 · 33 comments · Fixed by #36 or #37
Closed

Make the appimage able to update itself #9

andy5995 opened this issue Oct 14, 2022 · 33 comments · Fixed by #36 or #37

Comments

@andy5995
Copy link
Member

This would be nice. I don't know when I'll get to it though. Post on the ticket and let me know if you want to try tackling this issue. I might be able to help.

Making AppImages updateable

@andy5995
Copy link
Member Author

andy5995 commented Mar 9, 2023

Probably not worth it because there's so much data that gets changed between releases. Downloading an update would be about the same size as a release.

@andy5995 andy5995 closed this as completed Mar 9, 2023
@rautamiekka
Copy link

Let's try it first, please. Surely even a very tight compression (like LZMA2 at Ultra) of the contents will still make the image correctly updateable.

I can only help by trying to run the update as an end user, though.

@andy5995
Copy link
Member Author

@rautamiekka Thanks for the the feedback. I'll reopen the issue.

@andy5995
Copy link
Member Author

@ivan-hc said in #34 :

OFF-TOPIC: want to made it updateable?

If you use AppImagetool from https://github.com/AppImage/appimagetool, its enough you do

APPNAME="0ad"
REPO="0ad-appimage"
TAG="latest"
VERSION="0.27.0-2501310402"
UPINFO="gh-releases-zsync|$GITHUB_REPOSITORY_OWNER|$REPO|$TAG|*x86_64.AppImage.zsync"

ARCH=x86_64 ./appimagetool --comp zstd --mksquashfs-opt -Xcompression-level --mksquashfs-opt 20 \
	-u "$UPINFO" \
	./"$APP".AppDir "$APPNAME"_"$VERSION"-x86_64.AppImage

where GITHUB_REPOSITORY_OWNER is "0ad-matters" (if you run it in github actions workflows) and "$APP".AppDir is the AppDir, I don't know what's the name you use

@andy5995
Copy link
Member Author

@ivan-hc Yes that might be much more convenient for some people if it were updateabe.

From your example, I'm not sure yet how it would work. I'll have to look more later and ask questions. If you want to open up a pull request to make the necessary changes, I could probably figure things out as we go, with your help.

@ivan-hc
Copy link
Contributor

ivan-hc commented Jan 31, 2025

@andy5995 this is the same command I use in almost all my repositories (to be honest, @Samueru-sama pointed me on this)

All you need is:

  1. the latest appimagetool from https://github.com/AppImage/appimagetool/releases/tag/continuous
  2. your appdir

after you finished with the tool you use to create the AppImage, use appimagetool to convert the app directory (appdir) to an AppImage

the command in my comment does the follow:

  • compresses the appdir using zstd with level 20
  • includes th update info

that's all, a .zsync file with the same name of the AppImange will be created as well.

VERSION="0.27.0-2501310402"
ARCH=x86_64 ./appimagetool --comp zstd --mksquashfs-opt -Xcompression-level --mksquashfs-opt 20 \
	-u gh-releases-zsync|0ad-matters|0ad-appimage|latest|*x86_64.AppImage.zsync \
	./0ad.AppDir 0ad_"$VERSION"-x86_64.AppImage

I translated the line in the middle, the one referencing to the .zsync file.

If you want to allow forks, leave $GITHUB_REPOSITORY_OWNER instead of 0ad-matters. Its not difficult, this is the $UPINFO variable as before:

APPNAME="0ad"
REPO="0ad-appimage"
TAG="latest"
VERSION="0.27.0-2501310402"
UPINFO="gh-releases-zsync|$GITHUB_REPOSITORY_OWNER|$REPO|$TAG|*x86_64.AppImage.zsync"

ARCH=x86_64 ./appimagetool --comp zstd --mksquashfs-opt -Xcompression-level --mksquashfs-opt 20 \
	-u "$UPINFO" \
	./"$APP".AppDir "$APPNAME"_"$VERSION"-x86_64.AppImage

where GITHUB_REPOSITORY_OWNER is "0ad-matters" (if you run it in github actions workflows) and "$APP".AppDir is the AppDir, I don't know what's the name you use

let me see the part of your script where you convert the AppDir to an AppImage.

@ivan-hc
Copy link
Contributor

ivan-hc commented Jan 31, 2025

just noticed that you are using docker, maybe if the appimagetool can't be mounted, you should also use --appimage-extract-and-run... or alternativelly leave appimagetool itself taking care of conversion to AppImage directly, from Ubuntu.

@ivan-hc
Copy link
Contributor

ivan-hc commented Jan 31, 2025

If you want to open up a pull request to make the necessary changes, I could probably figure things out as we go, with your help.

@andy5995 I just forked the repository, please let me know how to only create the AppDir

linuxdeploy \
    -d $SOURCE_ROOT/build/resources/0ad.desktop \
    --icon-file=$SOURCE_ROOT/build/resources/0ad.png \
    --icon-filename=0ad \
    --executable $APPDIR/usr/bin/pyrogenesis \
    --library=/usr/lib/$ARCH-linux-gnu/libthai.so.0 \
    --custom-apprun=$WORKSPACE/AppRun \
    --appdir $APPDIR \
    --output appimage \
    --plugin gtk
fi

should I remove some flags from the above function? I suppose that --output appimage is the responsible of creating tha AppImage... isn't it?

@ivan-hc
Copy link
Contributor

ivan-hc commented Jan 31, 2025

Just added a commit in my fork ivan-hc@d23b7d8

Now I'll test if it works https://github.com/ivan-hc/0ad-appimage/actions/runs/13080646013

@ivan-hc
Copy link
Contributor

ivan-hc commented Jan 31, 2025

If this has succes, wil also solve #33

@ivan-hc
Copy link
Contributor

ivan-hc commented Jan 31, 2025

I got an error also if the Appimage have been released.

Just added zsync and desktop-file-utils to have the .zsync file

The next workflow should do for our purpose https://github.com/ivan-hc/0ad-appimage/actions/runs/13081451548

@ivan-hc
Copy link
Contributor

ivan-hc commented Jan 31, 2025

It seems that worked... but I made some mistake, the "latest" release also has the AppImages of my previous test

Image

in this moment I'm downloading the AppImage, so I can test if update works.

@ivan-hc
Copy link
Contributor

ivan-hc commented Jan 31, 2025

@andy5995 I don't know why, but with appimageupdatetool it does not works, on the contrary of zsync that works

simplescreenrecorder-2025-02-01_00.01.05.mp4

@ivan-hc
Copy link
Contributor

ivan-hc commented Jan 31, 2025

Maybe the issue is that the target repository is a fork or something... I don't know why

@probonopd do you know why I get this error with appimageupdatetool?

Checking for updates...
terminate called after throwing an instance of 'appimage::update::updateinformation::UpdateInformationError'
  what():  GitHub API request failed: HTTP status 404, CURL error:

@ivan-hc
Copy link
Contributor

ivan-hc commented Jan 31, 2025

@ivan-hc
Copy link
Contributor

ivan-hc commented Jan 31, 2025

I think I found the issue

Image

its time to made the PR

@ivan-hc
Copy link
Contributor

ivan-hc commented Feb 1, 2025

@andy5995 I think this message should disappear once the AppImage and its zsync files are hosted on the right repo

Image

I start PR this

@andy5995
Copy link
Member Author

andy5995 commented Feb 1, 2025

If you want to open up a pull request to make the necessary changes, I could probably figure things out as we go, with your help.

@andy5995 I just forked the repository, please let me know how to only create the AppDir

linuxdeploy \
    -d $SOURCE_ROOT/build/resources/0ad.desktop \
    --icon-file=$SOURCE_ROOT/build/resources/0ad.png \
    --icon-filename=0ad \
    --executable $APPDIR/usr/bin/pyrogenesis \
    --library=/usr/lib/$ARCH-linux-gnu/libthai.so.0 \
    --custom-apprun=$WORKSPACE/AppRun \
    --appdir $APPDIR \
    --output appimage \
    --plugin gtk
fi

should I remove some flags from the above function? I suppose that --output appimage is the responsible of creating tha AppImage... isn't it?

As far as I know, those are all needed. And yes, the --output argument is required.

I didn't answer all your questions but I think you found answers and we are up to date. Is there anything I missed? I know you have a build running right now and very close to completing this.

@ivan-hc
Copy link
Contributor

ivan-hc commented Feb 1, 2025

Yes, I have already completed some workflows... but I manually remove releases not to confuse myself when I must test them.

Anyway, next workflow should be successful https://github.com/ivan-hc/0ad-appimage/actions/runs/13083937340

About updates via appimageupdatetool, we only need to test this on the main branch... or at least, on a fork, with a different GITHUB_REPOSITORY_OWNER
https://github.com/ivan-hc/0ad-appimage/blob/b428372a8a92d4024134609fbccd3683548b7efd/make-appimage.sh#L222C8-L222C31

@andy5995
Copy link
Member Author

andy5995 commented Feb 1, 2025

Re-opening. We still need to a little testing and update docs.

@andy5995 andy5995 reopened this Feb 1, 2025
@ivan-hc
Copy link
Contributor

ivan-hc commented Feb 1, 2025

@andy5995 I was right, it needed to be hosted on the repo with the name of the owner

simplescreenrecorder-2025-02-01_05.02.02.mp4

...this means its working!

@ivan-hc
Copy link
Contributor

ivan-hc commented Feb 1, 2025

@andy5995 same for the zsync file

simplescreenrecorder-2025-02-01_05.03.44.mp4

@ivan-hc
Copy link
Contributor

ivan-hc commented Feb 1, 2025

Now, I suggest to keep only one per architecture, so people (me including) can download and update the right one.

NOTE, as I wrote in the script, TAG is "latest", so every time you release a new one in "latest" it will get updates from there. No pre-releases are targeted (for them I think you should add a dedicated script and workflow).

@ivan-hc
Copy link
Contributor

ivan-hc commented Feb 1, 2025

Now, I suggest to keep only one per architecture, so people (me including) can download and update the right one.

One also because my package manager "AM" targets this release with wget and curl

@ivan-hc
Copy link
Contributor

ivan-hc commented Feb 1, 2025

@andy5995 since you just updated the AppImage, here you are the proof that updates are working as they should

simplescreenrecorder-2025-02-01_05.40.37.mp4

I think this issue is finally SOLVED!

@andy5995
Copy link
Member Author

andy5995 commented Feb 1, 2025

Yes, I experimented myself using the AppImageUpdate appimage https://github.com/AppImageCommunity/AppImageUpdate

Should that be added to the readme or is there a different tool? I searched for appimageupdatetool with pacman and also in the AUR (I use Manjaro) but it's not available.

@ivan-hc
Copy link
Contributor

ivan-hc commented Feb 1, 2025

Should that be added to the readme or is there a different tool?

People can use both appimageupdatetool and zsync

I searched for appimageupdatetool with pacman and also in the AUR (I use Manjaro) but it's not available.

Well, maybe its time for you to use something different ;) https://github.com/ivan-hc/AM

To install it system-wide

am -i appimageupdatetool

to install it locally in a rootless way

am -i --user appimageupdatetool

or

appman -i appimageupdatetool

@ivan-hc
Copy link
Contributor

ivan-hc commented Feb 1, 2025

Since 0ad is a big AppImage, I keep it on a separated drive, so I can also integrate it insteado of installing it as another app listed... and it is updateable as well

simplescreenrecorder-2025-02-01_05.54.17.mp4

...sorry for the long video, I wrote so many options and flags that I forgot that to update AppImages only integrated and NOT installed, you need to run

am -u --launcher

...and --launcher is also an option that has the same task of a normal AppImageLauncher or Gear Lever.... but in pure SHELL.

@andy5995
Copy link
Member Author

andy5995 commented Feb 1, 2025

Should that be added to the readme or is there a different tool?

People can use both appimageupdatetool and zsync

I searched for appimageupdatetool with pacman and also in the AUR (I use Manjaro) but it's not available.

Well, maybe its time for you to use something different ;) https://github.com/ivan-hc/AM

lol, ok! I'll try it out tomorrow. So late...

@ivan-hc
Copy link
Contributor

ivan-hc commented Feb 1, 2025

So late...

please, don't tell me... its 6 am here in Italy... big part of my work on github is done at night (maybe it would be another reason because AM is called AM... its done at night) 😆

@andy5995
Copy link
Member Author

andy5995 commented Feb 1, 2025

NOTE, as I wrote in the script, TAG is "latest", so every time you release a new one in "latest" it will get updates from there. No pre-releases are targeted (for them I think you should add a dedicated script and workflow).

@ivan-hc I understand there can be only one "latest" release, but I do I target pre-releases, since there can be more than one? Like when I want to target the latest prelease. Can I reference it by the tag or commit hash shown on the release page? Such as on here, where the tag and commit hash is shown?

@ivan-hc
Copy link
Contributor

ivan-hc commented Feb 1, 2025

@andy5995 I think pre-release means anything, while "latest" is only one, regardless if the tag has a number.

I mean, you can also use $VERSION as $TAG, if it is different... or maybe you can use a dedicated tag "nightly" or "pre-release" if you want.

Remember, "latest" is only one and it can be replaced by a new "latest", on github.

On the contrary, other builds require a dedicated tag.

@Samueru-sama do you know how to do when the repo also conatains several pre-releases?

@andy5995
Copy link
Member Author

andy5995 commented Feb 2, 2025

@ivan-hc I think you answered all my questions. It can basically just be whatever comes after '/tag/' in the release URL, e.g. https://github.com/0ad-matters/0ad-appimage/releases/tag/v0.0.26-alpha would be v0.0.26-alpha so easy enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants