whisparr-eros: set the first password in the unit, write creds with cat

This commit is contained in:
MickLesk committed 2026-11-11 22:47:21 +01:00
1 parent 1d3c6cce94
commit a05406e097
1 file changed
+8 -12
+8 -12
View File
@@ -27,6 +27,7 @@ chmod 775 /var/lib/whisparr-eros/ /opt/Whisparr-Eros/
msg_ok "Configured Whisparr-Eros"
msg_info "Creating Service"
WHISPARR_PASS=$(random_password 20)
cat <<EOF >/etc/systemd/system/whisparr-eros.service
[Unit]
Description=Whisparr-Eros Daemon
@@ -35,6 +36,7 @@ After=syslog.target network.target
[Service]
UMask=0002
Type=simple
Environment=WHISPARR__AUTH__INITIALPASSWORD=${WHISPARR_PASS}
ExecStart=/opt/Whisparr-Eros/Whisparr -nobrowser -data=/var/lib/whisparr-eros/
TimeoutStopSec=20
KillMode=process
@@ -43,24 +45,18 @@ Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
WHISPARR_PASS=$(random_password 20)
mkdir -p /etc/systemd/system/whisparr-eros.service.d
cat <<EOF >/etc/systemd/system/whisparr-eros.service.d/initial-user.conf
[Service]
Environment=WHISPARR__AUTH__INITIALPASSWORD=${WHISPARR_PASS}
EOF
systemctl enable -q --now whisparr-eros
for _ in {1..60}; do
grep -qs "created 'whisparr' with the configured password" /var/lib/whisparr-eros/logs/whisparr.txt && break
sleep 2
done
rm -rf /etc/systemd/system/whisparr-eros.service.d
sed -i '/WHISPARR__AUTH__INITIALPASSWORD/d' /etc/systemd/system/whisparr-eros.service
systemctl daemon-reload
{
echo "Whisparr-Eros Credentials"
echo "Username: whisparr"
echo "Password: ${WHISPARR_PASS}"
} >~/whisparr-eros.creds
cat <<EOF >~/whisparr-eros.creds
Whisparr-Eros Credentials
Username: whisparr
Password: ${WHISPARR_PASS}
EOF
chmod 600 ~/whisparr-eros.creds
msg_ok "Created Service"