aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-10-19 12:00:35 +0200
committerWojtek Kosior <koszko@koszko.org>2022-10-19 13:38:38 +0200
commit94e8af18b60eacfd397b288a7996fc114b853530 (patch)
tree5f794a5053a33e465568117749a6e849d140ecca
parentf4ea358ff01eea172125cda165612a4c15cbbfee (diff)
downloadhaketilo-hydrilla-94e8af18b60eacfd397b288a7996fc114b853530.tar.gz
haketilo-hydrilla-94e8af18b60eacfd397b288a7996fc114b853530.zip
[builder][server][proxy] for make targets that spawn a shell, modify bash prompt to indicate the enviroment is active
-rw-r--r--Makefile34
-rw-r--r--bashrc15
2 files changed, 46 insertions, 3 deletions
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
diff --git a/bashrc b/bashrc
new file mode 100644
index 0000000..1d0047c
--- /dev/null
+++ b/bashrc
@@ -0,0 +1,15 @@
+# SPDX-License-Identifier: CC0-1.0
+
+# Copyright (C) 2022 Wojtek Kosior <koszko@koszko.org>
+#
+# Available under the terms of Creative Commons Zero v1.0 Universal.
+
+if [ -r /etc/bash.bashrc ]; then
+ source /etc/bash.bashrc
+fi
+
+if [ -r ~/.bashrc ]; then
+ source ~/.bashrc
+fi
+
+export PS1="$PS1($HYDRILLA_SHELL_NAME)\$ "