services: qbittorrent: Add default configuration file.

* rosenthal/services/bittorrent.scm (%qbittorrent-default-config-file):
New variable.
(qbittorrent-activation): Install it.
pull/2/head
Hilton Chain 12 months ago
parent 73e4ea9ae0
commit 08c2d38b09
No known key found for this signature in database
GPG Key ID: ACC66D09CA528292
  1. 30
      rosenthal/services/bittorrent.scm

@ -3,6 +3,7 @@
;; SPDX-License-Identifier: GPL-3.0-or-later ;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal services bittorrent) (define-module (rosenthal services bittorrent)
#:use-module (ice-9 format)
#:use-module (guix gexp) #:use-module (guix gexp)
#:use-module (guix records) #:use-module (guix records)
#:use-module (gnu packages admin) #:use-module (gnu packages admin)
@ -44,15 +45,32 @@
(home-directory "/var/empty") (home-directory "/var/empty")
(shell (file-append shadow "/sbin/nologin"))))) (shell (file-append shadow "/sbin/nologin")))))
;; Set default password to adminadmin
(define %qbittorrent-default-config-file
(plain-file
"qBittorrent.conf"
(format #f "~
[LegalNotice]
Accepted=true
[Preferences]
WebUI\\Password_PBKDF2=\"@ByteArray(ARQ77eY1NUZaQsuDHbIMCA==:0WMRkYTUWVT9wVvdDtHAjU9b3b7uB8NR1Gur2hmQCvCDpm39Q+PsJRJPaCU51dEiz+dTzh8qbPsL8WkFljQYFQ==)\"~%")))
(define qbittorrent-activation (define qbittorrent-activation
(match-record-lambda <qbittorrent-configuration> (match-record-lambda <qbittorrent-configuration>
(qbittorrent webui-port profile-directory extra-options) (profile-directory)
#~(begin #~(begin
(use-modules (guix build utils)) (use-modules (srfi srfi-26)
(let ((profile-directory #$profile-directory) (guix build utils))
(user (getpwnam "qbittorrent"))) (let ((user (getpwnam "qbittorrent"))
(mkdir-p profile-directory) (config-file
(chown profile-directory (passwd:uid user) (passwd:gid user)))))) (string-append
#$profile-directory "/qBittorrent/config/qBittorrent.conf")))
(unless (file-exists? config-file)
(mkdir-p (dirname config-file))
(copy-file #$%qbittorrent-default-config-file config-file)
(map (cut chown <> (passwd:uid user) (passwd:gid user))
(cons #$profile-directory
(find-files #$profile-directory #:directories? #t))))))))
(define qbittorrent-shepherd-service (define qbittorrent-shepherd-service
(match-record-lambda <qbittorrent-configuration> (match-record-lambda <qbittorrent-configuration>

Loading…
Cancel
Save