summaryrefslogtreecommitdiff
path: root/tw/services/media.scm
diff options
context:
space:
mode:
authorTimo Wilken2023-02-19 17:21:04 +0100
committerTimo Wilken2023-02-19 17:36:10 +0100
commit8e7b618a6177e423c1082ac7dc4f3d5047f45f58 (patch)
tree2bc1217e0397ef71f0d4c02269290128c5562de2 /tw/services/media.scm
parentc9d1523eb1eef983f46e0297f6a06a03991d3a43 (diff)
Use mcron's #:user instead of manual setuid
Diffstat (limited to 'tw/services/media.scm')
-rw-r--r--tw/services/media.scm9
1 files changed, 3 insertions, 6 deletions
diff --git a/tw/services/media.scm b/tw/services/media.scm
index 9533455e..34d25cf2 100644
--- a/tw/services/media.scm
+++ b/tw/services/media.scm
@@ -39,8 +39,7 @@ The service expects a @code{.yt-dlp} config directory inside this one.")
(schedule (string-or-gexp (random-time-every-second-night 'even?)) "The mcron
schedule on which to run the download script. By default, picks a random time
between 01:00 and 06:00 every second night.")
- (user (string "root") "The Unix user name to run the script as.")
- (group (string "root") "The Unix group name to run the script as."))
+ (user (string "root") "The Unix user name to run the script as."))
(define (yt-dlp-cronjob config)
(list
@@ -55,14 +54,12 @@ between 01:00 and 06:00 every second night.")
"yt-dlp-command"
#~(begin
(chdir #$(yt-dlp-configuration-media-directory config))
- ;; `setgid' first while we're still root
- (setgid (group:gid (getgr #$(yt-dlp-configuration-group config))))
- (setuid (passwd:uid (getpw #$(yt-dlp-configuration-user config))))
;; Auto-update if we're using yt-dlp from the media directory.
#$@(if yt-dlp-package '()
(list #~(system* #$yt-dlp-executable "--ignore-config" "--update")))
(execl #$yt-dlp-executable
- "yt-dlp" "--ignore-config" "--config-location" ".yt-dlp")))))))
+ "yt-dlp" "--ignore-config" "--config-location" ".yt-dlp")))
+ #:user #$(yt-dlp-configuration-user config)))))
(define yt-dlp-service-type
(service-type