cdist-contrib/type/__matrix_synapse/gencode-remote

36 lines
645 B
Bash
Executable file

#!/bin/sh
os=$(cat "$__global/explorer/os")
init=$(cat "$__global/explorer/init")
case "$os" in
alpine)
synapse_conf_dir=/etc/synapse
synapse_service=synapse
;;
debian|ubuntu)
synapse_conf_dir=/etc/matrix-synapse
synapse_service=matrix-synapse
;;
*)
echo "Unknown OS $os." >&2
exit 1
;;
esac
if grep -qE "^__file$synapse_conf_dir" "${__messages_in}"; then
case "$init" in
systemd)
echo "systemctl restart $synapse_service"
;;
initd)
echo "service --ifstopped $synapse_service start"
echo "service --ifstarted $synapse_service restart"
;;
*)
echo "Unknown init $init." >&2
exit 1
;;
esac
fi