🪴 notes

Search

Search IconIcon to open search

packaging into an appimage

Published Jul 31, 2023 Last updated Aug 1, 2023 Edit Source

Distribute a project using an appimage to linux users. Install appimage-builder and linuxdeploy.

define a .desktop file:

1
2
3
4
5
6
[Desktop Entry]
Name=project_name
Exec=binary_file_name
Icon=icon_name // without file extension
Type=Application
Categories=Utility // not sure if this is arbitrary

create an AppDir using linux deploy:

1
linuxdeploy -e target/release/binary --appdir binary.AppDir -i icon.png -d binary(project name).desktop

if there are any static files needed for the project, copy them into the AppDir/usr/bin directory.

1
2
cp other_bin ./binary.AppDir/usr/bin/other_bin
cp models/ ./binary.AppDir/usr/bin/models/ -r

then, create the appimage:

1
linuxdeploy --appdir $app_dir --output appimage

# Note:

The generated appimage is readonly. If the project needs to write files, make sure to write using absolute paths in application code to the user’s $HOME directory. Create $HOME/.project_name directory to contain all generated files.