-
Notifications
You must be signed in to change notification settings - Fork 0
/
syncthing.install
42 lines (24 loc) · 2.47 KB
/
syncthing.install
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
34
35
36
37
38
39
40
41
42
#!/bin/bash
desktop=$(ps -e | grep kwin)
timestamp=$( date +%F-%T )
post_install() {
if [[ -n ${desktop} ]]; then
KDE_SESSION_VERSION=6 KDE_FULL_SESSION=true kdialog --yesno "To enable and start the service globally, replace 'myuser' with the actual Syncthing user after the @:<br>systemctl enable --now [email protected]<br><br>Or enable locally with:<br>systemctl --user enable --now syncthing<br><br>The admin GUI starts automatically and remains available on http://localhost:8384/<br><br>Do you want to save this output?"
save=${?}
if [[ ${save} == 1 ]]; then
kdialog --msgbox "Output not saved"
else
echo -e "To enable and start the service globally, replace 'myuser' with the actual Syncthing user after the @:\n-----------------------------------------\nsystemctl enable --now [email protected]\n-----------------------------------------\n\nOr enable locally with:\n-----------------------------------------\nsystemctl --user enable --now syncthing\n-----------------------------------------\n\nThe admin GUI starts automatically and remains available on http://localhost:8384/" > /var/log/syncthing_install_${timestamp}.txt
kdialog --msgbox "Output is saved in /var/log/syncthing_install_${timestamp}.txt"
fi
else
echo -e "To enable and start the service globally, replace 'myuser' with the actual Syncthing user after the @:\n-----------------------------------------\nsystemctl enable --now [email protected]\n-----------------------------------------\n\nOr enable locally with:\n-----------------------------------------\nsystemctl --user enable --now syncthing\n-----------------------------------------\n\nThe admin GUI starts automatically and remains available on http://localhost:8384/"
fi
}
post_upgrade() {
if [[ -n ${desktop} ]]; then
KDE_SESSION_VERSION=6 KDE_FULL_SESSION=true kdialog --yesno "In order to load the updated version of syncthing it's necessary to use:<br><br>(globally) 'systemctl daemon-reload'<br><br>Or (locally) 'systemctl --user daemon-reload'<br><br>Then restart the service"
else
echo -e "In order to load the updated version of syncthing it's necessary to restart the service\n-----------------------------------------\nGlobally: systemctl daemon-reload\nLocally: systemctl --user daemon-reload [email protected]\n-----------------------------------------\n then restart the service"
fi
}