Clean up VM scripts a bit.

This commit is contained in:
Andreas B. Mundt 2023-09-04 13:20:17 +02:00
parent 3ea922c263
commit da71eed94b
5 changed files with 66 additions and 81 deletions

View file

@ -4,10 +4,11 @@ Description=share home folders via virtiofsd
[Service]
Type=exec
ExecStart=/usr/bin/sh -c 'v="%i"; soc="$${v%%:*}"; usr="$${v##*:}"; exec /usr/lib/qemu/virtiofsd --socket-path="/run/virtiofsd/$${soc}.sock" -o source="/lmn/media/$${usr}"'
ExecStartPost=chmod 755 /run/virtiofsd/
ExecStartPost=/usr/bin/sh -c 'v="%i"; soc="$${v%%:*}"; usr="$${v##*:}"; chown "$$usr" "/run/virtiofsd/$${soc}.sock"'
ExecStopPost=/usr/bin/sh -c 'v="%i"; soc="$${v%%:*}"; rm "/run/virtiofsd/$${soc}.sock"'
ExecStartPre=/usr/bin/mkdir -p /run/virtiofs/
ExecStart=/usr/bin/sh -c 'v="%i"; soc="$${v%%:*}"; usr="$${v##*:}"; exec /usr/lib/qemu/virtiofsd --socket-path="/run/virtiofs/$${soc}.sock" -o source="/lmn/media/$${usr}"'
ExecStartPost=/usr/bin/chmod 755 /run/virtiofs/
ExecStartPost=/usr/bin/sh -c 'v="%i"; soc="$${v%%:*}"; usr="$${v##*:}"; chown "$$usr" "/run/virtiofs/$${soc}.sock"'
ExecStopPost=/usr/bin/sh -c 'v="%i"; soc="$${v%%:*}"; rm "/run/virtiofs/$${soc}.sock"'
SuccessExitStatus=1
[Install]