        })))
 
 (defn stage-all-the-things
-  [build-target project template-dir project-file]
+  [project project-file]
+  (let [lein-project (project/read project-file)
+        build-target (get-local-ezbake-var lein-project :build-type "foss")
+        template-dir (fs/file template-dir-prefix build-target)
+        ]
   (clean)
   (cp-template-files template-dir)
   (cp-shared-files)
-  (let [lein-project (project/read project-file)
-        config-files (cp-shared-config-files lein-project)
+  (let [config-files (cp-shared-config-files lein-project)
         config-files (cp-project-config-files project config-files)]
     (cp-doc-files lein-project)
     (cp-project-file project-file)

         :redhat-preinst  (quoted-list (get-preinst ezbake-vars upstream-ezbake-configs build-target :redhat))}))))

(defn generate-project-data-yaml
  [lein-project]
  (println "generating project_data.yaml file")
  (spit
    (fs/file staging-dir "ext" "project_data.yaml")

    (rename-debian-init-file lein-project)
    (rename-debian-default-file lein-project)
    (generate-ezbake-config-file lein-project build-target config-files)
    (generate-project-data-yaml lein-project build-target)
    (generate-manifest-file lein-project)
    (create-git-repo lein-project))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Main

(defn -main
  [& args]
  (if-let [project      (first args)]
    (let [project-file (.toString (fs/file "./configs" project (str project ".clj")))]
      (try
        (stage-all-the-things project project-file)
        (finally
          ;; this is required in order to make the threads started by sh/sh terminate,
          ;; and thus allow the jvm to exit
          (shutdown-agents))))
    (println "EZBake requires 1 argument, the project to build" "\nreceived:" args)))
