From c9d1523eb1eef983f46e0297f6a06a03991d3a43 Mon Sep 17 00:00:00 2001 From: Timo Wilken Date: Sun, 19 Feb 2023 16:58:03 +0100 Subject: Generate separate script for yt-dlp mcron action --- tw/services/media.scm | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/tw/services/media.scm b/tw/services/media.scm index 910983a1..9533455e 100644 --- a/tw/services/media.scm +++ b/tw/services/media.scm @@ -51,19 +51,18 @@ between 01:00 and 06:00 every second night.") (string-append (yt-dlp-configuration-media-directory config) "/.yt-dlp/yt-dlp")))) #~(job #$(yt-dlp-configuration-schedule config) - (lambda () - (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)))) - #$@(if yt-dlp-package '() - (list #~(system* #$yt-dlp-executable "--ignore-config" "--update"))) - (execl #$yt-dlp-executable - "yt-dlp" "--ignore-config" "--config-location" ".yt-dlp")) - ;; Human-readable string for `herd schedule mcron'. - (format #f "~a --ignore-config --config-location ~a/.yt-dlp" - #$yt-dlp-executable ; this may be a `', so #$ it directly - #$(yt-dlp-configuration-media-directory config)))))) + #$(program-file + "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"))))))) (define yt-dlp-service-type (service-type -- cgit v1.2.3