|
@@ -4,6 +4,7 @@
|
|
|
#:use-module (gnu system shadow)
|
|
|
#:use-module (gnu packages admin)
|
|
|
#:use-module (gnu packages base)
|
|
|
+ #:use-module (guix build utils)
|
|
|
#:use-module (guix records)
|
|
|
#:use-module (guix gexp)
|
|
|
#:use-module (mastostart-gnu packages mastostart)
|
|
@@ -37,6 +38,36 @@
|
|
|
(home-directory "/var/empty")
|
|
|
(shell (file-append shadow "/sbin/nologin")))))
|
|
|
|
|
|
+(define (%mastostart-activation config)
|
|
|
+ "Ritorna una gexp di attivazione per MastodonStartpage database server."
|
|
|
+ #~(begin
|
|
|
+ (use-modules (ice-9 popen)
|
|
|
+ (guix build utils))
|
|
|
+ (let* ((mustard.ini
|
|
|
+ (string-append #$mastostart "/web/mustard/sec/mustard.ini"))
|
|
|
+ (crawler.ini
|
|
|
+ (string-append #$mastostart "/web/mustard/crawler/php.ini"))
|
|
|
+ (memory-limit
|
|
|
+ #$(mastostart-configuration-memory-limit config))
|
|
|
+ (test-email
|
|
|
+ #$(mastostart-configuration-test-email config))
|
|
|
+ (reference-email
|
|
|
+ #$(mastostart-configuration-reference-email config)))
|
|
|
+ (call-with-output-file crawler.ini
|
|
|
+ (lambda (port)
|
|
|
+ (display (string-append "memory_limit="
|
|
|
+ memory-limit
|
|
|
+ "\n")
|
|
|
+ port)))
|
|
|
+ (rename-file (string-append #$mastostart
|
|
|
+ "/web/mustard/sec/mustard.ini.sample")
|
|
|
+ mustard.ini)
|
|
|
+ (substitute* mustard.ini
|
|
|
+ (("pippo@pippo\\.pip")
|
|
|
+ reference-email)
|
|
|
+ (("peppe@peppe\\.pep")
|
|
|
+ test-email)))))
|
|
|
+
|
|
|
(define (mastostart-shepherd-service config)
|
|
|
(list
|
|
|
(let ((mastostart (mastostart-configuration-mastostart config))
|
|
@@ -46,13 +77,17 @@
|
|
|
(one-shot? #t)
|
|
|
(requirement '(httpd mysql))
|
|
|
(documentation "Start serving the MastodonStartpage.")
|
|
|
- (start #~(lambda _
|
|
|
- (invoke #$(file-append coreutils "/bin/rm") "-rf"
|
|
|
- #$webroot)
|
|
|
- (invoke
|
|
|
- #$(file-append coreutils "/bin/ln") "-s"
|
|
|
- #$(file-append mastostart "/web")
|
|
|
- #$webroot)))
|
|
|
+ (start (with-imported-modules '((ice-9 ftw))
|
|
|
+ #~(lambda _
|
|
|
+ (use-modules (ice-9 ftw))
|
|
|
+ (if (equal? (scandir #$webroot) '("." ".."))
|
|
|
+ (begin
|
|
|
+ (invoke #$(file-append coreutils "/bin/rm") "-rf"
|
|
|
+ #$webroot)
|
|
|
+ (invoke #$(file-append coreutils "/bin/ln") "-s"
|
|
|
+ #$(file-append mastostart "/web")
|
|
|
+ #$webroot))
|
|
|
+ #t))))
|
|
|
(stop #~(make-kill-destructor))))))
|
|
|
|
|
|
(define mastostart-service-type
|
|
@@ -61,6 +96,8 @@
|
|
|
(extensions
|
|
|
(list (service-extension account-service-type
|
|
|
(const %mastostart-accounts))
|
|
|
+ ;; (service-extension activation-service-type
|
|
|
+ ;; %mastostart-activation)
|
|
|
(service-extension shepherd-root-service-type
|
|
|
mastostart-shepherd-service)))
|
|
|
(default-value (mastostart-configuration))))
|