fix and move default config file

This commit is contained in:
2020-11-09 17:28:52 +01:00
parent f15ca33a57
commit 6e28f4ffe9
6 changed files with 89 additions and 82 deletions

3
.gitignore vendored
View File

@@ -115,5 +115,8 @@ dmypy.json
# Pyre type checker
.pyre/
# Temporary Vim files
.*.swp
# config file
/config.py

View File

@@ -1,3 +1,2 @@
include LICENSE README.md
recursive-include pyinotifyd/docs *
recursive-include pyinotifyd/misc *

View File

@@ -38,7 +38,7 @@ python_install_all() {
dodir /etc/${PN}
insinto /etc/${PN}
newins ${PN}/docs/config.py.example config.py
newins ${PN}/misc/config.py.example config.py
use systemd && systemd_dounit ${PN}/misc/${PN}.service

View File

@@ -109,7 +109,7 @@ def install(name):
sys.exit(3)
files = [
(f"{pkg_dir}/docs/config.py.example", f"{config_dir}/config.py")]
(f"{pkg_dir}/misc/config.py.default", f"{config_dir}/config.py")]
for src, dst in files:
_copy_missing_file(src, dst)

View File

@@ -1,79 +0,0 @@
#!/usr/bin/env python3
####################################
# Example usage of TaskScheduler #
####################################
#async def custom_task(event, task_id):
# logging.info(f"{task_id}: execute example task: {event}")
#
#s = TaskScheduler(
# task=custom_task,
# files=True,
# dirs=False)
#####################################
# Example usage of ShellScheduler #
#####################################
#cmd = "/usr/local/bin/task.sh {maskname} {pathname} {src_pathname}"
#s = ShellScheduler(cmd=cmd)
###########################################
# Example usage of FileManagerScheduler #
###########################################
#rule = Rule(
# action="move",
# src_re="^(?P<path>.*)",
# dst_re="\g<path>.processed",
# auto_create=True,
# filemode=0o755,
# dirmode=0o644,
# user="root",
# goup="root")
#
#s = FileManagerScheduler(
# rules=[rule],
# delay=10,
# files=True,
# dirs=False)
###################
# Example watch #
###################
#event_map = EventMap({
# "IN_ACCESS": None,
# "IN_ATTRIB": None,
# "IN_CLOSE_NOWRITE": None,
# "IN_CLOSE_WRITE": s.schedule,
# "IN_CREATE": None,
# "IN_DELETE": s.cancel,
# "IN_DELETE_SELF": s.cancel,
# "IN_IGNORED": None,
# "IN_MODIFY": s.cancel,
# "IN_MOVE_SELF": None,
# "IN_MOVED_FROM": s.cancel,
# "IN_MOVED_TO": s.schedule,
# "IN_OPEN": None,
# "IN_Q_OVERFLOW": None,
# "IN_UNMOUNT": s.cancel})
#
#watch = Watch(
# path="/tmp",
# event_map=event_map,
# rec=True,
# auto_add=True)
########################
# Example pyinotifyd #
########################
pyinotifyd = Pyinotifyd(
watches=[],
shutdown_timeout=30)

View File

@@ -0,0 +1,84 @@
##########################
# TaskScheduler config #
##########################
#async def custom_task(event, task_id):
# logging.info(f"{task_id}: execute example task: {event}")
#
#task_sched = TaskScheduler(
# task=custom_task,
# files=True,
# dirs=False,
# delay=10)
###########################
# ShellScheduler config #
###########################
#shell_sched = ShellScheduler(
# cmd="/usr/local/bin/task.sh {maskname} {pathname} {src_pathname}",
# files=True,
# dirs=False,
# delay=10)
#################################
# FileManagerScheduler config #
#################################
#move_rule = Rule(
# action="move",
# src_re="^(?P<path>.*).to_move",
# dst_re="\g<path>.moved",
# auto_create=True,
# filemode=0o755,
# dirmode=0o644,
# user="root",
# goup="root",
# overwrite=False)
#delete_rule = Rule(
# action="delete",
# src_re="^(?P<path>.*).to_delete",
# rec=False)
#file_sched = FileManagerScheduler(
# rules=[move_rule, delete_rule],
# files=True,
# dirs=False,
# delay=10)
#####################
# EventMap config #
#####################
#event_map = {
# "IN_ACCESS": None,
# "IN_ATTRIB": None,
# "IN_CLOSE_NOWRITE": None,
# "IN_CLOSE_WRITE": task_sched,
# "IN_CREATE": task_sched,
# "IN_DELETE": Cancel(task_sched),
# "IN_DELETE_SELF": Cancel(task_sched),
# "IN_IGNORED": None,
# "IN_MODIFY": Cancel(task_sched),
# "IN_MOVE_SELF": None,
# "IN_MOVED_FROM": Cancel(task_sched),
# "IN_MOVED_TO": task_sched,
# "IN_OPEN": None,
# "IN_Q_OVERFLOW": None,
# "IN_UNMOUNT": Cancel(task_sched)}
#######################
# pyinotifyd config #
#######################
#pyinotifyd = Pyinotifyd(shutdown_timeout=15)
#pyinotifyd.add_watch(
# path="/watched/directory",
# event_map = event_map,
# rec=True,
# auto_add=True)