Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | #! /bin/sh |
| 2 | # Copyright 2020 Garmin Ltd. or its subsidiaries |
| 3 | # |
| 4 | # SPDX-License-Identifier: GPL-2.0 |
| 5 | # |
| 6 | # Attempts to find and exec the host qemu-bridge-helper program |
| 7 | |
| 8 | # If the QEMU_BRIDGE_HELPER variable is set by the user, exec it. |
| 9 | if [ -n "$QEMU_BRIDGE_HELPER" ]; then |
| 10 | exec "$QEMU_BRIDGE_HELPER" "$@" |
| 11 | fi |
| 12 | |
| 13 | # Search common paths for the helper program |
| 14 | BN="qemu-bridge-helper" |
| 15 | PATHS="/usr/libexec/ /usr/lib/qemu/" |
| 16 | |
| 17 | for p in $PATHS; do |
| 18 | if [ -e "$p/$BN" ]; then |
| 19 | exec "$p/$BN" "$@" |
| 20 | fi |
| 21 | done |
| 22 | |
| 23 | echo "$BN not found!" > /dev/stderr |
| 24 | exit 1 |
| 25 | |