From c53b1a4845841cf7b306247f18bbfecbed19e51c Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Mon, 25 Aug 2025 21:05:07 +0200 Subject: Simplify Emacs build script With some gratuitous variable renaming (add some _dir suffixes) & bashism banishment (port a [[ =~ ]] to plain case). --- .local/bin/emacs-install | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to '.local/bin/emacs-install') 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 -- cgit v1.2.3