aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2022-06-22 11:14:38 +0200
committerPatrick Spek <p.spek@tyil.nl>2022-06-22 11:14:38 +0200
commit344b195149d466c12c2e27f3cf9b686912beb532 (patch)
tree662faca4dc6fe1ba32007f7d50c9fc6b6bd6d644
parent38b05499d474943eb458bb437ff7ecf7ce6faa6e (diff)
Update wrapper script
-rwxr-xr-x.local/share/wrapper.sh26
1 files changed, 22 insertions, 4 deletions
diff --git a/.local/share/wrapper.sh b/.local/share/wrapper.sh
index 7d35360..22a9d4d 100755
--- a/.local/share/wrapper.sh
+++ b/.local/share/wrapper.sh
@@ -35,15 +35,23 @@ main()
for bin in $WRAPPER_BINS
do
- [ -x "$bin" ] || continue
+ # Check if this entry is sufficient
+ wrapper_check_executable "$bin" || continue
+ # Add a firejail wrapper if desired
if [ -n "$FIREJAIL_PROFILE" ]
then
- exec firejail --profile="$FIREJAIL_PROFILE" -- \
- "$bin" $WRAPPER_OPTS "$@"
+ bin="firejail --profile=""$FIREJAIL_PROFILE"" -- $bin"
fi
- exec "$bin" $WRAPPER_OPTS "$@"
+ # Run all the things we want to run
+ wrap_before
+ printf "> %s\n" "$bin $WRAPPER_OPTS $@" >&2
+ $bin $WRAPPER_OPTS "$@"
+ exit=$?
+ wrap_after
+
+ return $exit
done
printf "No underlying executable found for %s:\n" "$wrapped" >&2
@@ -53,4 +61,14 @@ main()
done
}
+wrapper_check_executable() {
+ command -v "$1" > /dev/null && return 0
+ [ -x "$1" ] && return 0
+
+ return 1
+}
+
+wrap_before() { :; }
+wrap_after() { :; }
+
main "$@"