NAME
utrans - convert systemd units to generic unix equivalents
SYNOPSIS
utrans [-b [=]<BACKEND>[,<BACKEND>]] [-f <TYPE>] [-h] [-v] <UNIT> <OUTPUT_DIR>
OPTIONS
The following commandline options are supported:-
- -b <BACKEND>
-
load the specified backend(s). Can be a comma separated list. See BACKENDS below for further details.
- -f <TYPE>
-
force; valid types are:
-
overwrite: allow overwriting existing output files
- -h
-
open manpage
- -v
-
show version
DESCRIPTION
utrans translates systemd services, sockets and timers to corresponding generic UNIX configuration and scripting as used in alternative settings that exclude systemd.
<UNIT> is the pathname for the unit file to translate.
- •
-
Service units are converted to openrc-run(8) service scripts.
- •
-
Socket units are converted either to an xinetd(8) configuration or an openrc-run(8) script using socket-activate(1), depending on the requirements of the socket.
- •
-
Timer units are converted to a crontab(5) fragment mapping systemd.time(7) events to a cron(8)-compatible expressions.
USAGE
utrans accepts two arguments: the systemd.unit(5) file (<UNIT>) and the output directory (<OUTPUT_DIR>). The systemd.unit(5) file which can be one of systemd.service(5), systemd.socket(5) or systemd.timer(5).
The script will create files in the following output subdirectories of <OUTPUT_DIR> depending on the unit type:
| Unit | Output |
| Service | An openrc-run(8) script is created in init.d and a complementary file is created in conf.d if needed, for sourcing additional additional environment variables. |
| Socket | Depending upon the socket's configuration, an xinetd(8) configuration fragment is created in xinetd.d, or an openrc-run(8) script is created in init.d to start the service with socket-activate(1), . |
| Timer | A separate crontab(5) fragment is created into cron.d for each timer unit. |
When the unit translation requires other units, then these are searched in the paths defined in the environment variable $SYSTEMD_UNIT_PATH, or in /usr/lib/system/system:/lib/systemd/system by default.
BACKENDS
Backends are used for producing different output for different settings. utrans finds and sources backend script fragments from the $UTRANS_DATA_DIR/backends directory or from /usr/share/utrans/backends by default.
If the backend is prefixed with =, the default backends are not loaded.
The following backends are available:
| Backend | Unit | Notes |
| openrc | Service | Loaded by default |
| xinetd | Socket | Loaded by default |
| cron | Timer | Loaded by default |
| inetd | Socket | Only supports ListenStream and ListenDatagram using update-inetd(8) |
| lsb | Service | Alpha quality support for scripts with LSB-style insserv(8) headers |
Contributions of other backends are welcome: see backends/README for further details.
LIMITATIONS
The following are known cases of poor or variant functionality:
- •
-
Some special Executable Prefixes are ignored after warning.
- •
-
Unescaping specifiers doesn't distinguish context: if you require a filesystem path, start the instance with '-'.
Patches are welcome at https://git.devuan.org/LeePen/unit-translator!
SEE ALSO
COPYRIGHT
BSD-2-Clause License https://opensource.org/licenses/BSD-2-Clause
Copyright (c) 2020, K Gopal Krishna.
Copyright (c) 2023-2024, Mark Hindley
AUTHORS
K Gopal Krishna <[email protected]> under the guidance of Benda Xu <[email protected]>, Adam Borowski <[email protected]> and Mo Zhou <[email protected]>.
This project was a part of Google Summer of Code, 2020.
Mark Hindley <[email protected]>