Identifier interpretation¶
The following table provides a comprehensive understanding of various identifiers used in the system. If an identifier is invalid, it will remain unchanged. In this context, the term user refers to the owner of the process.
Identifiers are replaced at two distinct moments:
- When parsing a frontend file (
66 parse,66 enable, ...), so that a single generic frontend produces a service tailored to its owner (and, for an instantiated service, to its instance). - At runtime, when an environment is loaded, so owner-specific values are resolved on the running machine rather than baked in at parse time. This happens in two places:
- When a scandir is brought up (
66 scandir start, or the boot/user scandir), inside the files of the scandir environment directory (/etc/66/environmentforroot,~/.66/environmentfor a user), so the environment exported to the whole scandir carries owner-specific values. - When a service's environment file or directory is loaded (through
execl-envfile) before the service is executed.
- When a scandir is brought up (
| Identifier | Meaning | Replaced by |
|---|---|---|
@I |
Instance name | For instantiated services, this is the string between the first @ character and the rest of the instantiated service name. For non-instantiated services, it is the service name. Parse time only (see below). |
@U |
User name | The user name. If the user is 0, it is replaced by root. |
@u |
User UID | The numeric user ID (UID). |
@G |
User group | The user group name. |
@g |
User GID | The numeric group ID (GID). |
@H |
User home directory | The user's home directory. For user 0, it is /root. |
@S |
User shell | The user’s shell. |
@R |
User runtime directory | The user's runtime directory. For user 0, it is /run; for other users, it corresponds to $XDG_RUNTIME_DIR. |
By understanding these identifiers and their replacements, you can effectively create and manage service files and scandir environment files, ensuring that owner-specific details are correctly populated.
@I is parse time only¶
@I resolves an instance name, which only exists while parsing an instantiated frontend such as tty@tty1. There is no instance context at runtime, so @I is never expanded at runtime: it is left untouched in scandir environment files and in service environment files loaded by execl-envfile. Every other identifier is expanded in every context and resolves against the process owner.
Examples of identifiers usage¶
-
Using
@RidentifierOriginal file:
dbus@[Main] Type = classic Version = 0.7.0 Description = "dbus session daemon for @U user" User = ( user ) [Start] Timeout = 3000 Notify = 4 MaxDeath = 3 Execute = ( /usr/bin/execl-cmdline -s { /usr/bin/dbus-daemon ${Args} } ) [Stop] Execute = ( /usr/bin/rm -f ${Socket} ) [Environment] Args=!--session --print-pid=4 --nofork --nopidfile --address=unix:path=${Socket} Socket=!@R/busResult after calling
66 parse dbus@oblivewhere oblive has UID1000[Main] Type = classic Version = 0.7.0 Description = "dbus session daemon for oblive user" User = ( user ) [Start] Timeout = 3000 Notify = 4 MaxDeath = 3 Execute = ( /usr/bin/execl-cmdline -s { /usr/bin/dbus-daemon ${Args} } ) [Stop] Execute = ( /usr/bin/rm -f ${Socket} ) [Environment] Args=!--session --print-pid=4 --nofork --nopidfile --address=unix:path=${Socket} Socket=!/run/user/1000/busIn this example, the
@Ridentifier is replaced by/run/user/1000, updating the Socket field with the correct runtime directory for the user oblive. The@Uidentifier is replaced by oblive in the Description field. -
Using
@IidentifierOriginal file:
tty@[Main] Type = classic Version = 0.0.1 Description = "Launch @I" User = ( root ) [Start] Execute = ( agetty -J 38400 @I )Result after calling
66 parse tty@tty1[Main] Type = classic Version = 0.0.1 Description = "Launch tty1" User = ( root ) [Start] Execute = ( agetty -J 38400 tty1 )In this example, the
@Iidentifier is replaced bytty1, resulting in the Description and Execute fields being updated accordingly. -
Using identifiers in the scandir environment
A file
~/.66/environment/xdgfor the user oblive (UID1000):XDG_CACHE_HOME=@H/.cache XDG_CONFIG_HOME=@H/.config XDG_RUNTIME_DIR=@ROnce the user scandir is brought up, the environment exported to the whole scandir becomes:
XDG_CACHE_HOME=/home/oblive/.cache XDG_CONFIG_HOME=/home/oblive/.config XDG_RUNTIME_DIR=/run/user/1000Here
@His replaced by the owner's home directory and@Rby the owner's runtime directory. An@Iappearing in such a file would be kept as-is, since a scandir has no instance.