             [crypto.random :as crypto])
   (:import (org.rosuda.REngine REngineException)
            (org.rosuda.REngine.Rserve RConnection)))
+
+(def script-file (atom nil))
 
 (def ^:private default-packages ["RJSONIO" "Cairo"])
 

  (with-open [R (pirate/connect)]
    (try
      (do
        (source-file! R @script-file)
        (pirate/assign R "params" params)
        (pirate/assign R "files" [])

        bootstrap (str (format bootstrap-template wrapper) (join "\n" commands))]
    (spit (io/resource "bootstrap.R") bootstrap)))

(defn initialize
  "Generates a bootstrap.R file and executes scripts/start.sh in a shell
   Typically starting a new RServe with the generated file 'sourced'"
