From 94e8af18b60eacfd397b288a7996fc114b853530 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Wed, 19 Oct 2022 12:00:35 +0200 Subject: [builder][server][proxy] for make targets that spawn a shell, modify bash prompt to indicate the enviroment is active --- Makefile | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 80480ee..1cfdd82 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,14 @@ DETERMINISTIC_TAR = $(GUIX_TM) shell tar -- tar \ --owner=0 --group=0 --numeric-owner \ --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime +DETERMINE_USER_SHELL_TO_USE = \ + case "$$SHELL" in \ + ?*) \ + SHELL_TO_USE="$$SHELL";; \ + *) \ + SHELL_TO_USE="/bin/sh";; \ + esac + wheel: $(GUIX_DEVSHELL) python3 -m build @@ -64,11 +72,31 @@ release: dist @printf "Generated binary release tarball for $$(arch) in:\n" @printf "./haketilo-and-hydrilla-bin-$(GET_VER)-$$(arch).tar.gz\n" +# If using bash, modify the prompt to indicate that the environment is active. shell: - $(GUIX_DEVSHELL) || true - + $(DETERMINE_USER_SHELL_TO_USE); \ + case "$$SHELL_TO_USE" in \ + *bash*) \ + HYDRILLA_SHELL_NAME=hydrilla-dev \ + $(GUIX_DEVSHELL) "$$SHELL_TO_USE" \ + --rcfile ./bashrc || true;; \ + *) \ + $(GUIX_DEVSHELL) "$$SHELL_TO_USE" || true;; \ + esac + +# Modify prompt for bash, like above. shell-with-haketilo: dist - $(GUIX_TM) shell -f guix.scm -- || true + $(DETERMINE_USER_SHELL_TO_USE); \ + case "$$SHELL_TO_USE" in \ + *bash*) \ + HYDRILLA_SHELL_NAME=hydrilla \ + $(GUIX_TM) shell \ + --rebuild-cache -f guix.scm -- \ + "$$SHELL_TO_USE" --rcfile ./bashrc || true;; \ + *) \ + $(GUIX_TM) shell --rebuild-cache -f guix.scm -- \ + || true;; \ + esac catalogs: $(GUIX_DEVSHELL) python3 setup.py compile_catalog -- cgit v1.2.3