libostree and $OSTREE_REPO environment path

libostree and $OSTREE_REPO environment path

libostree is a great tool to handle incremental or full updates for an Linux filesystem. But virtually all commands of ostree requires the --repo argument to override the default system repository path. This is really annoying after a while so my first attempt to get rid of this was to create an alias

alias ost='ostree --repo=/tmp/repo'

It works but is not good. To solve it once and for all I was about to implement support for getting the repo path from an environment variable.

When digging around in the code, I found that the support is already there but completely undocumented.

It is therefor already possible to

export OSTREE_REPO=/tmp/repo
ostree <cmd>

So the patch for this time is simply a line that mention the option to use $OSTREE_REPO environment variable to point out a directory as system repository path.

commit 075e676eb63a3abaf647c789e22d8d1afe3a1dd5
Author: Marcus Folkesson <marcus.folkesson@gmail.com>
Date:   Tue Oct 17 21:03:23 2017 +0200

docs: mention the $OSTREE_REPO environment variable

$OSTREE_REPO may be set to override the default location
of the repository.

Link: https://mail.gnome.org/archives/ostree-list/2017-October/msg00003.html

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>

Closes: #1282
Approved by: cgwalters

Conclusion

If /ostree/repo is not the location of your system repository, it is really preferable to set the $OSTREE_REPO environment variable instead of provide the --repo to every single command.