From 7f6bb83cfe47f01ec21680c2549cd6e6d4a198f6 Mon Sep 17 00:00:00 2001
From: Steven Allen <steven@stebalien.com>
Date: Mon, 12 Sep 2022 18:00:26 -0700
Subject: [PATCH] fix: use the "state" directory in systemd unit files

As pointed out by @MrCowKing in, "${HOME}" isn't expanded. We use the
state directory as that's guaranteed to exist (and, in the default
configuration, will match the "HOME" directory of the ipfs user).

See: https://github.com/ipfs/kubo/commit/b47ecd0cba85905f18b85de9dd771008adf60fd0#commitcomment-83565661
---
 misc/systemd/ipfs-hardened.service | 2 +-
 misc/systemd/ipfs.service          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/misc/systemd/ipfs-hardened.service b/misc/systemd/ipfs-hardened.service
index 785a59829..45d1d7d1d 100644
--- a/misc/systemd/ipfs-hardened.service
+++ b/misc/systemd/ipfs-hardened.service
@@ -69,7 +69,7 @@ Type=notify
 User=ipfs
 Group=ipfs
 StateDirectory=ipfs
-Environment=IPFS_PATH="${HOME}"
+Environment=IPFS_PATH="%S"
 ExecStart=/usr/local/bin/ipfs daemon --init --migrate
 Restart=on-failure
 KillSignal=SIGINT
diff --git a/misc/systemd/ipfs.service b/misc/systemd/ipfs.service
index ab074e22e..c017f73a3 100644
--- a/misc/systemd/ipfs.service
+++ b/misc/systemd/ipfs.service
@@ -40,7 +40,7 @@ Type=notify
 User=ipfs
 Group=ipfs
 StateDirectory=ipfs
-Environment=IPFS_PATH="${HOME}"
+Environment=IPFS_PATH="%S"
 ExecStart=/usr/local/bin/ipfs daemon --init --migrate
 Restart=on-failure
 KillSignal=SIGINT
-- 
GitLab