| 1 |
#!/bin/sh |
| 2 |
# SPDX-License-Identifier: Apache-2.0 |
| 3 |
# SPDX-FileCopyrightText: Zygmunt Krynicki |
| 4 |
set -eu |
| 5 |
V="$(snapctl get spread-variant)" |
| 6 |
case "$V" in |
| 7 |
'') |
| 8 |
if [ ! -x "$SNAP"/../components/"$SNAP_REVISION"/spread/spread ]; then |
| 9 |
if ! echo "$SNAP_REVISION" | grep -E -q 'x[0-9]+'; then |
| 10 |
echo "Installing component with spread..." >&2 |
| 11 |
exec snapctl install +spread >&2 |
| 12 |
fi |
| 13 |
fi |
| 14 |
exit 0 |
| 15 |
;; |
| 16 |
[a-z][a-z0-9]*) |
| 17 |
if [ ! -x "$SNAP"/../components/"$SNAP_REVISION"/spread-"$V"/spread ]; then |
| 18 |
if ! echo "$SNAP_REVISION" | grep -E -q 'x[0-9]+'; then |
| 19 |
echo "Installing component with spread variant (spread-$V)..." >&2 |
| 20 |
exec snapctl install +spread-"$V" >&2 |
| 21 |
fi |
| 22 |
fi |
| 23 |
;; |
| 24 |
*) |
| 25 |
echo "spread-variant may only use ASCII alphanumerical characters or dashes" >&2 |
| 26 |
exit 1 |
| 27 |
;; |
| 28 |
esac |