services: mcron: Validate jobs even in the presence of #:user.
Fixes a bug in 949672c923 whereby jobs
specifying a #:user not available in the build environment would fail
validation.
Reported by Maxim Cournoyer.
* gnu/services/mcron.scm (job-files)[validated-file]: Add "prologue"
file and pass it to 'mcron --schedule'.
			
			
This commit is contained in:
		
							parent
							
								
									ce022b2e14
								
							
						
					
					
						commit
						ef5ddb0e17
					
				
					 1 changed files with 10 additions and 1 deletions
				
			
		|  | @ -67,12 +67,21 @@ | ||||||
|                      #~(begin |                      #~(begin | ||||||
|                          (use-modules (guix build utils)) |                          (use-modules (guix build utils)) | ||||||
| 
 | 
 | ||||||
|  |                          (call-with-output-file "prologue" | ||||||
|  |                            (lambda (port) | ||||||
|  |                              ;; This prologue allows 'mcron --schedule' to | ||||||
|  |                              ;; proceed no matter what #:user option is passed | ||||||
|  |                              ;; to 'job'. | ||||||
|  |                              (write '(set! getpw | ||||||
|  |                                        (const (getpwuid (getuid)))) | ||||||
|  |                                     port))) | ||||||
|  | 
 | ||||||
|                          (call-with-output-file "job" |                          (call-with-output-file "job" | ||||||
|                            (lambda (port) |                            (lambda (port) | ||||||
|                              (write '#$job port))) |                              (write '#$job port))) | ||||||
| 
 | 
 | ||||||
|                          (invoke #+(file-append mcron "/bin/mcron") |                          (invoke #+(file-append mcron "/bin/mcron") | ||||||
|                                  "--schedule=20" "job") |                                  "--schedule=20" "prologue" "job") | ||||||
|                          (copy-file "job" #$output))) |                          (copy-file "job" #$output))) | ||||||
|                    #:options '(#:env-vars (("COLUMNS" . "150"))))) |                    #:options '(#:env-vars (("COLUMNS" . "150"))))) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Reference in a new issue