From 0fe16466fc16c8a317f01023b8ced953644b54aa Mon Sep 17 00:00:00 2001 From: Alexander Date: Sun, 16 Nov 2025 07:39:01 +0300 Subject: [PATCH] init 0.0.10 --- README.md | 3 +++ files/config.patch | 13 +++++++++++++ files/config.template.json | 14 ++++++++++++++ files/dwatch.tmpfiles | 1 + files/dwatchd.service | 15 +++++++++++++++ files/series | 1 + package.yml | 29 +++++++++++++++++++++++++++++ 7 files changed, 76 insertions(+) create mode 100644 README.md create mode 100644 files/config.patch create mode 100644 files/config.template.json create mode 100644 files/dwatch.tmpfiles create mode 100644 files/dwatchd.service create mode 100644 files/series create mode 100644 package.yml diff --git a/README.md b/README.md new file mode 100644 index 0000000..6af0ed7 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# dwatch + +Отслеживание изменений в файлах. diff --git a/files/config.patch b/files/config.patch new file mode 100644 index 0000000..679df2f --- /dev/null +++ b/files/config.patch @@ -0,0 +1,13 @@ +diff --git a/source/app.d b/source/app.d +index cac73be..3bb7fad 100644 +--- a/source/app.d ++++ b/source/app.d +@@ -96,7 +96,7 @@ int main(string[] args) + + ProgramArgs argumets = program.parse(args); + +- string configFile = argumets.option("config", "config.json"); ++ string configFile = argumets.option("config", "/etc/dwatch/config.json"); + + DWConfig config; + diff --git a/files/config.template.json b/files/config.template.json new file mode 100644 index 0000000..b71ce69 --- /dev/null +++ b/files/config.template.json @@ -0,0 +1,14 @@ +{ + "database": "/var/lib/dwatch/data.db", + "logfile": "/var/log/dwatch.log", + "timezone": "Europe/Moscow", + "watch": [ + { + "path": "", + "rules": { + "tracking": [], + "ignore": [] + } + } + ] +} diff --git a/files/dwatch.tmpfiles b/files/dwatch.tmpfiles new file mode 100644 index 0000000..41a6f23 --- /dev/null +++ b/files/dwatch.tmpfiles @@ -0,0 +1 @@ +d /var/lib/dwatch 0755 root root - diff --git a/files/dwatchd.service b/files/dwatchd.service new file mode 100644 index 0000000..3b9aa3d --- /dev/null +++ b/files/dwatchd.service @@ -0,0 +1,15 @@ +[Unit] +Description=DWatch server daemon for monitoring changes in text files and CLI +ConditionPathExists=/etc/dwatch/config.json + +[Service] +Type=simple +ExecStart=/usr/sbin/dwatchd -vvv +KillMode=process +KillSignal=SIGTERM +TimeoutStopSec=10s +Restart=on-failure +RestartSec=5s + +[Install] +WantedBy=multi-user.target diff --git a/files/series b/files/series new file mode 100644 index 0000000..4462183 --- /dev/null +++ b/files/series @@ -0,0 +1 @@ +config.patch diff --git a/package.yml b/package.yml new file mode 100644 index 0000000..235836b --- /dev/null +++ b/package.yml @@ -0,0 +1,29 @@ +name : dwatch +version : 0.0.10 +release : 1 +source : + - git|https://git.zhirov.kz/dwatch/dwatch.git : 35319d42c4bf81583f6978a857b8b0fc41ceb11f +homepage : https://git.zhirov.kz/dwatch/dwatch +license : BSL-1.0 +component : system.utils +summary : Monitoring changes in text files. +description: | + Monitoring changes in text files. +networking : yes +builddeps : + - ldc + - dub + - pkgconfig(xdiff) + - pkgconfig(wildmatch) + - pkgconfig(sqlite3) +setup : | + %apply_patches +build : | + dub build --build=release +install : | + install -Dm755 bin/dwatch -t ${installdir}/usr/bin + # Ссылка на сервис демона + ln -sf dwatch ${installdir}/usr/bin/dwatchd + install -Dm644 $pkgfiles/config.template.json -t ${installdir}/etc/dwatchd + install -Dm644 $pkgfiles/dwatchd.service -t ${installdir}/usr/lib/systemd/system + install -Dm00644 $pkgfiles/dwatch.tmpfiles $installdir/%libdir%/tmpfiles.d/dwatch.conf