[SM-Commit] GIT changes to master grimoire by Thomas Orgis (c0695802d6900775e09054cef09412bdd1fd8647)

Andrew Stitt afrayedknot at t.armory.com
Mon Jan 22 21:11:37 EST 2007

On Tue, Jan 23, 2007 at 04:09:00AM +0500, Pol Vinogradov wrote:
> On Mon, 22 Jan 2007 22:53:12 +0100
> Thomas Orgis <thomas-forum at orgis.org> wrote:
> > Am Tue, 23 Jan 2007 02:40:42 +0500
> > schrieb Pol Vinogradov <vin.public at gmail.com>:
> >
> > > > +    grpck "$INSTALL_ROOT/etc/passwd" "$INSTALL_ROOT/etc/shadow"
> > > > +  }
> > > > +fi
> > > imho, there should be $TRACK_ROOT, see this:
> > > http://sourcemage.org/node/1285
> >
> > We are in CONFIGURE, that is we are running commands in the host
> > system. We want to modify files under $INSTALL_ROOT. Sounds sensible
> > to me. We use $INSTALL_ROOT like that in other spells (p.ex. init.d,
> > smgl-fhs). You sure that there should be a TRACK_ROOT?
> >
> TRACK_ROOT is used to locate files on system, INSTALL_ROOT is a place
> where files will be installed. so, imagine: i changed INSTALL_ROOT
> to /smthg, there's no passwd and shadow (nor groups nor gshadow) and
> grpck checks unexistant files... imho, it's wrong

Briefly: INSTALL_ROOT is the correct variable. It really is that simple.

This is not actually very complicated. The wiki page sucks due to many
poor attempts at clarification. If you come into it expecting the
variables to mean something, you'll just be more confused. Clear your
mind of any preconcieved notions of what the variables mean. Below I
will try again, to clarify things for people. Hopefully someone will
take this and clean it up into something more polished.

There are two distinct ideas at play, I will explain them as concisely
as possible, then describe INSTALL_ROOT and TRACK_ROOT, it should be
clear how the ideas map to the variables.

A file has both a location, and contents. These are independent of each
other. You can move a file, and it still has the same contents.
Similarly, if you chroot, the file still has the same contents, its just
in a different location. This shouldn't be very new or profound.

INSTALL_ROOT indicates where the files reside, or will reside, in the
filesystem _as_you_are_currently_looking_at_it. The files might be
executed somewhere else, on a different platform, from a different
prefix, anything. This is just where the files either *are* or where
they will *go*. Nothing more.

In the context of a spell, "test -e" with $INSTALL_ROOT as a prefix makes
sense. Similarly, if you need to create or modify a file on the system,
its name should be prefixed with $INSTALL_ROOT.

TRACK_ROOT is where the files will be used from. It doesnt matter where
the files were installed to. This value is cooked into the binaries and
is used at "runtime" to find files, not in the spell. This is where
symlinks point to, what gets stored in software config files, and any
other hard-coded search-paths, etc.

In the context of a spell you never modify a filename prefixed with
$TRACK_ROOT. You might put TRACK_ROOT *inside* a file. But you *never*
modify a filename prefixed by TRACK_ROOT.

So, if I want to create a chroot, I set INSTALL_ROOT to /somewhere, and
I set TRACK_ROOT to "". That means the files will be *installed* to
/somewhere. But when I run them, they will expect to find things under
/, *not* /somewhere. There shouldn't be any trace of "/somewhere" in any
of the files installed (eg no "double chrooting").

If I want to install software to an alternate location, lets say firefox,
I set INSTALL_ROOT to /opt/firefox, and I set TRACK_ROOT to
/opt/firefox. That means the files will be installed to /opt/firefox,
and when I run firefox, it will expect to find things under /opt/firefox
also; as opposed to on / where (hypothetically) theres another version
of firefox installed.

Also, ignore what sorcery is doing behind the scenes in the logs, and
with castfs, etc. Think about what the variables are for, not what
sorcery does. You'll only confuse yourself more by looking at what
sorcery is doing, it has the opposite perpective as you.

INSTALL_ROOT prefix for where files go, it is touchable
TRACK_ROOT prefix for what goes in files, it is not touchable

When building files, build things with the expectation that they will be
run from $TRACK_ROOT.
When installing files, put them in $INSTALL_ROOT (castfs does this for you).
When modifying files on the system, use $INSTALL_ROOT.
When modifying the contents of files, use $TRACK_ROOT.

$INSTALL_ROOT -- location
$TRACK_ROOT -- contents


More information about the SM-Commit mailing list