Created
March 16, 2022 13:37
-
-
Save hdonnay/35775a72f443b6c226a49cb51617e2a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### onhost is the inverse of intoolbox -- it attempts to run a command on the | |
### host if invoked from inside a toolbox. | |
### | |
### It should be symlinked as the name of the command to call: | |
### ln -s `which _onhost` podman | |
### ./podman | |
set -e | |
cmd="$(basename "$0")" | |
if [ "$cmd" = '_onhost' ]; then | |
sed -En 's/^### ?//;T;p' "$0" | |
exit 1 | |
fi | |
if test -f /run/.containerenv; then | |
exec flatpak-spawn --host "${cmd}" "$@" | |
fi | |
exec command -p "$cmd" "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment