diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-09-10 13:52:16 +0100 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-09-10 13:52:16 +0100 |
| commit | 189b61018f8ff215220b4dab665a528db9ee3ab6 (patch) | |
| tree | 78faf108eea9479de621cb40d7d208474c1876c3 | |
| parent | e9735841230c199029fae80d25caca13e9533c6d (diff) | |
xbmk: allow running from outside of work dir
i need only now implement a check for sys dirs
e.g. /etc/lbmk.cfg and check if it defines
e.g. other location for config/ and include/
then mk is a generic dispatcher and i can one
day make mk possible to install. for example, if
you have a bsd ports system and you want to
install lbmk
i could make it check user dirs too, overriding
defaults. for example /usr/local/etc/lbmk, but
then i might have ~/.config/lbmk
you no longer need to be in the xbmk directory
to run xbmk. it'll cd to itself, with this patch
Signed-off-by: Leah Rowe <leah@libreboot.org>
| -rwxr-xr-x | mk | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -7,15 +7,29 @@ set -u -e +xrval=0 + +( ispwd="true" +xbdir="" if [ "$0" != "./mk" ]; then - ispwd="false" + if [ "${0##*/}" != "$0" ]; then + xbdir="`readlink -f "$0" 2>/dev/null`" + if [ -z "$xbdir" ]; then + xbdir="`realpath "$0" 2>/dev/null`" + fi + cd "${xbdir%/*}" || exit 1 + else + ispwd="false" + fi fi if [ "$ispwd" = "true" ] && [ -L "mk" ]; then + ispwd="false" fi if [ "$ispwd" = "false" ]; then + printf "You must run this in the proper work directory.\n" 1>&2 exit 1 fi @@ -59,3 +73,6 @@ x_ touch "$mkhelpercfg" . "$mkhelpercfg" $cmd +) || xrval=1 + +exit $xrval |
