Skip to content

systemd editを使って一部の設定を更新する

ファイルを直接編集してもいいが、systemctl edit を使うほうが安全だろう。

Terminal window
systemctl edit --user xdg-document-portal.service

これでドロップインとして差分を記述できるようになるので、次のように編集する。Edits below this comment … 以下は無視されるので、これより上に書く必要がある。当然パラメータ等はsystemdのユニットで利用できる変数がそのまま使える。

[Service]
ExecStart=
ExecStart=%h/bin/xdg-document-portal
# Edits below this comment will be discarded

ここで、最初に空の ExecStart を書いているのは、systemd - ArchWikiによると再割り当てのときは空であることを要求されるためらしい。

Note how ExecStart must be cleared before being re-assigned

ドロップインが適用されたかどうかは systemctl status をみれば分かる。