aboutsummaryrefslogtreecommitdiff
path: root/src/connection/debian-sbcl.lisp
blob: 7befb4791fee07f0b2b487f9a8d533f8f5205e6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
;;; Consfigurator -- Lisp declarative configuration management system

;;; Copyright (C) 2021  Sean Whitton <spwhitton@spwhitton.name>

;;; This file is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3, or (at your option)
;;; any later version.

;;; This file is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.

;;; You should have received a copy of the GNU General Public License
;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

(in-package :consfigurator.connection.debian-sbcl)


;; (handler-bind ((consfigurator:missing-data-source
;;                 #'consfigurator:skip-data-source))
;;   ...)


(defmethod establish-connection ((type (eql :debian-sbcl)) remaining &key)
  ;; any connection type which starts up a Lisp connection is going to want to
  ;; do something like what this loop does, so just make it a core function?
  ;; (loop for system in (slot-value (slot-value *host* :hostattrs) :systems)
  ;; 	do (push (cons "--lisp-system" system) (getf *host* :data)))

  (unless (= 0 (nth-value 1 (run "which" "sbcl" "2>/dev/null"
				 "||" "apt-get" "-y" "install" "sbcl")))
    (error "Could not get sbcl installed on the remote host"))
  (upload-all-prerequisite-data)

  ;; I think we want a function in data.lisp which returns a LOAD form which
  ;; will load a given lisp system out of a local cache.  After calling
  ;; upload-all-prerequisite-data we can call that from here to get a form
  ;; suitable for feeding to remote sbcl.  Slight layering violation, and only
  ;; to be called by connections, not properties.  But better than exposing
  ;; get-remote-data-cache-dir.

  ;; PROGRAM is (load "~/.cache/...") (deploy :local host properties)
  ;; (multiple-value-bind ()
  ;;     (run :input program "sbcl"
  ;; 	   "--noinform"
  ;; 	   "--noprint"
  ;; 	   "--disable-debugger"
  ;; 	   "--no-sysinit"
  ;; 	   "--no-user-init"))
  ;; relay its output and signal something if it exits nonzero

  )