blob: a07bf170959d508b61c2b6c03f202e8bd8b33c2c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#! /usr/bin/env sh
mkdir -p "$HOME/.config/systemd/user/"
cp MatrixAntiDmSpam@.service "$HOME/.config/systemd/user/MatrixAntiDmSpam@.service"
if [ ! -d "$HOME/.config/MatrixAntiDmSpam" ]; then
mkdir -p "$HOME/.config/MatrixAntiDmSpam"
cp -v MatrixAntiDmSpam/appsettings.Development.json "$HOME/.config/MatrixAntiDmSpam/appsettings.Template.json"
echo "Please copy and edit the template configuration to your liking."
echo "The template is located at $HOME/.config/MatrixAntiDmSpam/appsettings.Template.json"
echo "Please rename it to appsettings.{profile}.json."
echo "Once you have done so, re-run this script, and you will find the services named as 'MatrixAntiDmSpam@{profile}.service'"
exit
fi
cp MatrixAntiDmSpam@.service "$HOME/.config/systemd/user/MatrixAntiDmSpam@.service"
find "$HOME/.config/MatrixAntiDmSpam" -maxdepth 1 -type f | while read -r line; do
# enable unit
name="$(basename "$line")"
environmentName="$(echo "$name" | cut -d'.' -f2)"
echo "Found environment ${environmentName}: $line"
if [ "$environmentName" = "Template" ] || [ "$environmentName" = ".json" ]; then
echo "Skipping template file ${name}"
continue
fi
systemctl --user daemon-reload
systemctl --user enable "MatrixAntiDmSpam@${environmentName}"
systemctl --user restart "MatrixAntiDmSpam@${environmentName}"
done
|