mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-13 10:30:16 +00:00
syncthing: Made it a systemd service
This commit is contained in:
parent
e531e9ac9c
commit
53645deebf
@ -21,7 +21,6 @@ Configuration helper for Syncthing.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import augeas
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from plinth import action_utils
|
from plinth import action_utils
|
||||||
@ -42,20 +41,32 @@ def parse_arguments():
|
|||||||
|
|
||||||
def subcommand_setup(_):
|
def subcommand_setup(_):
|
||||||
"""Setup Syncthing configuration."""
|
"""Setup Syncthing configuration."""
|
||||||
action_utils.service_restart('syncthing')
|
subprocess.check_call(
|
||||||
|
['cp', '/lib/systemd/system/syncthing@.service', '/etc/systemd'])
|
||||||
|
service_enable()
|
||||||
action_utils.webserver_enable('syncthing-plinth')
|
action_utils.webserver_enable('syncthing-plinth')
|
||||||
|
|
||||||
|
|
||||||
|
def service_enable():
|
||||||
|
"""Start the Syncthing service as plinth user"""
|
||||||
|
subprocess.check_call(['systemctl', 'start', 'syncthing@plinth.service'])
|
||||||
|
|
||||||
|
|
||||||
|
def service_disable():
|
||||||
|
"""Stop the Syncthing service as plinth user"""
|
||||||
|
subprocess.check_call(['systemctl', 'stop', 'syncthing@plinth.service'])
|
||||||
|
|
||||||
|
|
||||||
def subcommand_enable(_):
|
def subcommand_enable(_):
|
||||||
"""Enable web configuration and reload."""
|
"""Enable web configuration and reload."""
|
||||||
action_utils.service_enable('syncthing')
|
service_enable()
|
||||||
action_utils.webserver_enable('syncthing-plinth')
|
action_utils.webserver_enable('syncthing-plinth')
|
||||||
|
|
||||||
|
|
||||||
def subcommand_disable(_):
|
def subcommand_disable(_):
|
||||||
"""Disable web configuration and reload."""
|
"""Disable web configuration and reload."""
|
||||||
action_utils.webserver_disable('syncthing-plinth')
|
action_utils.webserver_disable('syncthing-plinth')
|
||||||
action_utils.service_disable('syncthing')
|
service_disable()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
@ -18,6 +18,8 @@
|
|||||||
Plinth module to configure Syncthing.
|
Plinth module to configure Syncthing.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import actions
|
from plinth import actions
|
||||||
@ -93,7 +95,7 @@ def add_shortcut():
|
|||||||
|
|
||||||
def is_enabled():
|
def is_enabled():
|
||||||
"""Return whether the module is enabled."""
|
"""Return whether the module is enabled."""
|
||||||
return (action_utils.service_is_enabled('syncthing') and
|
return (action_utils.service_is_enabled('syncthing@plinth.service') and
|
||||||
action_utils.webserver_is_enabled('syncthing-plinth'))
|
action_utils.webserver_is_enabled('syncthing-plinth'))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user