summaryrefslogtreecommitdiff
path: root/.local/bin/emacs-install
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2025-08-25 21:05:07 +0200
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2025-08-25 21:05:07 +0200
commitc53b1a4845841cf7b306247f18bbfecbed19e51c (patch)
tree64cba9ef720ec1ffcf6bdaa2d436155455bd819f /.local/bin/emacs-install
parent28637f8c2a318f3c752f00d979a79fd1f9b4845f (diff)
downloaddotfiles-c53b1a4845841cf7b306247f18bbfecbed19e51c.tar.xz
Simplify Emacs build script
With some gratuitous variable renaming (add some _dir suffixes) & bashism banishment (port a [[ =~ ]] to plain case).
Diffstat (limited to '.local/bin/emacs-install')
-rwxr-xr-x.local/bin/emacs-install20
1 files changed, 12 insertions, 8 deletions
diff --git a/.local/bin/emacs-install b/.local/bin/emacs-install
index b8a98aa..301d897 100755
--- a/.local/bin/emacs-install
+++ b/.local/bin/emacs-install
@@ -2,18 +2,22 @@
set -eux
-build=${EMACS_BUILD:-.}
+build_dir=${EMACS_BUILD:-.}
+
+cd "${build_dir}"
+make install
# Retrieve installation directory. Many ways to do this; parsing
# 'config.status --config' might be TRT in principle; for simplicity,
# just:
-prefix=$(sed -n s/'^prefix *= *'//p "${build}"/Makefile)
-
-cd "${build}"
-make install
+prefix_dir=$(sed -n s/'^prefix *= *'//p Makefile)
+apps_dir=~/apps
-[[ ${prefix} =~ ~/apps/(.*) ]] || exit
-target=${BASH_REMATCH[1]}
+case ${prefix_dir}
+in
+ ${apps_dir}/*) target=${prefix_dir##${apps_dir}/} ;;
+ *) exit ;;
+esac
-cd ~/apps
+cd ${apps_dir}
ln -fsvT "${target}" emacs