Replace use of depreciated function 'tmpnam.
Fix command line argument nesting. Update comment for usage at comment line.
This commit is contained in:
parent
389e355f91
commit
12d6628ba3
|
@ -19,7 +19,7 @@
|
||||||
;;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
;;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
;; Generate a bootable image with:
|
;; Generate a bootable image with:
|
||||||
;; $ ./nongnu/system/build-image.scm
|
;; $ chmod +x build-image.scm && ./build-image.scm
|
||||||
|
|
||||||
; Searches through Scheme file for 'define and 'define* expressions
|
; Searches through Scheme file for 'define and 'define* expressions
|
||||||
; such as (define <name> ... ) or (define (<name> ...) ...)
|
; such as (define <name> ... ) or (define (<name> ...) ...)
|
||||||
|
@ -37,15 +37,20 @@
|
||||||
exp)
|
exp)
|
||||||
(#t (next (read port))))))))
|
(#t (next (read port))))))))
|
||||||
|
|
||||||
; Writes channel-list to a tmpfile defined by (tmpnam)
|
; Writes channel-list to a tmpfile
|
||||||
; 'use-module is assumed to be needed, does not do anything if not used. TODO: remove assumption.
|
; 'use-module is assumed to be needed, does not do anything if not used. TODO: remove assumption.
|
||||||
|
; TODO: get mkstemp! to work (result of using it was a blank file)
|
||||||
(define (make-tmp-channel channel-list)
|
(define (make-tmp-channel channel-list)
|
||||||
(let ((tmpath (tmpnam)))
|
(let loop ((tmpath (string-append "/tmp/guix-channel"
|
||||||
(call-with-output-file tmpath
|
(number->string (random 1000000)))))
|
||||||
|
(cond ((file-exists? tmpath)
|
||||||
|
(loop (string-append "/tmp/guix-channel"
|
||||||
|
(number->string (random 1000000)))))
|
||||||
|
(#t (call-with-output-file tmpath
|
||||||
(lambda (port)
|
(lambda (port)
|
||||||
(write '(use-modules (guix ci)) port)
|
(write '(use-modules (guix ci)) port)
|
||||||
(write channel-list port)))
|
(write channel-list port)))
|
||||||
tmpath))
|
tmpath))))
|
||||||
|
|
||||||
; Main function called when run at command line.
|
; Main function called when run at command line.
|
||||||
; Parses "nongnu/system/install.scm" for channel definition
|
; Parses "nongnu/system/install.scm" for channel definition
|
||||||
|
@ -57,7 +62,7 @@
|
||||||
; supports "--uncompressed" command line argument
|
; supports "--uncompressed" command line argument
|
||||||
; If "--roll-back" is used as an argument, reverts guix pull
|
; If "--roll-back" is used as an argument, reverts guix pull
|
||||||
; Returns #t if exit-code is 0, else returns #f
|
; Returns #t if exit-code is 0, else returns #f
|
||||||
(define (build-image . args)
|
(define (build-image args)
|
||||||
(let* ((image-type 'iso) ; todo: parse args for supported image types
|
(let* ((image-type 'iso) ; todo: parse args for supported image types
|
||||||
(image-label "nonguix-install")
|
(image-label "nonguix-install")
|
||||||
(channel-define-name '%channels)
|
(channel-define-name '%channels)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user