0
0
mirror of https://github.com/ventoy/Ventoy.git synced 2024-11-25 13:36:13 +00:00
Ventoy/VBLADE/vblade-master/contrib/persistence/vblade-generator
2020-04-05 00:08:01 +08:00

38 lines
750 B
Bash

#!/bin/sh
set -eu
SERVICEFILE="/lib/systemd/system/vblade@.service"
WANTDIR="$1/vblade.service.wants"
CONFIG_DIR=/etc/vblade.conf.d/
if [ -d "$CONFIG_DIR" ] ; then
mkdir -p "$WANTDIR"
cd "$CONFIG_DIR"
for CONFIG in *.conf ; do
[ -f "$CONFIG" ] || continue
INSTANCE="$(systemd-escape "${CONFIG%%.conf}")"
LINK="$WANTDIR/vblade@$INSTANCE.service"
sh -n "$CONFIG_DIR$CONFIG" 2>/dev/null || continue
shelf=
slot=
netif=
filename=
options=
. "$CONFIG_DIR$CONFIG"
[ "$netif" ] || continue
[ "$shelf" ] || continue
[ "$slot" ] || continue
[ "$filename" ] || continue
ln -s "$SERVICEFILE" "$LINK"
done
fi
exit 0