56bc30854f0aae8f5f4037991a8b7d354252e16f

Author
Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Committer
Ayman Bagabas <ayman.bagabas@gmail.com>
Date

Message

feat: s/soft/soft-serve/; sysusers; tmpfiles

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

Diff

  1diff --git a/.nfpm/postinstall.sh b/.nfpm/postinstall.sh
  2index c3e1de5300fe44cd774c145abc1744c1fceba2f3..85b4f8a68972f491a3147344cf847505a46f161f 100755
  3--- a/.nfpm/postinstall.sh
  4+++ b/.nfpm/postinstall.sh
  5@@ -6,9 +6,12 @@ if ! command -V systemctl >/dev/null 2>&1; then
  6 	exit 0
  7 fi
  8 
  9-echo "Enabling and starting soft.service"
 10+systemd-sysusers
 11+systemd-tmpfiles --create
 12+
 13+echo "Enabling and starting soft-server.service"
 14 systemctl daemon-reload
 15-systemctl unmask soft.service
 16-systemctl preset soft.service
 17-systemctl enable soft.service
 18-systemctl restart soft.service
 19+systemctl unmask soft-serve.service
 20+systemctl preset soft-serve.service
 21+systemctl enable soft-serve.service
 22+systemctl restart soft-serve.service
 23diff --git a/.nfpm/postremove.sh b/.nfpm/postremove.sh
 24index a079424b31ed51e1151d950a4165930462fcfb8e..64392df5f5f135e12c26b8f1ad6779d9f31a5844 100755
 25--- a/.nfpm/postremove.sh
 26+++ b/.nfpm/postremove.sh
 27@@ -6,6 +6,10 @@ if ! command -V systemctl >/dev/null 2>&1; then
 28 	exit 0
 29 fi
 30 
 31-systemctl stop soft.service
 32-systemctl disable soft.service
 33+echo "Disabling and starting soft-server.service"
 34+systemctl stop soft-serve.service
 35+systemctl disable soft-serve.service
 36 systemctl daemon-reload
 37+systemctl reset-failed
 38+
 39+echo "WARN: the soft-serve user/group and /var/lib/soft-serve directory were not removed"
 40diff --git a/.nfpm/soft.conf b/.nfpm/soft-serve.conf
 41rename from .nfpm/soft.conf
 42rename to .nfpm/soft-serve.conf
 43index d50663825a1e09418939bb12dd5557a1650990a2..fb1380304ee35ef0285dca9b13cf09dadf99cda8 100644
 44--- a/.nfpm/soft.conf
 45+++ b/.nfpm/soft-serve.conf
 46@@ -1,6 +1,6 @@
 47+SOFT_SERVE_DATA_PATH=/var/lib/soft-serve
 48+#SOFT_SERVE_BIND_ADDRESS=0.0.0.0
 49 #SOFT_SERVE_PORT=23231
 50 #SOFT_SERVE_HOST=domain.tld
 51-#SOFT_SERVE_BIND_ADDRESS=0.0.0.0
 52 #SOFT_SERVE_KEY_PATH=.ssh/soft_serve_server_ed25519
 53 #SOFT_SERVE_INITIAL_ADMIN_KEYS='ssh-ed25519 AAAAC3NzaC1lZDI1...'
 54-SOFT_SERVE_DATA_PATH=/var/local/lib/soft-serve
 55diff --git a/.nfpm/soft.service b/.nfpm/soft-serve.service
 56rename from .nfpm/soft.service
 57rename to .nfpm/soft-serve.service
 58index 4c292720a35d9ba178d5e538a198c14ae3bedc82..8c2845e7c9f1e78f9b845ee85dc42284cdc55bf9 100644
 59--- a/.nfpm/soft.service
 60+++ b/.nfpm/soft-serve.service
 61@@ -4,8 +4,15 @@ Documentation=https://github.com/charmbracelet/soft-serve
 62 Requires=network-online.target
 63 After=network-online.target
 64 
 65-[Install]
 66-WantedBy=multi-user.target
 67+[Service]
 68+Type=simple
 69+User=soft-serve
 70+Group=soft-serve
 71+Restart=always
 72+RestartSec=1
 73+ExecStart=/usr/bin/soft serve
 74+EnvironmentFile=-/etc/soft-serve.conf
 75+WorkingDirectory=/var/lib/soft-serve
 76 
 77 # Hardening
 78 ReadWritePaths=/var/lib/soft-serve
 79@@ -36,10 +43,5 @@ SystemCallFilter=@system-service
 80 SystemCallFilter=~@privileged @resources
 81 SystemCallArchitectures=native
 82 
 83-[Service]
 84-Type=simple
 85-Restart=always
 86-RestartSec=1
 87-ExecStartPre=mkdir -p /var/local/lib/soft-serve
 88-ExecStart=/usr/bin/soft serve
 89-EnvironmentFile=-/etc/soft.conf
 90+[Install]
 91+WantedBy=multi-user.target
 92diff --git a/.nfpm/sysusers.conf b/.nfpm/sysusers.conf
 93new file mode 100644
 94index 0000000000000000000000000000000000000000..fa4836c8e58f2cb6b6514d93be127551bf649b10
 95--- /dev/null
 96+++ b/.nfpm/sysusers.conf
 97@@ -0,0 +1 @@
 98+u soft-serve - "Soft Serve daemon user" /var/lib/soft-serve
 99diff --git a/.nfpm/tmpfiles.conf b/.nfpm/tmpfiles.conf
100new file mode 100644
101index 0000000000000000000000000000000000000000..bc6173685412bd760ae407e0ecd7713896408be4
102--- /dev/null
103+++ b/.nfpm/tmpfiles.conf
104@@ -0,0 +1 @@
105+d /var/lib/soft-serve 0750 soft-serve soft-serve