This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+distributions/spacemacs-docker/deps-install/run
JAremko 1853627d58 Redesign spacemacs-docker distribution
remove trailing whitespaces

reword
2017-04-11 23:40:59 -04:00

88 lines
3.1 KiB
Text
Executable file

#!/usr/bin/emacs --script
;;; run --- Runs dependency installers for selected layers
;;
;; Copyright (c) 2012-2017 Sylvain Benner & Contributors
;;
;; Author: Eugene "JAremko" Yaremenko <w3techplayground@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;;
;;; NOTE: Usage example: https://github.com/JAremko/spacemacs-docker-seed
(shell-command-to-string "chown $UNAME:GNAME -R $UHOME")
(message "Updating Spacemacs installation...")
(shell-command-to-string "asEnvUser emacs -batch -u ${UNAME} -kill")
;; NOTE: It seems that the first time we may fail.
(shell-command-to-string "asEnvUser emacs -batch -u ${UNAME} -kill")
(message "Testing Spacemacs...")
(with-temp-buffer
(let* ((exit-code
(call-process "/bin/bash"
nil
(current-buffer)
nil
"-c"
(concat "asEnvUser make -C"
"${UHOME}/.emacs.d/tests/core/ test")))
(rets (buffer-string)))
(unless (= exit-code 0)
(error (format (concat "\n%s\n"
"Spacemacs tests failed: code(%s)\n")
rets
exit-code)))
(message "\n%s" rets)))
(load (format (concat "%s/.emacs.d/"
"layers/+distributions/spacemacs-docker/"
"deps-install/lib/deps-install-helpers.el")
(getenv "UHOME")))
(cd spacemacs-docker-temp-deps-dir)
;; FIXME: Replace `directory-files-recursively'
;; If we need `spacemacs-docker' to be compatible with Emacs24.
(dolist (installer-full-name (directory-files-recursively
spacemacs-docker-deps-installers-dir
"install\.el"))
(let ((layer (-> installer-full-name
f-dirname
f-filename)))
(when (layer-used-p layer)
(if (layer-installer-excluded-p layer)
(message (concat "Dependency installation for "
"%s layer excluded in .spacemacs!")
layer)
(message (concat "Installing dependency for %s layer...\n"
"This may take forever(perceptually)")
layer)
(with-temp-buffer
(let* ((exit-code
(call-process "/bin/bash" nil
(current-buffer)
nil
"-c"
installer-full-name))
(rets (buffer-string)))
(if (= exit-code 0)
(message "%s \nInstallation succeeded!" rets)
(error (concat "%s \n"
"Installation field!\n"
"%s exited with code: %s")
rets
installer-full-name
exit-code))))))))
($ "chown $UNAME:$GNAME -R $UHOME")
(rm "/tmp/*"
"/root/.cache"
"/root/.gem"
"/root/.npm"
"/root/.wget-hsts"
(l "%s/*" $WORKSPACE)
(l "%s/.emacs.d/.cache/recentf" $UHOME))