From 6a1d9c342bb49de15fc25d97568cb303f9af0954 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sat, 13 Mar 2021 22:19:27 -0500 Subject: [PATCH] ENH only install emacs packages when needed DEL haskell emacs deps (don't need them anymore) --- dot_bin/executable_bootstrap_pkgs | 22 ++++++++++++---------- run_once_after_10_install-packages.sh | 15 --------------- 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/dot_bin/executable_bootstrap_pkgs b/dot_bin/executable_bootstrap_pkgs index a43ba4d..faa8372 100644 --- a/dot_bin/executable_bootstrap_pkgs +++ b/dot_bin/executable_bootstrap_pkgs @@ -63,17 +63,19 @@ run_yay() { ## packages for emacs (install emacs first to read the config) pacman --needed -S emacs + # call emacs once to initialize it - sudo -u "$home_user" emacs -batch -l "$emacs_dir/init.el" - # get a list of packages emacs needs - sudo -u "$home_user" emacs -batch -l "$emacs_dir/init.el" --eval \ - '(print (format "pkgs: %s" (s-join " " (nd/get-aur-dependencies t))))' - IFS=' ' read -r -a emacs_pkgs \ - < <(sudo -u "$home_user" emacs -batch -l "$emacs_dir/init.el" --eval \ - '(print (format "pkgs: %s" (s-join " " (nd/get-aur-dependencies t))))' \ - 2>/dev/null | \ - sed -n -e 's/"pkgs: \(.*\)"/\1/p') - echo "Emacs requires the following system pkgs: ${emacs_pkgs[*]}" + if sudo -u "$home_user" emacs -batch -l "$emacs_dir/init.el"; then + IFS=' ' read -r -a emacs_pkgs \ + < <(sudo -u "$home_user" emacs -batch -l "$emacs_dir/init.el" --eval \ + '(print (format "pkgs: %s" (s-join " " (nd/get-aur-dependencies t))))' \ + 2>/dev/null | \ + sed -n -e 's/"pkgs: \(.*\)"/\1/p') + echo "Emacs requires the following system pkgs: ${emacs_pkgs[*]}" + else + echo "Could not get list of emacs dependencies. Install them later." + emacs_pkgs=() + fi ## other packages for random gizmos dunst_pkgs=(dunst) diff --git a/run_once_after_10_install-packages.sh b/run_once_after_10_install-packages.sh index b8cb1df..d384750 100644 --- a/run_once_after_10_install-packages.sh +++ b/run_once_after_10_install-packages.sh @@ -46,21 +46,6 @@ clone_maybe https://github.com/ndwarshuis/.emacs.d.git "$emacs_dir" sudo "$HOME/.bin/bootstrap_pkgs" "$(whoami)" "$HOME/.local/share/packages" "$emacs_dir" -# Install Haskell dependencies for emacs. This is only necessary because some -# Haskell programs are not packaged as "bin" or "stack" packages, in which case -# arch will pull in a bunch of crap because dynamic linking - -IFS=' ' read -r -a emacs_stack_pkgs \ - < <(emacs -batch -l "$emacs_dir/init.el" --eval \ - '(print (format "pkgs: %s" (s-join " " (nd/get-stack-dependencies))))' \ - 2>/dev/null | \ - sed -n -e 's/"pkgs: \(.*\)"/\1/p') -echo "Emacs requires the following Haskell packages: ${emacs_stack_pkgs[*]}" -for p in "${emacs_stack_pkgs[@]}"; -do - stack install "$p" -done - ## CLONE/BUILD HASKELL-BASED REPOS # TODO not dry (this is in .pam_environment)