#1134202 utrans: consider not using systemctl

#1134202#5
Date:
2026-04-17 19:18:01 UTC
From:
To:
Hi,

when I feed utrans the gcr ssh service file, I get the following openRC
service as result:

#!/sbin/openrc-run
# Generated by /usr/bin/utrans from:
#  3f5912155b6468fd682eef487039c1c065978d092b1139657c8bf75a317fb4ca  /usr/lib/systemd/user/gcr-ssh-agent.socket
#  62f5646d4d8e3c13b8767d43b58a5e3a886388cd9549954a7ee0c41e180a55d4  /usr/lib/systemd/user/gcr-ssh-agent.service

description="GCR ssh-agent wrapper."

supervisor="supervise-daemon"
command="/usr/bin/socket-activate"
command_args="--unix::${XDG_RUNTIME_DIR:-/run}/gcr/ssh -- /usr/libexec/gcr-ssh-agent --base-dir ${XDG_RUNTIME_DIR:-/run}/gcr"
start_pre() {
  mkdir -p -m 0700 ${XDG_RUNTIME_DIR:-/run}/gcr
}
start_post() {
  /usr/bin/systemctl --user set-environment SSH_AUTH_SOCK=${XDG_RUNTIME_DIR:-/run}/gcr/ssh || true
}

start_post has a systemctl invocation; while a systemctl alternative
exists that's not tied to systemd IMO this is not what we desire here.
SSH_AUTH_SOCK should be exported by the service, and unset if the
service terminates. Right now, I have this as (local) workaround
(without a service):


# hack to get gcr-sshagent to work
# FIXME: convert to openRC service
exec mkdir -p /run/user/1000/gcr
exec /usr/libexec/gcr-ssh-agent --base-dir=/run/user/1000/gcr

and

export SSH_ASKPASS=/usr/libexec/gcr4-ssh-askpass
export SSH_AUTH_SOCK=/run/user/1000/gcr/ssh

I realize utrans should only serve as base to quickly get services that
work however.

Thanks for maintaining openRC and utrans!

best,

werdahias

#1134202#8
Date:
2026-04-18 19:22:25 UTC
From:
To:
Matthias,

Thanks for this.

I already have a local commit to skip such systemd-specific commands with a
warning. See below.

I agree that it would be good to translate such commands to the relevant
environment. The issue is to come up with a sufficiently specific way of
detecting it is required. I will give it some thought.

Best wishes

Mark

commit 75fe900cb65a1b6999034b35b08ef456c7290583
Author: Mark Hindley <mark@hindley.org.uk>
Date:   Wed Dec 10 16:53:04 2025 +0000

    Warn and disable systemd-specific commands that require manual translation.

diff --git a/utrans b/utrans
index e1b9d1c..f3c05ad 100755
--- a/utrans
+++ b/utrans
@@ -219,7 +219,13 @@ parse_section() {
 					var["${key}"]+=$'\n'
 				fi
 				if [[ "${value}" ]]; then
-					var["${key}"]+="${value}"
+					if [[ "${key}" =~ ^Exec && "${value}" =~ (bus|network|system)ctl ]]; then
+						var["${key}"]+="# Translate this systemd-specific command maually:"$'\n'
+						var["${key}"]+="#$key: ${value}"
+						echo "Systemd specific command requires manual translation: [$key] $value" >&2
+					else
+						var["${key}"]+="${value}"
+					fi
 				else
 				    	var["${key}"]="${value}" # Empty value resets
 				fi