Managing Metanorma versions on Linux using Snap
Introduction
There are occasions where a user may want to switch between multiple Metanorma versions, for example:
-
publishing a document of older schema no longer supported by newer Metanorma versions
-
verifying older documents using old schema
-
(the unfortunate) case that a document fails to compile by newer Metanorma versions
On Linux, users typically use Metanorma through Docker containers or the "metanorma" Snap package.
This article describes how to easily manage Metanorma versions through Snap, just with a few commands.
Snap packages
Snapcraft is a universal Linux packaging system, originally developed by Canonical of Ubuntu Linux fame, that allows developers to package their applications and dependencies, making it easy to distribute and install software across various Linux distributions.
Snaps (a "Snap package") are self-contained, sandboxed, and come with all the necessary dependencies, providing a consistent experience across different Linux distributions.
Installing Snap
On a Linux system, make sure you have the snapd service installed. snapd
is the "snap daemon", which is needed to install and utilize snap packages.
snapd can be installed it using the following commands on Ubuntu systems:
snapdsudo apt update
sudo apt install snapd
Installing the Metanorma snap package
The Metanorma snap package is aptly named metanorma.
To install the latest version of snap metanorma, run the following command in
your shell:
metanorma snap packagesudo snap install metanorma
This command will download and install the latest package from the Snap Store.
Downgrading the Metanorma snap package
In some cases, you might need to downgrade to a specific version of metanorma.
Snapcraft makes this process straightforward.
List installed versions
First, list the available versions of the metanorma snap package using the
following command:
metanorma snap packagesudo snap list metanorma --all
If you have several metanorma versions installed before you will get an output similar to this:
metanorma snap packageName Version Rev Tracking Publisher Notes
metanorma 1.7.3 212 latest/stable metanorma disabled,classic
metanorma 1.8.1 216 latest/stable metanorma classic
Revert to a previous version
metanorma snap package to a previous versionsudo snap revert metanorma
Revert to a specific previous version
metanorma snap package to a specific previous versionsudo snap revert metanorma --revision 212
List available versions
metanorma snap packagesnap info metanorma
Uninstall
To uninstall the metanorma snap package from your system, use the following
command:
metanorma snap packagesudo snap remove metanorma
Conclusion
When using the Snap version of metanorma on Linux, the benefits of the
Snapcraft approach are evident — simplified installation, version management,
and distribution of software.
While the downgrade process may not be the most straightforward, it is never further than a couple command presses!