#!/usr/bin/emacs --script ;;; run --- Runs dependency installers for selected layers ;; ;; Copyright (c) 2012-2018 Sylvain Benner & Contributors ;; ;; Author: Eugene "JAremko" Yaremenko ;; 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))