Skip to content

Commit

Permalink
Update for v1.2.0 (see CHANGES)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuiperzone committed Jul 3, 2022
1 parent d9252e2 commit c07a572
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 103 deletions.
6 changes: 3 additions & 3 deletions Assets/appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

<description>
<p>A longer description. This needs to be of minimum length, otherwise AppImageTool will give you a warning.
No description available (TBD). Add your own.</p>
No description available (TBD). Add your own here. This is a test - AppRoot: ${APPDIR_ROOT}</p>
</description>

<releases>
<release version="${VERSION}" date="${ISO_DATE}">
<description><p>This is a test release.</p></description>
<release version="${APP_VERSION}" date="${ISO_DATE}">
<description><p>This is a test release only.</p></description>
</release>
</releases>

Expand Down
17 changes: 17 additions & 0 deletions Assets/post-publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
# This is a dummy script only. It does nothing except output information.
# Ensure that it has executable permission and specify the POST_PUBLISH config parameter to point at it.

echo "DUMMY POST_PUBLISH SCRIPT"
echo "APP_MAIN: ${APP_MAIN}"
echo "APP_ID: ${APP_ID}"
echo "APP_VERSION: ${APP_VERSION}"
echo "VERSION: ${VERSION}"

echo "ISO_DATE: ${ISO_DATE}"
echo "DOTNET_RID: ${DOTNET_RID}"
echo "PKG_KIND: ${PKG_KIND}"
echo "APPDIR_ROOT: ${APPDIR_ROOT}"
echo "APPDIR_USR: ${APPDIR_USR}"
echo "APPDIR_BIN: ${APPDIR_BIN}"
echo "APPRUN_TARGET: ${APPRUN_TARGET}"
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Version 1.2.0
o Versioning of project output changed! Removed version (-x) arg from command line. Instead, specify APP_VERSION in the .conf file.
o Added dummy "post-publish.sh" file for test purposes only.
o Updates to readme file and conf file

Version 1.1.2
o Updated HelloWorld appdata.xml to avoid warnings.
o Fixed typos in readme
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Publish-AppImage for .NET
Copyright 2021 Andy Thomas
Copyright 2021-2022 Andy Thomas
https://kuiper.zone

MIT License
Expand Down
98 changes: 58 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
packages the output as an [AppImage](https://appimage.org/) file (or zip) with a single command. The Linux
"Desktop Entry" file is generated automagically.

It is licensed under MIT and for use on Linux with the [Microsoft .NET SDK](https://dotnet.microsoft.com/download)
It is licensed under MIT and is for use on Linux with the [Microsoft .NET SDK](https://dotnet.microsoft.com/download)
(i.e. for C# applications).

For latest information, see: https://kuiper.zone/publish-appimage-dotnet


## Pre-requisits ##
Publish-AppImage for .NET requires (*):
Expand All @@ -22,16 +20,16 @@ Publish-AppImage for .NET requires (*):
* The [appimagetool](https://github.com/AppImage/AppImageKit) utility to build the AppImage file
* The Linux "zip" utility is optional and typically may already be installed on your system

(*) Tested against .NET 5.0, bash 4.4.20, Zorin OS 15.3 (Ubuntu 18.04 LTS), appimagetool r13 (31 Dec 2020).
(*) Tested bash 4.4.20 and appimagetool r13 (31 Dec 2020).


## Build HelloWorld ##
The github repository provides a simple "HelloWorld" terminal demo application.
A simple "HelloWorld" terminal demo application is provided with the script.

<img title="Terminal Screenshot" alt="Terminal Screenshot" src="Screenie.png" style="width:50%;max-width:600px;"/>

Download and install [appimagetool](https://github.com/AppImage/AppImageKit). Ensure that `appimagetool` is
in the path, or you can specify its location in the .conf file if you have downloaded it as an AppImage.
**IMPORTANT:** Download and install [appimagetool](https://github.com/AppImage/AppImageKit). Ensure that `appimagetool`
is in the path, or you can specify its location in the .conf file if you have downloaded it as an AppImage file.

For example, in `publish-appimage.conf`, change this line:

Expand All @@ -41,34 +39,57 @@ to this as appropriate:

APPIMAGETOOL_COMMAND="/home/user/Apps/appimagetool-x86_64.AppImage"

The `publish-appimage` is just a bash script so there is no need to "build" it, but ensure that it has the
executable flag set. From the top-level project directory, simply type:
The `publish-appimage` file itself is just a bash script so there is no need to "build" it, but ensure that it
has the executable flag set. From the top-level project directory, simply type:

./publish-appimage

This will call `dot publish` and create the output local to the .conf file, i.e.: *AppImages/HelloWorld-x86_64.AppImage*

Run `AppImages/HelloWorld-x86_64.AppImage` from a terminal, and it will output version and location information
available to application. That's all it does!


## Use in Your Project ##
There are only two files you really need. Drop the files, below, into your application source preferably at the
same level as your solution (.sln) or project (.csproj) file. If you do not put `publish-appimage.conf` in the same
directory as your .sln or .csproj, you should specify the project location in the .conf file.
same level as your solution (.sln) or project (.csproj) file (*).

* `publish-appimage` - the utility
* `publish-appimage.conf` - project config
* `publish-appimage.conf` - your project config

Alternatively, if you wish, you may put the `publish-appimage` script in any directory on your system and add
the directory to the `PATH`. This way, only the ".conf file" need go into your project.

Alternatively, you may put the `publish-appimage` file in any directory on your system and add the directory to
the `PATH`. This way, only the ".conf file" need go into your project.
(*) If you do not wish to put `publish-appimage.conf` in the same directory as your .sln or .csproj, you can
specify the location with `DOTNET_PROJECT_PATH` in the .conf file.

**Note**, by default, publish-appimage will look for the publish-appimage.conf file (of that name) in the current
**Note**, by default, `publish-appimage` will look for a file called `publish-appimage.conf` in the current
working directly. However, all project related paths in the .conf file itself are relative to the location of the
.conf, and not from where command was called.
.conf file, and not from where command was called.

**IMPORTANT**: Edit the configuration file for your application, providing an application name etc. This should be a
relativel trivial matter and **all parameters are documented** with comments. You can specify application
"Desktop Entry" fields here, as well as publish/build arguments, and project and output locations.

If you wish to use an `appdata.xml`, copy the "Hello World" `appdata.xml` file and use it as a template in your project,
changing or adding properties to suit. Ensure that your `publish-appimage.conf` references the file location using
`APP_XML_SRC`. If you do not wish to use `appdata.xml`, ensure that `APP_XML_SRC` is unset.

An icon may also optionally be included in the AppImage. Ensure that your `publish-appimage.conf` references the
file location using `APP_ICON_SRC`.

## App Versioning ##
Use the APP_VERSION parameter in the .conf file to specify your application version, i.e. "1.2.3.0".

This will call publish with the `-p:Version` option and set the `VERSION` environment variable for use by
appimagetool. In the .conf file, you may optionally version the output package filename with `PKG_VERSION_FLAG`.

Edit the configuration file for your application, providing an application name etc. This should be a relatively
trivial matter and **all parameters are documented** with comments. You can specify application "Desktop Entry" fields
here, as well as publish/build arguments, and project and output locations.
## Post Publish Command ##
The configuration contains an option called `POST_PUBLISH`. This may contain one or more commands, or point
to a script file. It is called after `dotnet publish`, but before the final AppImage output. You can use
to create require directory structures under `AppDir` or copy additional files there.

An icon and appdata.xml may optionally be included in the AppImage. See the HelloWorld demo to see how this is done.
See also "Non-.NET Projects", below.


## Command Line Usage ##
Expand All @@ -80,17 +101,10 @@ By default, publish-appimage will build for "linux-x64". However, you can specif

For information, see: https://docs.microsoft.com/en-us/dotnet/core/rid-catalog

### Version ###
It's possible to provide your application version at the command-line:

./publish-appimage -x 1.2.3

This will call publish with the `-p:Version` option and set the `VERSION` environment variable for use by
appimagetool. In the .conf file, there is also an option to version the output package filename.

### Conf Filename ###
Your application source project may contain multiple .conf files, and can you specify the configuration to use at
the command line:
By default, `publish-appimage` looks for a single file called `publish-appimage.conf`. However, your
application project may contain multiple .conf files, but you must specify the configuration to use at
the command line, like so:

./publish-appimage -f other-file.conf

Expand Down Expand Up @@ -122,10 +136,6 @@ This will create a simple zip file of the published content instead of an AppIma
linux-x64 and linux-arm64. Default is linux-x64 if unspecified.
See also: https://docs.microsoft.com/en-us/dotnet/core/rid-catalog

-x, --app-version value
Application version supplied to the dotnet publish command as -p:Version=value.
It may also be used to form the output file. Example: --app-version 1.2.3.

-k, --kind value
Package output kind. Value must be one of: appimage or zip.
Default is appimage if unspecified.
Expand All @@ -143,20 +153,28 @@ This will create a simple zip file of the published content instead of an AppIma
## Additional Information ##
Publish-AppImage for .NET was created by Andy Thomas at https://kuiper.zone

For a cross-platform .NET GUI application: https://kuiper.zone/shannon-calculator-avalonia
See also my other C# project, a cross-platform Avalonia XAML previewer called [AvantGarde](https://github.com/kuiperzone/AvantGarde).

### Gotcha - symlink ###
Symlink is disabled in VirtualBox shared folders and will prevent appimagetool from working.
It is possible to enable them in VirtualBox. Alternatively, copy to the project to your home
directory in the virtual machine.
If you are using VirtualBox with your project within a shared folder, note that symbolic links are disabled within
shared folders by VirtualBox, and this will prevent `appimagetool` from working. To overcome this, copy
your entire project to your home directory in the virtual machine. Alternatively, it is possible to enable shared-folder
symlinks in VirtualBox.

### Non-.NET Projects? ###
I included the option of a "post-publish" command which may also serve to build a non-.NET project (i.e. C++).
However, I don't imagine this will be a primary use case. Peruse the .conf parameters to learn more.
It is also possible to use Publish-AppImage to build non-.NET projects (i.e. C++), although I don't imagine
this will be a primary use case. To do this, you must use a suitable build script and specify the file
location using the `POST_PUBLISH` config parameter. Your build script must populate the directory `AppDir/usr/bin`.

You should also set `DOTNET_PROJECT_PATH="null"` in order to disable the `dotnet publish` operation.

### Git Ignore? ###
You may wish to consider adding your output directory (i.e. "AppImages") to your gitignore file.

### Flatpak? ###
I initially intended that this utility spit out Flatpaks as well as AppImages. However, the configuration
and building of Flatpaks adds complexity. For the moment, I decided that this project was best served by
keeping things simple and elegant. I may do something on this a later, however.

Don't forget to like (star) and share this project (but only if *you do like it* of course).

4 changes: 2 additions & 2 deletions Source/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// #############################################################################
// PROJECT : Publish-AppImage for .NET
// WEBPAGE : https://kuiper.zone/publish-appimage-dotnet/
// COPYRIGHT : Andy Thomas 2021
// WEBPAGE : https://github.com/kuiperzone/Publish-AppImage
// COPYRIGHT : Andy Thomas 2021-2022
// LICENSE : MIT
// #############################################################################

Expand Down
Loading

0 comments on commit c07a572

Please sign in to comment.