- bug fix: handle --dry-run and --dest-dir correctly.
This commit is contained in:
parent
7a5796b245
commit
2833c003d2
36
pkg-def.scm
36
pkg-def.scm
|
@ -10,7 +10,7 @@ exec scsh -le ~a/load.scm -o install-lib -e install-main -s "$0" "$@"
|
||||||
END
|
END
|
||||||
)
|
)
|
||||||
|
|
||||||
(define-package "install-lib" (1 2 0)
|
(define-package "install-lib" (1 3 0)
|
||||||
((options (bindir "Destination directory for executables" "<dir>" #t #f
|
((options (bindir "Destination directory for executables" "<dir>" #t #f
|
||||||
,(bin-dir) ,identity ,identity)))
|
,(bin-dir) ,identity ,identity)))
|
||||||
|
|
||||||
|
@ -27,21 +27,25 @@ END
|
||||||
(user)))
|
(user)))
|
||||||
|
|
||||||
;; Install "program" part (scsh-install-pkg script).
|
;; Install "program" part (scsh-install-pkg script).
|
||||||
(let ((bindir (get-option-value 'bindir)))
|
(if (phase-active? 'install)
|
||||||
(if (or (get-option-value 'dry-run) (get-option-value 'verbose))
|
(let ((bindir (string-append (get-option-value 'dest-dir)
|
||||||
(format #t "creating scsh-install-pkg script in ~a\n" bindir))
|
(get-option-value 'bindir))))
|
||||||
|
(if (or (get-option-value 'dry-run) (get-option-value 'verbose))
|
||||||
|
(format #t "creating scsh-install-pkg script in ~a\n" bindir))
|
||||||
|
|
||||||
(if (not (get-option-value 'dry-run))
|
(if (not (get-option-value 'dry-run))
|
||||||
(let ((wrapper-name (absolute-file-name "scsh-install-pkg" bindir)))
|
(let ((wrapper-name (absolute-file-name "scsh-install-pkg" bindir)))
|
||||||
|
|
||||||
(with-errno-handler
|
(with-errno-handler
|
||||||
((errno packet)
|
((errno packet)
|
||||||
(else ((display-error-and-exit "cannot create wrapper script "
|
(else ((display-error-and-exit "cannot create wrapper script "
|
||||||
wrapper-name ":\n "
|
wrapper-name ":\n "
|
||||||
(first packet)))))
|
(first packet)))))
|
||||||
|
|
||||||
(create-directory&parents bindir #o755)
|
(create-directory&parents bindir #o755)
|
||||||
(call-with-output-file wrapper-name
|
(call-with-output-file wrapper-name
|
||||||
(lambda (port)
|
(lambda (port)
|
||||||
(format port scsh-install-pkg-template (get-directory 'base #f))
|
(format port
|
||||||
(set-file-mode port #o755))))))))
|
scsh-install-pkg-template
|
||||||
|
(get-directory 'base #f))
|
||||||
|
(set-file-mode port #o755)))))))))
|
||||||
|
|
Loading…
Reference in New Issue