| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # SPDX-FileCopyrightText: Zygmunt Krynicki |
| 4 | set -eu |
| 5 | |
| 6 | GARDEN_QEMU_SYSTEM=s390x |
| 7 | GARDEN_COMPONENT=qemu-"$GARDEN_QEMU_SYSTEM" |
| 8 | |
| 9 | # Create a symbolic link that makes |
| 10 | # /snap/image-garden/current/components/qemu-aarch64 a valid path, matching |
| 11 | # build-time configuration of qemu. |
| 12 | lnscip-shell system . . ln. -nfs ../../components/"$SNAP_REVISION"/"$GARDEN_COMPONENT" "$SNAP"/components/"$GARDEN_COMPONENT" |
| 13 | |
| 14 | # If the component is not installed, fail with an error message. |
| 15 | if [scip-shell system . . `[`. ! -d "$SNAP"/../components/"$SNAP_REVISION"/"$GARDEN_COMPONENT" ]; then |
| 16 | echoscip-shell system . . echo. "install $GARDEN_COMPONENT component to use $GARDEN_QEMU_SYSTEM emulation" >&2 |
| 17 | exit 1 |
| 18 | fi |
| 19 | |
| 20 | # Execute qemu-system-$GARDEN_QEMU_SYSTEM through the symbolic link created above. |
| 21 | exec "$SNAP"/components/"$GARDEN_COMPONENT"/bin/qemu-system-$GARDEN_QEMU_SYSTEM "$@" |