summaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorZachIR <zachir@librem.one>2025-02-28 11:33:16 -0600
committerZachIR <zachir@librem.one>2025-02-28 11:43:53 -0600
commit4338d5c6a527249bd5bbfe797cba9ff4d0ddd8ac (patch)
treee62e295c972d07c5620b440285d36b90d77bf1cb /sh
parentfdf4bbf3a585c60a18df446361a24dae4c352d6e (diff)
Add command_not_found handle for distrobox
Diffstat (limited to 'sh')
-rw-r--r--sh/profile14
1 files changed, 14 insertions, 0 deletions
diff --git a/sh/profile b/sh/profile
index 55657fa..ff237a1 100644
--- a/sh/profile
+++ b/sh/profile
@@ -130,3 +130,17 @@ addtopath "/var/lib/flatpak/exports/bin"
unset -f addtopath
unset USERPATH
unset PATHS
+
+command_not_found_handle() {
+# don't run if not in a container
+ if [ ! -e /run/.containerenv ] && [ ! -e /.dockerenv ]; then
+ exit 127
+ fi
+
+ distrobox-host-exec "${@}"
+}
+if [ -n "${ZSH_VERSION-}" ]; then
+ command_not_found_handler() {
+ command_not_found_handle "$@"
+ }
+fi