Commit 8dc53fc6 authored by Eric Timmons's avatar Eric Timmons
Browse files

Better handling of CLPM_BUNDLE_BIN_PATH from clpm-live

parent 7a3a35cd
#!/usr/bin/sbcl --script
;;;; Script to load in CLPM and run its main method. -*- mode: common-lisp; -*-
#!/bin/sh
":" ; exec sbcl --script "$0" "$@" # -*- mode: common-lisp; -*-
;;;; Script to load in CLPM and run its main method.
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.
......@@ -52,6 +53,9 @@
(asdf:load-system :clpm)))))
(load-clpm))
;; Record the pathname to this script.
(setf clpm/utils:*live-script-location* (uiop:native-namestring *load-truename*))
;; If a REPL is requested, start 'er up
(when (equal (uiop:getenv "CLPM_LIVE_PRIVATE_REPL") "true")
(sb-impl::toplevel-repl nil))
......
......@@ -10,7 +10,8 @@
#:clpm/clpmfile
#:clpm/execvpe
#:clpm/log
#:clpm/source)
#:clpm/source
#:clpm/utils)
(:import-from #:net.didierverna.clon
#:defsynopsis
#:make-context
......@@ -45,7 +46,8 @@
(log:debug "asdf pathnames available in new process:~%~A" asdf-pathnames)
(execvpe (first command) (rest command)
`(("CL_SOURCE_REGISTRY" . ,cl-source-registry-value)
("CLPM_BUNDLE_BIN_PATH" . ,(first (uiop:raw-command-line-arguments)))
("CLPM_BUNDLE_BIN_PATH" . ,(or *live-script-location*
(uiop:argv0)))
("CLPM_BUNDLE_CLPMFILE" . ,(uiop:native-namestring clpmfile-pathname))
("CLPM_BUNDLE_CLPMFILE_LOCK" . ,(uiop:native-namestring lockfile-pathname)))
t))
......
......@@ -7,11 +7,21 @@
(:use #:cl
#:puri
#:split-sequence)
(:export #:run-program-augment-env-args
(:export #:*live-script-location*
#:run-program-augment-env-args
#:uri-to-string))
(in-package #:clpm/utils)
(defvar *live-script-location* nil
"If loaded from scripts/clpm-live, this is set to the pathname where the
clpm-live script is located.")
(defun clear-live-script-location ()
"On image dump, remove the pathname to the clpm-live script."
(setf *live-script-location* nil))
(uiop:register-image-dump-hook 'clear-live-script-location)
#+sbcl
(defun run-program-augment-env-args (new-env-alist)
"Given an alist of environment variables, return a list of arguments suitable
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment