| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# This is a launch script that takes the identifier from a systemd template unit |
| 4 |
# file and locates the corresponding configuration file in /etc/nebula |
| 5 |
# |
| 6 |
# This bodge is nesseary because YAML files can have multiple extentions |
| 7 |
|
| 8 |
|
| 9 |
set -e |
| 10 |
|
| 11 |
if [ "$1" = "" ]; then |
| 12 |
printf "USAGE: nebula-systemd-launcher [conifg]\n"; |
| 13 |
exit 1 |
| 14 |
fi |
| 15 |
|
| 16 |
CONFIG_DIR=/etc/nebula |
| 17 |
CONFIG_PATH="${CONFIG_DIR}/$1" |
| 18 |
|
| 19 |
if [ -f "${CONFIG_PATH}.yml" ]; then |
| 20 |
CONFIG_PATH="${CONFIG_PATH}.yml" |
| 21 |
elif [ -f "${CONFIG_PATH}.yaml" ]; then |
| 22 |
CONFIG_PATH="${CONFIG_PATH}.yaml" |
| 23 |
else |
| 24 |
printf "Cannot find configuration file $CONFIG_PATH.yml or $CONFIG_PATH.yaml\n" >&2 |
| 25 |
exit 1 |
| 26 |
fi |
| 27 |
|
| 28 |
/usr/bin/nebula -config $CONFIG_PATH |