From c2ec166dfdebd720e516337cc03cfabef7af0638 Mon Sep 17 00:00:00 2001 From: agryphus Date: Tue, 17 Oct 2023 08:01:25 -0400 Subject: [PATCH] Added sysbin script --- .local/bin/sysbin | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 .local/bin/sysbin diff --git a/.local/bin/sysbin b/.local/bin/sysbin new file mode 100755 index 0000000..ad4093c --- /dev/null +++ b/.local/bin/sysbin @@ -0,0 +1,14 @@ +#!/usr/bin/env sh +# Finds the absolute path of a system binary by checking places in most-likely order. +# Helpful for when overriding a binary with a script, meaning the script takes higher +# precedence in the path, but then the script needs to call the actual binary. +# I understand that this is not the most ~NixOS~ way of doing things. + +if [ -e "/usr/bin/$1" ]; then + echo "/usr/bin/$1" +elif [ -e "/bin/$1" ]; then + echo "/bin/$1" +elif [ -e "/run/current-system/sw/bin/$1" ]; then + echo "/run/current-system/sw/bin/$1" +fi +